fix code quality, typage, php-csfixer
This commit is contained in:
@ -30,7 +30,7 @@ class PasswordEncoder implements LegacyPasswordHasherInterface
|
||||
/**
|
||||
* Pas utilisé, mais on doit le garder pour le implements
|
||||
*/
|
||||
public function hash(string $plainPassword, string $salt = null): string
|
||||
public function hash(string $plainPassword, ?string $salt = null): string
|
||||
{
|
||||
if ($this->isPasswordTooLong($plainPassword)) {
|
||||
throw new InvalidPasswordException();
|
||||
@ -39,7 +39,7 @@ class PasswordEncoder implements LegacyPasswordHasherInterface
|
||||
return hash($plainPassword.$salt, $this->hashAlgoLegacy[0]);
|
||||
}
|
||||
|
||||
public function verify(string $hashedPassword, string $plainPassword, string $salt = null): bool
|
||||
public function verify(string $hashedPassword, string $plainPassword, ?string $salt = null): bool
|
||||
{
|
||||
if ('' === $plainPassword || $this->isPasswordTooLong($plainPassword)) {
|
||||
return false;
|
||||
@ -76,10 +76,8 @@ class PasswordEncoder implements LegacyPasswordHasherInterface
|
||||
|
||||
/**
|
||||
* Retourne la string à hasher en fonction du pattern indiqué
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getPasswordToHash($plainTextPassword, $salt)
|
||||
protected function getPasswordToHash(string $plainTextPassword, ?string $salt = null): string
|
||||
{
|
||||
$arrayRef = [
|
||||
self::PASSWORD_PATTERN => $plainTextPassword,
|
||||
@ -101,7 +99,7 @@ class PasswordEncoder implements LegacyPasswordHasherInterface
|
||||
return $completedPlainPassword;
|
||||
}
|
||||
|
||||
protected function compareSsha($hashPassword, $plainPassword)
|
||||
protected function compareSsha(string $hashPassword, string $plainPassword): bool
|
||||
{
|
||||
$base_64_hash_with_salt = substr($hashPassword, 6);
|
||||
$hash_with_salt = base64_decode($base_64_hash_with_salt);
|
||||
|
@ -31,7 +31,7 @@ class SQLLoginUserAuthenticator extends AbstractLoginFormAuthenticator
|
||||
public const ERROR_DATA_TO_FETCH_CONFIGURATION = 'error_data_to_fetch_configuration';
|
||||
public const ERROR_SECURITY_PATTERN_CONFIGURATION = 'error_security_pattern_configuration';
|
||||
|
||||
protected string $baseUrl;
|
||||
private string $baseUrl;
|
||||
private SQLLoginService $sqlLoginService;
|
||||
private PasswordEncoder $passwordHasher;
|
||||
|
||||
@ -54,14 +54,14 @@ class SQLLoginUserAuthenticator extends AbstractLoginFormAuthenticator
|
||||
|
||||
public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey): RedirectResponse
|
||||
{
|
||||
return new RedirectResponse($this->baseUrl . '/connect/login-accept');
|
||||
return new RedirectResponse($this->baseUrl.'/connect/login-accept');
|
||||
}
|
||||
|
||||
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): RedirectResponse
|
||||
{
|
||||
$request->getSession()->set(Security::AUTHENTICATION_ERROR, $exception);
|
||||
|
||||
return new RedirectResponse($this->baseUrl . '/login');
|
||||
return new RedirectResponse($this->baseUrl.'/login');
|
||||
}
|
||||
|
||||
public function authenticate(Request $request): SelfValidatingPassport
|
||||
@ -86,7 +86,7 @@ class SQLLoginUserAuthenticator extends AbstractLoginFormAuthenticator
|
||||
}
|
||||
|
||||
if (null === $remoteHashedPassword) {
|
||||
$remoteHashedPassword = "";
|
||||
$remoteHashedPassword = '';
|
||||
}
|
||||
|
||||
try {
|
||||
@ -122,6 +122,6 @@ class SQLLoginUserAuthenticator extends AbstractLoginFormAuthenticator
|
||||
|
||||
protected function getLoginUrl(Request $request): string
|
||||
{
|
||||
return $this->baseUrl . '/login';
|
||||
return $this->baseUrl.'/login';
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ class SQLLoginUserProvider implements UserProviderInterface
|
||||
return $this->loadUserByIdentifier($username, null);
|
||||
}
|
||||
|
||||
public function refreshUser(UserInterface $user)
|
||||
public function refreshUser(UserInterface $user): UserInterface|null
|
||||
{
|
||||
if (!$user instanceof User) {
|
||||
throw new UnsupportedUserException(sprintf('Invalid user class "%s".', get_class($user)));
|
||||
@ -40,7 +40,7 @@ class SQLLoginUserProvider implements UserProviderInterface
|
||||
return $this->loadUserByIdentifier($user->getUserIdentifier(), $user);
|
||||
}
|
||||
|
||||
public function supportsClass(string $class)
|
||||
public function supportsClass(string $class): bool
|
||||
{
|
||||
return User::class === $class || is_subclass_of($class, User::class);
|
||||
}
|
||||
|
Reference in New Issue
Block a user