Skip to content
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
10 changes: 5 additions & 5 deletions src/AuthenticationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public function authenticate(ServerRequestInterface $request): ResultInterface

if ($result === null) {
throw new RuntimeException(
'No authenticators loaded. You need to load at least one authenticator.'
'No authenticators loaded. You need to load at least one authenticator.',
);
}

Expand Down Expand Up @@ -247,7 +247,7 @@ public function clearIdentity(ServerRequestInterface $request, ResponseInterface
public function persistIdentity(
ServerRequestInterface $request,
ResponseInterface $response,
ArrayAccess|array $identity
ArrayAccess|array $identity,
): array {
foreach ($this->authenticators() as $authenticator) {
if ($authenticator instanceof PersistenceInterface) {
Expand Down Expand Up @@ -348,7 +348,7 @@ public function buildIdentity(ArrayAccess|array $identityData): IdentityInterfac
throw new RuntimeException(sprintf(
'Object `%s` does not implement `%s`',
get_class($identity),
IdentityInterface::class
IdentityInterface::class,
));
}

Expand Down Expand Up @@ -450,7 +450,7 @@ public function impersonate(
ServerRequestInterface $request,
ResponseInterface $response,
ArrayAccess $impersonator,
ArrayAccess $impersonated
ArrayAccess $impersonated,
): array {
$provider = $this->getImpersonationProvider();

Expand Down Expand Up @@ -499,7 +499,7 @@ protected function getImpersonationProvider(): ImpersonationInterface
if (!($provider instanceof ImpersonationInterface)) {
$className = get_class($provider);
throw new InvalidArgumentException(
"The {$className} Provider must implement ImpersonationInterface in order to use impersonation."
"The {$className} Provider must implement ImpersonationInterface in order to use impersonation.",
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Authenticator/CookieAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ protected function _createCookie(mixed $value): CookieInterface
return Cookie::create(
$name,
$value,
$options
$options,
);
}
}
2 changes: 1 addition & 1 deletion src/Authenticator/EnvironmentAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ protected function _buildLoginUrlErrorResult(ServerRequestInterface $request): R
sprintf(
'Login URL `%s` did not match `%s`.',
$uri,
implode('` or `', (array)$this->getConfig('loginUrl'))
implode('` or `', (array)$this->getConfig('loginUrl')),
),
];

Expand Down
2 changes: 1 addition & 1 deletion src/Authenticator/FormAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected function _buildLoginUrlErrorResult(ServerRequestInterface $request): R
sprintf(
'Login URL `%s` did not match `%s`.',
$uri,
implode('` or `', (array)$this->getConfig('loginUrl'))
implode('` or `', (array)$this->getConfig('loginUrl')),
),
];

Expand Down
2 changes: 1 addition & 1 deletion src/Authenticator/HttpDigestAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function generateResponseHash(array $digest, string $password, string $me
return md5(
$password .
':' . $digest['nonce'] . ':' . $digest['nc'] . ':' . $digest['cnonce'] . ':' . $digest['qop'] . ':' .
md5($method . ':' . $digest['uri'])
md5($method . ':' . $digest['uri']),
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Authenticator/ImpersonationInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function impersonate(
ServerRequestInterface $request,
ResponseInterface $response,
ArrayAccess $impersonator,
ArrayAccess $impersonated
ArrayAccess $impersonated,
): array;

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Authenticator/JwtAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function authenticate(ServerRequestInterface $request): ResultInterface
[
'message' => $e->getMessage(),
'exception' => $e,
]
],
);
}

Expand Down Expand Up @@ -155,7 +155,7 @@ protected function decodeToken(string $token): ?object

return JWT::decode(
$token,
$keySet
$keySet,
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Authenticator/PersistenceInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ interface PersistenceInterface
public function persistIdentity(
ServerRequestInterface $request,
ResponseInterface $response,
ArrayAccess|array $identity
ArrayAccess|array $identity,
): array;

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Authenticator/SessionAuthenticator.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function impersonate(
ServerRequestInterface $request,
ResponseInterface $response,
ArrayAccess $impersonator,
ArrayAccess $impersonated
ArrayAccess $impersonated,
): array {
$sessionKey = $this->getConfig('sessionKey');
$impersonateSessionKey = $this->getConfig('impersonateSessionKey');
Expand All @@ -142,7 +142,7 @@ public function impersonate(
if ($session->check($impersonateSessionKey)) {
throw new UnauthorizedException(
'You are impersonating a user already. ' .
'Stop the current impersonation before impersonating another user.'
'Stop the current impersonation before impersonating another user.',
);
}
$session->write($impersonateSessionKey, $impersonator);
Expand Down
14 changes: 7 additions & 7 deletions src/Controller/Component/AuthenticationComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function getAuthenticationService(): AuthenticationServiceInterface
if ($service === null) {
throw new Exception(
'The request object does not contain the required `authentication` attribute. Verify the ' .
'AuthenticationMiddleware has been added.'
'AuthenticationMiddleware has been added.',
);
}

Expand Down Expand Up @@ -303,7 +303,7 @@ public function setIdentity(ArrayAccess $identity)
$result = $service->persistIdentity(
$controller->getRequest(),
$controller->getResponse(),
$identity
$identity,
);

$controller->setRequest($result['request']);
Expand All @@ -325,7 +325,7 @@ public function logout(): ?string
/** @psalm-var array{request: \Cake\Http\ServerRequest, response: \Cake\Http\Response} $result */
$result = $this->getAuthenticationService()->clearIdentity(
$controller->getRequest(),
$controller->getResponse()
$controller->getResponse(),
);

$controller->setRequest($result['request']);
Expand Down Expand Up @@ -396,7 +396,7 @@ public function impersonate(ArrayAccess $impersonated)
$controller->getRequest(),
$controller->getResponse(),
$impersonator,
$impersonated
$impersonated,
);

if (!$service->isImpersonating($controller->getRequest())) {
Expand Down Expand Up @@ -424,7 +424,7 @@ public function stopImpersonating()
/** @psalm-var array{request: \Cake\Http\ServerRequest, response: \Cake\Http\Response} $result */
$result = $service->stopImpersonating(
$controller->getRequest(),
$controller->getResponse()
$controller->getResponse(),
);

if ($service->isImpersonating($controller->getRequest())) {
Expand Down Expand Up @@ -453,7 +453,7 @@ public function isImpersonating(): bool
$controller = $this->getController();

return $service->isImpersonating(
$controller->getRequest()
$controller->getRequest(),
);
}

Expand All @@ -469,7 +469,7 @@ protected function getImpersonationAuthenticationService(): ImpersonationInterfa
if (!($service instanceof ImpersonationInterface)) {
$className = get_class($service);
throw new InvalidArgumentException(
"The {$className} must implement ImpersonationInterface in order to use impersonation."
"The {$className} must implement ImpersonationInterface in order to use impersonation.",
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Identifier/CallbackIdentifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected function checkCallable(): void
if (!is_callable($callback)) {
throw new InvalidArgumentException(sprintf(
'The `callback` option is not a callable. Got `%s` instead.',
gettype($callback)
gettype($callback),
));
}
}
Expand All @@ -83,7 +83,7 @@ public function identify(array $credentials): ArrayAccess|array|null
throw new RuntimeException(sprintf(
'Invalid return type of `%s`. Expecting `%s` or `null`.',
gettype($result),
ArrayAccess::class
ArrayAccess::class,
));
}
}
2 changes: 1 addition & 1 deletion src/Identifier/Ldap/ExtensionAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ protected function _setErrorHandler(): void
function ($errorNumber, $errorText): void {
throw new ErrorException($errorText);
},
E_ALL
E_ALL,
);
}

Expand Down
8 changes: 4 additions & 4 deletions src/Identifier/LdapIdentifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
if (!is_callable($this->_config['bindDN'])) {
throw new InvalidArgumentException(sprintf(
'The `bindDN` config is not a callable. Got `%s` instead.',
gettype($this->_config['bindDN'])
gettype($this->_config['bindDN']),
));
}
if (!isset($this->_config['host'])) {
Expand All @@ -126,7 +126,7 @@
if (!$class) {
throw new RuntimeException(sprintf(
'Could not find LDAP identfier named `%s`',
$ldap
$ldap,

Check warning on line 129 in src/Identifier/LdapIdentifier.php

View check run for this annotation

Codecov / codecov/patch

src/Identifier/LdapIdentifier.php#L129

Added line #L129 was not covered by tests
));
}
$ldap = new $class();
Expand All @@ -153,7 +153,7 @@
if ($isUsernameSet && $isPasswordSet) {
return $this->_bindUser(
$credentials[$fields[self::CREDENTIAL_USERNAME]],
$credentials[$fields[self::CREDENTIAL_PASSWORD]]
$credentials[$fields[self::CREDENTIAL_PASSWORD]],
);
}

Expand Down Expand Up @@ -182,7 +182,7 @@
$this->_ldap->connect(
$config['host'],
$config['port'],
(array)$this->getConfig('options')
(array)$this->getConfig('options'),
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Identifier/TokenIdentifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function identify(array $credentials): ArrayAccess|array|null
if ($this->getConfig('hashAlgorithm') !== null) {
$credentials[$dataField] = Security::hash(
$credentials[$dataField],
$this->getConfig('hashAlgorithm')
$this->getConfig('hashAlgorithm'),
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Middleware/AuthenticationMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class AuthenticationMiddleware implements MiddlewareInterface
*/
public function __construct(
AuthenticationServiceInterface|AuthenticationServiceProviderInterface $subject,
?ContainerInterface $container = null
?ContainerInterface $container = null,
) {
$this->subject = $subject;
$this->container = $container;
Expand Down
2 changes: 1 addition & 1 deletion src/PasswordHasher/DefaultPasswordHasher.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function hash(string $password): string
return password_hash(
$password,
$this->_config['hashType'],
$this->_config['hashOptions']
$this->_config['hashOptions'],
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/UrlChecker/UrlCheckerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected function _checkUrl(ServerRequestInterface $request): bool
return $this->_getUrlChecker()->check(
$request,
$this->getConfig('loginUrl'),
(array)$this->getConfig('urlChecker')
(array)$this->getConfig('urlChecker'),
);
}

Expand Down Expand Up @@ -68,7 +68,7 @@ protected function _getUrlChecker(): UrlCheckerInterface
throw new RuntimeException(sprintf(
'The provided URL checker class `%s` does not implement the `%s` interface.',
$options['className'],
UrlCheckerInterface::class
UrlCheckerInterface::class,
));
}

Expand Down
2 changes: 1 addition & 1 deletion src/View/Helper/IdentityHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

if (!$this->_identity instanceof IdentityInterface) {
throw new RuntimeException(
sprintf('Identity found in request does not implement %s', IdentityInterface::class)
sprintf('Identity found in request does not implement %s', IdentityInterface::class),

Check warning on line 66 in src/View/Helper/IdentityHelper.php

View check run for this annotation

Codecov / codecov/patch

src/View/Helper/IdentityHelper.php#L66

Added line #L66 was not covered by tests
);
}
}
Expand Down
Loading