mirror of
https://github.com/codeigniter4/CodeIgniter4.git
synced 2025-02-20 11:44:28 +08:00
refactor: remove deprecated methods in Security
This commit is contained in:
parent
f9679ec86e
commit
846ac3f0a0
@ -231,46 +231,6 @@ class Security implements SecurityInterface
|
||||
Cookie::setDefaults($cookie);
|
||||
}
|
||||
|
||||
/**
|
||||
* CSRF Verify
|
||||
*
|
||||
* @return $this|false
|
||||
*
|
||||
* @throws SecurityException
|
||||
*
|
||||
* @deprecated Use `CodeIgniter\Security\Security::verify()` instead of using this method.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function CSRFVerify(RequestInterface $request)
|
||||
{
|
||||
return $this->verify($request);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the CSRF Token.
|
||||
*
|
||||
* @deprecated Use `CodeIgniter\Security\Security::getHash()` instead of using this method.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getCSRFHash(): ?string
|
||||
{
|
||||
return $this->getHash();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the CSRF Token Name.
|
||||
*
|
||||
* @deprecated Use `CodeIgniter\Security\Security::getTokenName()` instead of using this method.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getCSRFTokenName(): string
|
||||
{
|
||||
return $this->getTokenName();
|
||||
}
|
||||
|
||||
/**
|
||||
* CSRF Verify
|
||||
*
|
||||
@ -444,18 +404,6 @@ class Security implements SecurityInterface
|
||||
return $this->config->cookieName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if CSRF cookie is expired.
|
||||
*
|
||||
* @deprecated
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function isExpired(): bool
|
||||
{
|
||||
return $this->cookie->isExpired();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if request should be redirect on failure.
|
||||
*/
|
||||
@ -588,40 +536,6 @@ class Security implements SecurityInterface
|
||||
$response->setCookie($this->cookie);
|
||||
}
|
||||
|
||||
/**
|
||||
* CSRF Send Cookie
|
||||
*
|
||||
* @return false|Security
|
||||
*
|
||||
* @deprecated Set cookies to Response object instead.
|
||||
*/
|
||||
protected function sendCookie(RequestInterface $request)
|
||||
{
|
||||
assert($request instanceof IncomingRequest);
|
||||
|
||||
if ($this->cookie->isSecure() && ! $request->isSecure()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->doSendCookie();
|
||||
log_message('info', 'CSRF cookie sent.');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Actual dispatching of cookies.
|
||||
* Extracted for this to be unit tested.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @deprecated Set cookies to Response object instead.
|
||||
*/
|
||||
protected function doSendCookie(): void
|
||||
{
|
||||
cookies([$this->cookie], false)->dispatch();
|
||||
}
|
||||
|
||||
private function saveHashInSession(): void
|
||||
{
|
||||
$this->session->set($this->config->tokenName, $this->hash);
|
||||
|
@ -184,6 +184,16 @@ Response
|
||||
- ``ResponseTrait::$cookieSameSite``
|
||||
- ``ResponseTrait::$cookies``
|
||||
|
||||
Security
|
||||
--------
|
||||
|
||||
- ``Security::CSRFVerify()``
|
||||
- ``Security::getCSRFHash()``
|
||||
- ``Security::getCSRFTokenName()``
|
||||
- ``Security::isExpired()``
|
||||
- ``Security::sendCookie()``
|
||||
- ``Security::doSendCookie()``
|
||||
|
||||
CodeIgniter
|
||||
-----------
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user