1000 search results

27 lines | src/Security/ApiTokenHandler.php
// ... lines 1 - 4
use App\Repository\ApiTokenRepository;
// ... lines 6 - 9
class ApiTokenHandler implements AccessTokenHandlerInterface
{
public function __construct(private ApiTokenRepository $apiTokenRepository)
{
}
// ... lines 15 - 25
}
See Code Block in Script
27 lines | src/Security/ApiTokenHandler.php
// ... lines 1 - 9
class ApiTokenHandler implements AccessTokenHandlerInterface
{
// ... lines 12 - 15
public function getUserBadgeFrom(#[\SensitiveParameter] string $accessToken): UserBadge
{
$token = $this->apiTokenRepository->findOneBy(['token' => $accessToken]);
// ... lines 19 - 24
}
}
See Code Block in Script
27 lines | src/Security/ApiTokenHandler.php
// ... lines 1 - 5
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
// ... lines 7 - 9
class ApiTokenHandler implements AccessTokenHandlerInterface
{
// ... lines 12 - 15
public function getUserBadgeFrom(#[\SensitiveParameter] string $accessToken): UserBadge
{
$token = $this->apiTokenRepository->findOneBy(['token' => $accessToken]);
if (!$token) {
throw new BadCredentialsException();
}
// ... lines 23 - 24
}
}
See Code Block in Script
27 lines | src/Security/ApiTokenHandler.php
// ... lines 1 - 7
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
class ApiTokenHandler implements AccessTokenHandlerInterface
{
// ... lines 12 - 15
public function getUserBadgeFrom(#[\SensitiveParameter] string $accessToken): UserBadge
{
// ... lines 18 - 23
return new UserBadge($token->getOwnedBy()->getUserIdentifier());
}
}
See Code Block in Script
32 lines | src/Security/ApiTokenHandler.php
// ... lines 1 - 6
use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
// ... lines 8 - 10
class ApiTokenHandler implements AccessTokenHandlerInterface
{
// ... lines 13 - 16
public function getUserBadgeFrom(#[\SensitiveParameter] string $accessToken): UserBadge
{
// ... lines 19 - 24
if (!$token->isValid()) {
throw new CustomUserMessageAuthenticationException('Token expired');
}
return new UserBadge($token->getOwnedBy()->getUserIdentifier());
}
}
See Code Block in Script
34 lines | src/Security/ApiTokenHandler.php
// ... lines 1 - 10
class ApiTokenHandler implements AccessTokenHandlerInterface
{
// ... lines 13 - 16
public function getUserBadgeFrom(#[\SensitiveParameter] string $accessToken): UserBadge
{
// ... lines 19 - 28
$token->getOwnedBy()->markAsTokenAuthenticated($token->getScopes());
return new UserBadge($token->getOwnedBy()->getUserIdentifier());
}
}
See Code Block in Script
// ... lines 1 - 2
namespace App\Security;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
class AccountNotVerifiedAuthenticationException extends AuthenticationException
{
}
See Code Block in Script
83 lines | src/Security/LoginFormAuthenticator.php
// ... lines 1 - 15
use Symfony\Component\Security\Http\Authenticator\AbstractLoginFormAuthenticator;
// ... lines 17 - 26
class LoginFormAuthenticator extends AbstractLoginFormAuthenticator
{
// ... lines 29 - 81
}
See Code Block in Script
39 lines | templates/security/login.html.twig
{% extends nglayouts.layoutTemplate %}
// ... lines 2 - 39
See Code Block in Script
86 lines | src/Security/LoginFormAuthenticator.php
// ... lines 1 - 21
class LoginFormAuthenticator extends AbstractLoginFormAuthenticator
{
// ... lines 24 - 27
public function __construct(private EntityManagerInterface $entityManager, private UrlGeneratorInterface $urlGenerator)
{
}
// ... lines 31 - 84
}
See Code Block in Script
86 lines | src/Security/LoginFormAuthenticator.php
// ... lines 1 - 60
public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): Response
{
if ($targetPath = $this->getTargetPath($request->getSession(), $firewallName)) {
// ... line 64
}
// ... lines 66 - 67
}
// ... lines 69 - 86
See Code Block in Script
109 lines | src/Security/LoginFormAuthenticator.php
// ... lines 1 - 20
use Symfony\Component\Security\Http\Authenticator\AbstractLoginFormAuthenticator;
// ... lines 22 - 23
class LoginFormAuthenticator extends AbstractLoginFormAuthenticator
{
// ... lines 26 - 107
}
See Code Block in Script
115 lines | src/Security/LoginFormAuthenticator.php
// ... lines 1 - 24
class LoginFormAuthenticator extends AbstractLoginFormAuthenticator
{
// ... lines 27 - 40
public function authenticate(Request $request)
{
// TODO: Implement authenticate() method.
}
// ... lines 45 - 113
}
See Code Block in Script
116 lines | src/Security/LoginFormAuthenticator.php
// ... lines 1 - 25
class LoginFormAuthenticator extends AbstractLoginFormAuthenticator
{
// ... lines 28 - 35
public function supports(Request $request): bool
{
// ... lines 38 - 39
}
// ... lines 41 - 114
}
See Code Block in Script
116 lines | src/Security/LoginFormAuthenticator.php
// ... lines 1 - 25
class LoginFormAuthenticator extends AbstractLoginFormAuthenticator
{
// ... lines 28 - 90
public function onAuthenticationSuccess(Request $request, TokenInterface $token, string $firewallName): Response
{
// ... lines 93 - 97
}
// ... lines 99 - 114
}
See Code Block in Script
116 lines | src/Security/LoginFormAuthenticator.php
// ... lines 1 - 25
class LoginFormAuthenticator extends AbstractLoginFormAuthenticator
{
// ... lines 28 - 99
public function onAuthenticationFailure(Request $request, AuthenticationException $exception): Response
{
// ... lines 102 - 108
}
// ... lines 110 - 114
}
See Code Block in Script
116 lines | src/Security/LoginFormAuthenticator.php
// ... lines 1 - 25
class LoginFormAuthenticator extends AbstractLoginFormAuthenticator
{
// ... lines 28 - 110
protected function getLoginUrl(Request $request): string
{
return $this->urlGenerator->generate(self::LOGIN_ROUTE);
}
}
See Code Block in Script
116 lines | src/Security/LoginFormAuthenticator.php
// ... lines 1 - 25
class LoginFormAuthenticator extends AbstractLoginFormAuthenticator
{
// ... lines 28 - 35
public function supports(Request $request): bool
{
return self::LOGIN_ROUTE === $request->attributes->get('_route')
&& $request->isMethod('POST');
}
// ... lines 41 - 114
}
See Code Block in Script
47 lines | src/Security/Voter/QuestionVoter.php
// ... lines 1 - 11
class QuestionVoter extends Voter
{
// ... lines 14 - 24
protected function voteOnAttribute(string $attribute, $subject, TokenInterface $token): bool
{
// ... lines 27 - 40
return match ($attribute) {
'EDIT' => $user === $subject->getOwner(),
default => false,
};
}
}
See Code Block in Script
121 lines | src/Security/LoginFormAuthenticator.php
// ... lines 1 - 11
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
// ... lines 13 - 24
class LoginFormAuthenticator extends AbstractFormLoginAuthenticator implements PasswordAuthenticatedInterface
{
// ... lines 27 - 36
public function __construct(SessionInterface $session, EntityManagerInterface $entityManager, UrlGeneratorInterface $urlGenerator, CsrfTokenManagerInterface $csrfTokenManager, \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface $passwordEncoder)
{
// ... lines 39 - 43
}
// ... lines 45 - 119
}
See Code Block in Script