Compare commits

...

4 commits
master ... v2

Author SHA1 Message Date
Simon Vieille e59bed36db
feat(upgrade): add compliance with symfony 6.2
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-01-25 22:29:57 +01:00
Simon Vieille b11cea13b3 Merge branch 'develop' into v2
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2023-01-25 20:56:05 +01:00
Simon Vieille 33ac16fac2 update symfony to v6.0 2022-03-25 15:25:44 +01:00
Simon Vieille 64d4a326ec update symfony to v6.0 2022-03-25 15:22:27 +01:00
4 changed files with 29 additions and 27 deletions

View file

@ -7,17 +7,17 @@
"prefer-stable": true,
"require": {
"php": ">=8.0.0",
"murph/murph-core": "^1.18"
"murph/murph-core": "v2.x-dev"
},
"require-dev": {
"symfony/browser-kit": "^5.4",
"symfony/css-selector": "^5.4",
"symfony/debug-bundle": "^5.4",
"symfony/browser-kit": "^6.0.0",
"symfony/css-selector": "^6.0.0",
"symfony/debug-bundle": "^6.0.0",
"symfony/maker-bundle": "^1.0",
"symfony/phpunit-bridge": "^6.2",
"symfony/stopwatch": "^5.4",
"symfony/var-dumper": "^5.4",
"symfony/web-profiler-bundle": "^5.4"
"symfony/phpunit-bridge": "^6.2.0",
"symfony/stopwatch": "^6.2.0",
"symfony/var-dumper": "^6.2.0",
"symfony/web-profiler-bundle": "^6.2.0"
},
"config": {
"optimize-autoloader": true,
@ -63,7 +63,7 @@
"extra": {
"symfony": {
"allow-contrib": false,
"require": "5.4.*"
"require": "6.2.*"
}
}
}

View file

@ -1,10 +1,9 @@
# See the configuration reference at https://github.com/scheb/2fa/blob/master/doc/configuration.md
scheb_two_factor:
google:
totp:
enabled: true
issuer: "Murph"
server_name:
digits: 6
window: 1
template: "@Core/auth/2fa.html.twig"
security_tokens:

View file

@ -1,8 +1,4 @@
security:
encoders:
App\Entity\User:
algorithm: auto
# https://symfony.com/doc/current/security.html#where-do-users-come-from-user-providers
enable_authenticator_manager: true
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
@ -28,8 +24,7 @@ security:
two_factor:
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
guard:
authenticators:
custom_authenticators:
- App\Core\Authenticator\LoginFormAuthenticator
form_login:
login_path: auth_login

View file

@ -6,9 +6,11 @@ use App\Core\Doctrine\Timestampable;
use App\Core\Entity\EntityInterface;
use App\Repository\UserRepository;
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\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\HasLifecycleCallbacks]
@ -160,24 +162,30 @@ class User implements PasswordAuthenticatedUserInterface, UserInterface, TwoFact
return null !== $this->getTotpSecret();
}
public function isGoogleAuthenticatorEnabled(): bool
{
return $this->isTotpAuthenticationEnabled();
}
public function getGoogleAuthenticatorUsername(): string
public function getTotpAuthenticationUsername(): string
{
return $this->getEmail();
}
public function getGoogleAuthenticatorSecret(): ?string
public function getTotpAuthenticationSecret(): ?string
{
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