Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove deprecated methods in Security #8287

Merged
merged 2 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 0 additions & 86 deletions system/Security/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,46 +231,6 @@ private function configureCookie(CookieConfig $cookie): void
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
*
Expand Down Expand Up @@ -444,18 +404,6 @@ public function getCookieName(): string
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.
*/
Expand Down Expand Up @@ -588,40 +536,6 @@ private function saveHashInCookie(): void
$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);
Expand Down
7 changes: 0 additions & 7 deletions system/Security/SecurityInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ public function getHeaderName(): string;
*/
public function getCookieName(): string;

/**
* Check if CSRF cookie is expired.
*
* @deprecated
*/
public function isExpired(): bool;

/**
* Check if request should be redirect on failure.
*/
Expand Down
11 changes: 11 additions & 0 deletions user_guide_src/source/changelogs/v4.5.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,17 @@ Response
- ``ResponseTrait::$cookieSameSite``
- ``ResponseTrait::$cookies``

Security
--------

- ``SecurityInterface::isExpired()``
- ``Security::isExpired()``
- ``Security::CSRFVerify()``
- ``Security::getCSRFHash()``
- ``Security::getCSRFTokenName()``
- ``Security::sendCookie()``
- ``Security::doSendCookie()``

CodeIgniter
-----------

Expand Down
Loading