feat(upgrade): add compliance with symfony 6.2
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
b11cea13b3
commit
e59bed36db
|
@ -63,7 +63,7 @@
|
||||||
"extra": {
|
"extra": {
|
||||||
"symfony": {
|
"symfony": {
|
||||||
"allow-contrib": false,
|
"allow-contrib": false,
|
||||||
"require": "6.0.*"
|
"require": "6.2.*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
# See the configuration reference at https://github.com/scheb/2fa/blob/master/doc/configuration.md
|
# See the configuration reference at https://github.com/scheb/2fa/blob/master/doc/configuration.md
|
||||||
scheb_two_factor:
|
scheb_two_factor:
|
||||||
google:
|
totp:
|
||||||
enabled: true
|
enabled: true
|
||||||
issuer: "Murph"
|
issuer: "Murph"
|
||||||
server_name:
|
server_name:
|
||||||
digits: 6
|
|
||||||
window: 1
|
window: 1
|
||||||
template: "@Core/auth/2fa.html.twig"
|
template: "@Core/auth/2fa.html.twig"
|
||||||
security_tokens:
|
security_tokens:
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
security:
|
security:
|
||||||
encoders:
|
|
||||||
App\Entity\User:
|
|
||||||
algorithm: auto
|
|
||||||
|
|
||||||
# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
|
# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
|
||||||
enable_authenticator_manager: true
|
enable_authenticator_manager: true
|
||||||
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
|
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
|
||||||
|
@ -28,8 +24,7 @@ security:
|
||||||
two_factor:
|
two_factor:
|
||||||
auth_form_path: 2fa_login # The route name you have used in the routes.yaml
|
auth_form_path: 2fa_login # The route name you have used in the routes.yaml
|
||||||
check_path: 2fa_login_check # The route name you have used in the routes.yaml
|
check_path: 2fa_login_check # The route name you have used in the routes.yaml
|
||||||
guard:
|
custom_authenticators:
|
||||||
authenticators:
|
|
||||||
- App\Core\Authenticator\LoginFormAuthenticator
|
- App\Core\Authenticator\LoginFormAuthenticator
|
||||||
form_login:
|
form_login:
|
||||||
login_path: auth_login
|
login_path: auth_login
|
||||||
|
|
|
@ -6,9 +6,11 @@ use App\Core\Doctrine\Timestampable;
|
||||||
use App\Core\Entity\EntityInterface;
|
use App\Core\Entity\EntityInterface;
|
||||||
use App\Repository\UserRepository;
|
use App\Repository\UserRepository;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Scheb\TwoFactorBundle\Model\Google\TwoFactorInterface;
|
|
||||||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||||
use Symfony\Component\Security\Core\User\UserInterface;
|
use Symfony\Component\Security\Core\User\UserInterface;
|
||||||
|
use Scheb\TwoFactorBundle\Model\Totp\TwoFactorInterface;
|
||||||
|
use Scheb\TwoFactorBundle\Model\Totp\TotpConfiguration;
|
||||||
|
use Scheb\TwoFactorBundle\Model\Totp\TotpConfigurationInterface;
|
||||||
|
|
||||||
#[ORM\Entity(repositoryClass: UserRepository::class)]
|
#[ORM\Entity(repositoryClass: UserRepository::class)]
|
||||||
#[ORM\HasLifecycleCallbacks]
|
#[ORM\HasLifecycleCallbacks]
|
||||||
|
@ -160,24 +162,30 @@ class User implements PasswordAuthenticatedUserInterface, UserInterface, TwoFact
|
||||||
return null !== $this->getTotpSecret();
|
return null !== $this->getTotpSecret();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isGoogleAuthenticatorEnabled(): bool
|
public function getTotpAuthenticationUsername(): string
|
||||||
{
|
|
||||||
return $this->isTotpAuthenticationEnabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getGoogleAuthenticatorUsername(): string
|
|
||||||
{
|
{
|
||||||
return $this->getEmail();
|
return $this->getEmail();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGoogleAuthenticatorSecret(): ?string
|
public function getTotpAuthenticationSecret(): ?string
|
||||||
{
|
{
|
||||||
return $this->getTotpSecret();
|
return $this->getTotpSecret();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setGoogleAuthenticatorSecret(?string $googleAuthenticatorSecret): void
|
public function setTotpAuthenticationSecret(?string $totpAuthenticatorSecret): void
|
||||||
{
|
{
|
||||||
$this->setTotpSecret($googleAuthenticatorSecret);
|
$this->setTotpSecret($totpAuthenticatorSecret);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTotpAuthenticationConfiguration(): ?TotpConfigurationInterface
|
||||||
|
{
|
||||||
|
// You could persist the other configuration options in the user entity to make it individual per user.
|
||||||
|
return new TotpConfiguration(
|
||||||
|
$this->getTotpAuthenticationSecret(),
|
||||||
|
TotpConfiguration::ALGORITHM_SHA1,
|
||||||
|
20,
|
||||||
|
6
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPasswordRequestedAt(): ?\DateTimeInterface
|
public function getPasswordRequestedAt(): ?\DateTimeInterface
|
||||||
|
|
Loading…
Reference in a new issue