prefix stringlengths 512 512 | suffix stringlengths 256 256 | middle stringlengths 14 229 | meta dict |
|---|---|---|---|
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\AccessToken\OAuth2;
use PHPUnit\Framework\TestCase;
use Sy... | {
$accessToken = 'a-secret-token';
$claims = [
'active' => true,
'client_id' => 'l238j323ds-23ij4',
'username' => 'jdoe',
'scope' => 'read write dolphin',
'sub' => 'Z5O3upPC88Q | ssToken\OAuth2\Oauth2TokenHandler;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
class OAuth2TokenHandlerTest extends TestCase
{
public function testGetsUserIdentifierFromOAuth2ServerResponse()
| {
"filepath": "src/Symfony/Component/Security/Http/Tests/AccessToken/OAuth2/OAuth2TokenHandlerTest.php",
"language": "php",
"file_size": 1971,
"cut_index": 537,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\EventListener;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactory;
use Symfony\Component\PasswordHasher\PasswordHasherInterface;
use Symfony\Co... | rt\Credentials\PasswordCredentials;
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
use Symfony\Component\Security\Http\Event\CheckPassportEvent;
use Sy | Badge;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\CustomCredentials;
use Symfony\Component\Security\Http\Authenticator\Passpo | {
"filepath": "src/Symfony/Component/Security/Http/Tests/EventListener/CheckCredentialsListenerTest.php",
"language": "php",
"file_size": 7103,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\EventListener;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Authentication... | ent\LoginSuccessEvent;
use Symfony\Component\Security\Http\EventListener\CheckRememberMeConditionsListener;
use Symfony\Component\Security\Http\Tests\Fixtures\DummyAuthenticator;
class CheckRememberMeConditionsListenerTest extends TestCase
{
private C | uthenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
use Symfony\Component\Security\Http\Ev | {
"filepath": "src/Symfony/Component/Security/Http/Tests/EventListener/CheckRememberMeConditionsListenerTest.php",
"language": "php",
"file_size": 5369,
"cut_index": 716,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\EventListener;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Security\Core\Exception\InvalidCsrfTokenException;
use Symfony\Com... | Http\Event\CheckPassportEvent;
use Symfony\Component\Security\Http\EventListener\CsrfProtectionListener;
use Symfony\Component\Security\Http\Tests\Fixtures\DummyAuthenticator;
class CsrfProtectionListenerTest extends TestCase
{
public function testNoC | ticator\Passport\Badge\CsrfTokenBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
use Symfony\Component\Security\ | {
"filepath": "src/Symfony/Component/Security/Http/Tests/EventListener/CsrfProtectionListenerTest.php",
"language": "php",
"file_size": 3238,
"cut_index": 614,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\EventListener;
use PHPUnit\Framework\TestCase... | t extends TestCase
{
public function testSkipsClearingSessionTokenStorageOnStatelessRequest()
{
try {
(new CsrfTokenClearingLogoutListener(
new SessionTokenStorage(new RequestStack())
))->onLogout(new | t\Security\Csrf\TokenStorage\SessionTokenStorage;
use Symfony\Component\Security\Http\Event\LogoutEvent;
use Symfony\Component\Security\Http\EventListener\CsrfTokenClearingLogoutListener;
class CsrfTokenClearingLogoutListenerTes | {
"filepath": "src/Symfony/Component/Security/Http/Tests/EventListener/CsrfTokenClearingLogoutListenerTest.php",
"language": "php",
"file_size": 1260,
"cut_index": 524,
"middle_length": 229
} |
amework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Event\ControllerArgumentsEvent;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
... | tedAttributeListener;
use Symfony\Component\Security\Http\Tests\Fixtures\IsGrantedAttributeMethodsWithClosureController;
use Symfony\Component\Security\Http\Tests\Fixtures\IsGrantedAttributeWithClosureController;
#[RequiresPhp('>=8.5.0')]
class IsGrantedA | on\AuthorizationCheckerInterface;
use Symfony\Component\Security\Core\Authorization\Voter\ClosureVoter;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Http\EventListener\IsGran | {
"filepath": "src/Symfony/Component/Security/Http/Tests/EventListener/IsGrantedAttributeWithClosureListenerTest.php",
"language": "php",
"file_size": 14492,
"cut_index": 921,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\EventListener;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Reques... | \Security\Http\Authenticator\Passport\SelfValidatingPassport;
use Symfony\Component\Security\Http\Event\LoginSuccessEvent;
use Symfony\Component\Security\Http\EventListener\RememberMeListener;
use Symfony\Component\Security\Http\RememberMe\RememberMeHandle | nt\Security\Http\Authenticator\Passport\Badge\RememberMeBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
use Symfony\Component | {
"filepath": "src/Symfony/Component/Security/Http/Tests/EventListener/RememberMeListenerTest.php",
"language": "php",
"file_size": 3234,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\EventListener;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactory;
use Symfony\Component\Password... | Interface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\PasswordUpgradeBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Compon | onent\Security\Core\User\InMemoryUser;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
use Symfony\Component\Security\Core\User\User | {
"filepath": "src/Symfony/Component/Security/Http/Tests/EventListener/PasswordMigratingListenerTest.php",
"language": "php",
"file_size": 6577,
"cut_index": 716,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\EventListener;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\Te... | t\SelfValidatingPassport;
use Symfony\Component\Security\Http\Authenticator\Token\PostAuthenticationToken;
use Symfony\Component\Security\Http\Event\CheckPassportEvent;
use Symfony\Component\Security\Http\EventListener\UserCheckerListener;
use Symfony\Comp | ce;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\PreAuthenticatedUserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passpor | {
"filepath": "src/Symfony/Component/Security/Http/Tests/EventListener/UserCheckerListenerTest.php",
"language": "php",
"file_size": 2955,
"cut_index": 563,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\Authenticator;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\... | nent\Security\Http\Authenticator\Passport\Passport;
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
use Symfony\Component\Security\Http\Authenticator\Token\PostAuthenticationToken;
class AbstractAuthenticatorTest extends | eption;
use Symfony\Component\Security\Core\User\InMemoryUser;
use Symfony\Component\Security\Http\Authenticator\AbstractAuthenticator;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Compo | {
"filepath": "src/Symfony/Component/Security/Http/Tests/Authenticator/AbstractAuthenticatorTest.php",
"language": "php",
"file_size": 2157,
"cut_index": 563,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\Controller;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\A... | ntication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\User\InMemoryUser;
use Symfony\Component\Security\Http\Controller\SecurityTokenValueResolver;
class SecurityTokenValueResolverTest extends TestCase
{
public function testResolv | HttpKernel\Exception\HttpException;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authe | {
"filepath": "src/Symfony/Component/Security/Http/Tests/Controller/SecurityTokenValueResolverTest.php",
"language": "php",
"file_size": 4421,
"cut_index": 614,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Event;
use Symfony\Component\HttpFoundation\Request... | ruct(
private parent $event,
) {
}
public function setResponse(Response $response): never
{
$this->stopPropagation();
$this->event->stopPropagation();
throw new LazyResponseException($response);
}
| Exception\LazyResponseException;
/**
* Wraps a lazily computed response in a signaling exception.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
final class LazyResponseEvent extends RequestEvent
{
public function __const | {
"filepath": "src/Symfony/Component/Security/Http/Event/LazyResponseEvent.php",
"language": "php",
"file_size": 1415,
"cut_index": 524,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Event;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\... | *
* Listeners to this event can change state based on authentication
* failure (e.g. to implement login throttling).
*
* @author Wouter de Jong <wouter@wouterj.nl>
*/
class LoginFailureEvent extends Event
{
public function __construct(
pri | uthenticator\Debug\TraceableAuthenticator;
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
use Symfony\Contracts\EventDispatcher\Event;
/**
* This event is dispatched after an error during authentication.
| {
"filepath": "src/Symfony/Component/Security/Http/Event/LoginFailureEvent.php",
"language": "php",
"file_size": 2102,
"cut_index": 563,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Event;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\... | vent is dispatched after authentication has successfully completed.
*
* At this stage, the authenticator created a token and
* generated an authentication success response. Listeners to
* this event can do actions related to successful authentication
| henticatorInterface;
use Symfony\Component\Security\Http\Authenticator\Debug\TraceableAuthenticator;
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
use Symfony\Contracts\EventDispatcher\Event;
/**
* This e | {
"filepath": "src/Symfony/Component/Security/Http/Event/LoginSuccessEvent.php",
"language": "php",
"file_size": 2537,
"cut_index": 563,
"middle_length": 229
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Event;
use Symfony\Component\HttpFoundation\R... | }
public function getRequest(): Request
{
return $this->request;
}
public function getToken(): ?TokenInterface
{
return $this->token;
}
public function setResponse(Response $response): void
{
$thi | ter de Jong <wouter@wouterj.nl>
*/
class LogoutEvent extends Event
{
private ?Response $response = null;
public function __construct(
private Request $request,
private ?TokenInterface $token,
) {
| {
"filepath": "src/Symfony/Component/Security/Http/Event/LogoutEvent.php",
"language": "php",
"file_size": 1126,
"cut_index": 518,
"middle_length": 229
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Event;
use Symfony\Component\HttpFoundation\R... | private ?TokenInterface $token = null,
) {
}
public function getRequest(): Request
{
return $this->request;
}
public function getTargetUser(): UserInterface
{
return $this->targetUser;
}
public fun | itchUserEvent.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
final class SwitchUserEvent extends Event
{
public function __construct(
private Request $request,
private UserInterface $targetUser,
| {
"filepath": "src/Symfony/Component/Security/Http/Event/SwitchUserEvent.php",
"language": "php",
"file_size": 1182,
"cut_index": 518,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Event;
use Symfony\Component\HttpFoundation\Request... | u want to trigger some actions whenever a user is
* deauthenticated and redirected back to the authentication entry point
* (e.g. clearing all remember-me cookies).
*
* @author Wouter de Jong <wouter@wouterj.nl>
*/
final class TokenDeauthenticatedEven | thenticated
* when trying to reference the token.
*
* This includes changes in the user ({@see DeauthenticatedEvent}), but
* also cases where there is no user provider available to refresh the user.
*
* Use this event if yo | {
"filepath": "src/Symfony/Component/Security/Http/Event/TokenDeauthenticatedEvent.php",
"language": "php",
"file_size": 1348,
"cut_index": 524,
"middle_length": 229
} |
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Authorization;
use Symfony\Component\HttpFoundatio... | uthor Johannes M. Schmitt <schmittjoh@gmail.com>
*/
interface AccessDeniedHandlerInterface
{
/**
* Handles an access denied failure.
*/
public function handle(Request $request, AccessDeniedException $accessDeniedException): ?Response;
}
| essDeniedException
* to a Response object.
*
* @a | {
"filepath": "src/Symfony/Component/Security/Http/Authorization/AccessDeniedHandlerInterface.php",
"language": "php",
"file_size": 831,
"cut_index": 523,
"middle_length": 52
} |
hp
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Authenticator;
use Symfony\Component\Secur... | to create a PostAuthenticationToken for you, if you don't really
* care about which authenticated token you're using.
*/
public function createToken(Passport $passport, string $firewallName): TokenInterface
{
return new PostAuthen | en;
/**
* An optional base class that creates the necessary tokens for you.
*
* @author Ryan Weaver <ryan@symfonycasts.com>
*/
abstract class AbstractAuthenticator implements AuthenticatorInterface
{
/**
* Shortcut | {
"filepath": "src/Symfony/Component/Security/Http/Authenticator/AbstractAuthenticator.php",
"language": "php",
"file_size": 1094,
"cut_index": 515,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Authenticator;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Componen... | AbstractLoginFormAuthenticator extends AbstractAuthenticator implements AuthenticationEntryPointInterface, InteractiveAuthenticatorInterface
{
/**
* Return the URL to the login page.
*
* The default `supports()` implementation below comp | uthenticationEntryPointInterface;
use Symfony\Component\Security\Http\SecurityRequestAttributes;
/**
* A base class to make form login authentication easier!
*
* @author Ryan Weaver <ryan@symfonycasts.com>
*/
abstract class | {
"filepath": "src/Symfony/Component/Security/Http/Authenticator/AbstractLoginFormAuthenticator.php",
"language": "php",
"file_size": 2906,
"cut_index": 563,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Authenticator;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use ... | serProviderInterface;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\PreAuthenticatedUserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Passpor | ty\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
use Symfony\Component\Security\Core\User\U | {
"filepath": "src/Symfony/Component/Security/Http/Authenticator/AbstractPreAuthenticatedAuthenticator.php",
"language": "php",
"file_size": 4671,
"cut_index": 614,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Authenticator;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Co... | nt\Security\Http\Authentication\AuthenticationFailureHandlerInterface;
use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
use Symfony\Component\Secu | y\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Http\AccessToken\AccessTokenExtractorInterface;
use Symfony\Component\Security\Http\AccessToken\AccessTokenHandlerInterface;
use Symfony\Compone | {
"filepath": "src/Symfony/Component/Security/Http/Authenticator/AccessTokenAuthenticator.php",
"language": "php",
"file_size": 4781,
"cut_index": 614,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Authenticator;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Co... | /**
* Does the authenticator support the given Request?
*
* If this returns true, authenticate() will be called. If false, the authenticator will be skipped.
*
* Returning null means authenticate() can be called lazily when acce | interface for all authenticators.
*
* @author Ryan Weaver <ryan@symfonycasts.com>
* @author Amaury Leroux de Lens <amaury@lerouxdelens.com>
* @author Wouter de Jong <wouter@wouterj.nl>
*/
interface AuthenticatorInterface
{
| {
"filepath": "src/Symfony/Component/Security/Http/Authenticator/AuthenticatorInterface.php",
"language": "php",
"file_size": 3322,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Security\Http\Authenticator;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\C... | fony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface;
use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\CsrfTokenBadge;
us | ticationException;
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Sym | {
"filepath": "src/Symfony/Component/Security/Http/Authenticator/FormLoginAuthenticator.php",
"language": "php",
"file_size": 7636,
"cut_index": 716,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\AccessToken\Oidc;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Symfo... | tCase
{
#[DataProvider('getClaims')]
public function testGetsUserIdentifierFromOidcServerResponse(string $claim, string $expected)
{
$accessToken = 'a-secret-token';
$claims = [
'sub' => 'e21bf182-1538-406e-8ccb-e25a | use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Contracts\HttpClient\HttpClientInterface;
use Symfony\Contracts\HttpClient\ResponseInterface;
class OidcUserInfoTokenHandlerTest extends Tes | {
"filepath": "src/Symfony/Component/Security/Http/Tests/AccessToken/Oidc/OidcUserInfoTokenHandlerTest.php",
"language": "php",
"file_size": 3388,
"cut_index": 614,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\Authenticator;
use Symfony\Component\Security... | serBadge
{
if (!\array_key_exists($accessToken, $this->accessTokens)) {
throw new BadCredentialsException('Invalid access token or invalid user.');
}
return $this->accessTokens[$accessToken];
}
public funct | ;
class InMemoryAccessTokenHandler implements AccessTokenHandlerInterface
{
/**
* @var array<string, UserBadge>
*/
private array $accessTokens = [];
public function getUserBadgeFrom(string $accessToken): U | {
"filepath": "src/Symfony/Component/Security/Http/Tests/Authenticator/InMemoryAccessTokenHandler.php",
"language": "php",
"file_size": 1289,
"cut_index": 524,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\Authenticator;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\Securit... | Symfony\Component\Security\Http\HttpUtils;
use Symfony\Component\Translation\Loader\ArrayLoader;
use Symfony\Component\Translation\Translator;
class JsonLoginAuthenticatorTest extends TestCase
{
private InMemoryUserProvider $userProvider;
private | onent\Security\Http\Authenticator\JsonLoginAuthenticator;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials;
use | {
"filepath": "src/Symfony/Component/Security/Http/Tests/Authenticator/JsonLoginAuthenticatorTest.php",
"language": "php",
"file_size": 7520,
"cut_index": 716,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\Authenticator;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Requ... | Provider('provideAuthenticators')]
public function testSupport(InMemoryUserProvider $userProvider, RemoteUserAuthenticator $authenticator, $parameterName)
{
$request = $this->createRequest([$parameterName => 'TheUsername']);
$this- | ty\Core\User\InMemoryUser;
use Symfony\Component\Security\Core\User\InMemoryUserProvider;
use Symfony\Component\Security\Http\Authenticator\RemoteUserAuthenticator;
class RemoteUserAuthenticatorTest extends TestCase
{
#[Data | {
"filepath": "src/Symfony/Component/Security/Http/Tests/Authenticator/RemoteUserAuthenticatorTest.php",
"language": "php",
"file_size": 3122,
"cut_index": 614,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\Authenticator\Passport\Badge;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Secu... | badge = new UserBadge('dummy', static fn () => null);
$this->expectException(UserNotFoundException::class);
$badge->getUser();
}
public function testEmptyUserIdentifier()
{
$this->expectException(BadCredentialsException | e Symfony\Component\String\Slugger\AsciiSlugger;
use Symfony\Component\String\UnicodeString;
use function Symfony\Component\String\u;
class UserBadgeTest extends TestCase
{
public function testUserNotFound()
{
$ | {
"filepath": "src/Symfony/Component/Security/Http/Tests/Authenticator/Passport/Badge/UserBadgeTest.php",
"language": "php",
"file_size": 3135,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\Authenticator\AccessToken;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
use Symfony\Co... | tingPassport;
use Symfony\Component\Security\Http\Tests\Authenticator\InMemoryAccessTokenHandler;
class FormEncodedBodyAccessTokenAuthenticatorTest extends TestCase
{
private InMemoryUserProvider $userProvider;
private AccessTokenAuthenticator $au | ractor;
use Symfony\Component\Security\Http\Authenticator\AccessTokenAuthenticator;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValida | {
"filepath": "src/Symfony/Component/Security/Http/Tests/Authenticator/AccessToken/FormEncodedBodyAccessTokenAuthenticatorTest.php",
"language": "php",
"file_size": 5189,
"cut_index": 716,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\Authenticator\AccessToken;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFou... | ticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
use Symfony\Component\Security\Http\Tests\Authenticator\InMemoryAccessTokenHandler;
class QueryAccessTokenAuthenticatorTest extends TestCa | sToken\AccessTokenHandlerInterface;
use Symfony\Component\Security\Http\AccessToken\QueryAccessTokenExtractor;
use Symfony\Component\Security\Http\Authenticator\AccessTokenAuthenticator;
use Symfony\Component\Security\Http\Authen | {
"filepath": "src/Symfony/Component/Security/Http/Tests/Authenticator/AccessToken/QueryAccessTokenAuthenticatorTest.php",
"language": "php",
"file_size": 4484,
"cut_index": 614,
"middle_length": 229
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Event;
use Symfony\Component\Security\Core\Au... | te TokenInterface $token,
private Passport $passport,
) {
}
public function getAuthenticatedToken(): TokenInterface
{
return $this->token;
}
public function setAuthenticatedToken(TokenInterface $authenticatedToken) | token was created, before it becomes effective in the security system.
*
* @author Christian Scheb <me@christianscheb.de>
*/
class AuthenticationTokenCreatedEvent extends Event
{
public function __construct(
priva | {
"filepath": "src/Symfony/Component/Security/Http/Event/AuthenticationTokenCreatedEvent.php",
"language": "php",
"file_size": 1157,
"cut_index": 518,
"middle_length": 229
} |
he Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Event;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component... | private Request $request,
private TokenInterface $authenticationToken,
) {
}
public function getRequest(): Request
{
return $this->request;
}
public function getAuthenticationToken(): TokenInterface
{
| ends Event
{
public function __construct(
| {
"filepath": "src/Symfony/Component/Security/Http/Event/InteractiveLoginEvent.php",
"language": "php",
"file_size": 899,
"cut_index": 547,
"middle_length": 52
} |
buted with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\Controller;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\ArgumentResolver;
use Symfony\Component\HttpKernel\Controller\ArgumentResolver\DefaultValueResolver;
us... | e Symfony\Component\Security\Core\User\OAuth2User;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Http\Attribute\CurrentUser;
use Symfony\Component\Security\Http\Controller\UserValueResolver;
use Symfony\Component\Se | \Storage\TokenStorage;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\User\InMemoryUser;
us | {
"filepath": "src/Symfony/Component/Security/Http/Tests/Controller/UserValueResolverTest.php",
"language": "php",
"file_size": 7845,
"cut_index": 716,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\EventListener;
use PHPUnit\Framework\Attributes\DataProvid... | aConfig, string $expectedHeader)
{
$response = new Response();
$event = new LogoutEvent(new Request(), null);
$event->setResponse($response);
$listener = new ClearSiteDataLogoutListener($clearSiteDataConfig);
$ | ony\Component\Security\Http\EventListener\ClearSiteDataLogoutListener;
class ClearSiteDataLogoutListenerTest extends TestCase
{
#[DataProvider('provideClearSiteDataConfig')]
public function testLogout(array $clearSiteDat | {
"filepath": "src/Symfony/Component/Security/Http/Tests/EventListener/ClearSiteDataLogoutListenerTest.php",
"language": "php",
"file_size": 1758,
"cut_index": 537,
"middle_length": 229
} |
se Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Authorization\AccessDecisionManager;
use Symfony\Component\Security\Core\Author... | thorization\Voter\Voter;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Symfony\Component\Security\Http\EventListener\IsGrantedAttributeListener;
use Symfony\Component\Secur | \Component\Security\Core\Authorization\Voter\ExpressionVoter;
use Symfony\Component\Security\Core\Authorization\Voter\RoleVoter;
use Symfony\Component\Security\Core\Authorization\Voter\Vote;
use Symfony\Component\Security\Core\Au | {
"filepath": "src/Symfony/Component/Security/Http/Tests/EventListener/IsGrantedAttributeListenerTest.php",
"language": "php",
"file_size": 27253,
"cut_index": 1331,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\EventListener;
use PHPUnit\Framework\TestCase... | ession')->willReturn(false);
$request->expects($this->never())->method('getSession');
$sessionLogoutListener = new SessionLogoutListener();
$sessionLogoutListener->onLogout(new LogoutEvent($request, null));
}
public functi | \EventListener\SessionLogoutListener;
class SessionLogoutListenerTest extends TestCase
{
public function testOnLogoutIfHasNoSession()
{
$request = $this->createMock(Request::class);
$request->method('hasS | {
"filepath": "src/Symfony/Component/Security/Http/Tests/EventListener/SessionLogoutListenerTest.php",
"language": "php",
"file_size": 1384,
"cut_index": 524,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\EventListener;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\... | use Symfony\Component\Security\Http\Tests\Fixtures\DummyAuthenticator;
class UserProviderListenerTest extends TestCase
{
private InMemoryUserProvider $userProvider;
private UserProviderListener $listener;
protected function setUp(): void
| \UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
use Symfony\Component\Security\Http\Event\CheckPassportEvent;
use Symfony\Component\Security\Http\EventListener\UserProviderListener;
| {
"filepath": "src/Symfony/Component/Security/Http/Tests/EventListener/UserProviderListenerTest.php",
"language": "php",
"file_size": 2202,
"cut_index": 563,
"middle_length": 229
} |
undation\Request;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
use Symfony\Component\Security\... | port\Badge\PasswordUpgradeBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials;
use Symfony\Component\Security\Http\HttpUtils;
use Symf | ssHandlerInterface;
use Symfony\Component\Security\Http\Authenticator\FormLoginAuthenticator;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\CsrfTokenBadge;
use Symfony\Component\Security\Http\Authenticator\Pass | {
"filepath": "src/Symfony/Component/Security/Http/Tests/Authenticator/FormLoginAuthenticatorTest.php",
"language": "php",
"file_size": 11673,
"cut_index": 921,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\Authentication;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Requ... | tLastAuthenticationErrorWhenRequestHasAttribute()
{
$authenticationError = new AuthenticationException();
$request = Request::create('/');
$request->attributes->set(SecurityRequestAttributes::AUTHENTICATION_ERROR, $authenticatio | enticationException;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
use Symfony\Component\Security\Http\SecurityRequestAttributes;
class AuthenticationUtilsTest extends TestCase
{
public function tes | {
"filepath": "src/Symfony/Component/Security/Http/Tests/Authentication/AuthenticationUtilsTest.php",
"language": "php",
"file_size": 4522,
"cut_index": 614,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\Authenticator;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\... | ials;
use Symfony\Component\Security\Http\Tests\Authenticator\Fixtures\PasswordUpgraderProvider;
class HttpBasicAuthenticatorTest extends TestCase
{
private InMemoryUserProvider $userProvider;
private HttpBasicAuthenticator $authenticator;
pr | ent\Security\Http\Authenticator\HttpBasicAuthenticator;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\PasswordUpgradeBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredent | {
"filepath": "src/Symfony/Component/Security/Http/Tests/Authenticator/HttpBasicAuthenticatorTest.php",
"language": "php",
"file_size": 2968,
"cut_index": 563,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\Authenticator;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Cook... | \Component\Security\Http\RememberMe\RememberMeDetails;
use Symfony\Component\Security\Http\RememberMe\RememberMeHandlerInterface;
use Symfony\Component\Security\Http\RememberMe\ResponseListener;
class RememberMeAuthenticatorTest extends TestCase
{
pri | mePasswordToken;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\User\InMemoryUser;
use Symfony\Component\Security\Http\Authenticator\RememberMeAuthenticator;
use Symfony | {
"filepath": "src/Symfony/Component/Security/Http/Tests/Authenticator/RememberMeAuthenticatorTest.php",
"language": "php",
"file_size": 4787,
"cut_index": 614,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\Authenticator\AccessToken;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFou... | ken\HeaderAccessTokenExtractor;
use Symfony\Component\Security\Http\AccessToken\QueryAccessTokenExtractor;
use Symfony\Component\Security\Http\Authenticator\AccessTokenAuthenticator;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadg | sToken\AccessTokenHandlerInterface;
use Symfony\Component\Security\Http\AccessToken\ChainAccessTokenExtractor;
use Symfony\Component\Security\Http\AccessToken\FormEncodedBodyExtractor;
use Symfony\Component\Security\Http\AccessTo | {
"filepath": "src/Symfony/Component/Security/Http/Tests/Authenticator/AccessToken/ChainedAccessTokenExtractorsTest.php",
"language": "php",
"file_size": 4513,
"cut_index": 614,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\Authenticator\Debug;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFound... | $request = new Request();
$passport = new SelfValidatingPassport(new UserBadge('robin', static function () {}));
$authenticator = $this->createMock(AuthenticatorInterface::class);
$authenticator->expects($this->once())
| ecurity\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
class TraceableAuthenticatorTest extends TestCase
{
public function testGetInfo()
{
| {
"filepath": "src/Symfony/Component/Security/Http/Tests/Authenticator/Debug/TraceableAuthenticatorTest.php",
"language": "php",
"file_size": 2207,
"cut_index": 563,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Event;
use Symfony\Component\Security\Http\Authenti... | n and
* user checking)
*
* @author Wouter de Jong <wouter@wouterj.nl>
*/
class CheckPassportEvent extends Event
{
public function __construct(
private AuthenticatorInterface $authenticator,
private Passport $passport,
) {
}
| ontracts\EventDispatcher\Event;
/**
* This event is dispatched when the credentials have to be checked.
*
* Listeners to this event must validate the user and the
* credentials (e.g. default listeners do password verificatio | {
"filepath": "src/Symfony/Component/Security/Http/Event/CheckPassportEvent.php",
"language": "php",
"file_size": 1313,
"cut_index": 524,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\EventListener;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\... | e();
$event = new LogoutEvent(new Request(), null);
$event->setResponse($response);
$listener = new CookieClearingLogoutListener(['foo' => ['path' => '/foo', 'domain' => 'foo.foo', 'secure' => true, 'samesite' => Cookie::SAMESITE_S | \Event\LogoutEvent;
use Symfony\Component\Security\Http\EventListener\CookieClearingLogoutListener;
class CookieClearingLogoutListenerTest extends TestCase
{
public function testLogout()
{
$response = new Respons | {
"filepath": "src/Symfony/Component/Security/Http/Tests/EventListener/CookieClearingLogoutListenerTest.php",
"language": "php",
"file_size": 2786,
"cut_index": 563,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\EventListener;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Sessi... | r\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
use Symfony\Component\Security\Http\Event\LoginSuccessEvent;
use Symfony\Component\Security\Http\EventListener\SessionStrategyListener;
use Symfo | e\Authentication\Token\PreAuthenticatedToken;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
use Symfony\Component\Security\Core\User\InMemoryUser;
use Symfony\Component\Security\Http\Authenticato | {
"filepath": "src/Symfony/Component/Security/Http/Tests/EventListener/SessionStrategyListenerTest.php",
"language": "php",
"file_size": 4729,
"cut_index": 614,
"middle_length": 229
} |
\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage... | private SessionInterface $session;
private AuthenticationException $exception;
protected function setUp(): void
{
$this->session = new Session(new MockArraySessionStorage());
$this->request = Request::create('https://localh | icationFailureHandler;
use Symfony\Component\Security\Http\HttpUtils;
use Symfony\Component\Security\Http\SecurityRequestAttributes;
class DefaultAuthenticationFailureHandlerTest extends TestCase
{
private Request $request;
| {
"filepath": "src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php",
"language": "php",
"file_size": 11052,
"cut_index": 921,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\Authenticator;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\User\InMemoryUser;
use Symfony\Component\Security\Http\Authen... | assport\SelfValidatingPassport;
use Symfony\Component\Security\Http\HttpUtils;
use Symfony\Component\Security\Http\LoginLink\Exception\ExpiredLoginLinkException;
use Symfony\Component\Security\Http\LoginLink\Exception\InvalidLoginLinkAuthenticationExceptio | nLinkAuthenticator;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\RememberMeBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\P | {
"filepath": "src/Symfony/Component/Security/Http/Tests/Authenticator/LoginLinkAuthenticatorTest.php",
"language": "php",
"file_size": 5517,
"cut_index": 716,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\Authenticator\AccessToken;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\BadCredentialsException;
use Symfony\Co... | datingPassport;
use Symfony\Component\Security\Http\Tests\Authenticator\InMemoryAccessTokenHandler;
class HeaderAccessTokenAuthenticatorTest extends TestCase
{
private InMemoryUserProvider $userProvider;
private AccessTokenAuthenticator $authentic | xtractor;
use Symfony\Component\Security\Http\Authenticator\AccessTokenAuthenticator;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\SelfVali | {
"filepath": "src/Symfony/Component/Security/Http/Tests/Authenticator/AccessToken/HeaderAccessTokenAuthenticatorTest.php",
"language": "php",
"file_size": 6304,
"cut_index": 716,
"middle_length": 229
} |
;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Security\Core\Exception\InvalidCsrfTokenException;
use Symfony\Component\Security\Csrf\CsrfToken;
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
use Symfony\Component\Security\Http\Attribute\IsCsrfTokenValid;
use Symfony\Compo... | uest([], ['_token' => 'bar']);
$csrfTokenManager = $this->createMock(CsrfTokenManagerInterface::class);
$csrfTokenManager->expects($this->once())
->method('isTokenValid')
->with(new CsrfToken('foo', 'bar'))
| Tests\Fixtures\IsCsrfTokenValidAttributeMethodsController;
class IsCsrfTokenValidAttributeListenerTest extends TestCase
{
public function testIsCsrfTokenValidCalledCorrectlyOnInvokableClass()
{
$request = new Req | {
"filepath": "src/Symfony/Component/Security/Http/Tests/EventListener/IsCsrfTokenValidAttributeListenerTest.php",
"language": "php",
"file_size": 19629,
"cut_index": 1331,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\Authenticator;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Requ... | tingPassport;
class AbstractLoginFormAuthenticatorTest extends TestCase
{
#[DataProvider('provideSupportsData')]
public function testSupports(string $loginUrl, Request $request, bool $expected)
{
$authenticator = new ConcreteFormAuthen | Authenticator;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValida | {
"filepath": "src/Symfony/Component/Security/Http/Tests/Authenticator/AbstractLoginFormAuthenticatorTest.php",
"language": "php",
"file_size": 4254,
"cut_index": 614,
"middle_length": 229
} |
buted with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\Authenticator;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
use Symfony\Compon... | $this->authenticator = new X509Authenticator($this->userProvider, new TokenStorage(), 'main');
}
#[DataProvider('provideServerVars')]
public function testAuthentication($username, $credentials)
{
$serverVars = [];
if ('' != | rTest extends TestCase
{
private InMemoryUserProvider $userProvider;
private X509Authenticator $authenticator;
protected function setUp(): void
{
$this->userProvider = new InMemoryUserProvider();
| {
"filepath": "src/Symfony/Component/Security/Http/Tests/Authenticator/X509AuthenticatorTest.php",
"language": "php",
"file_size": 7387,
"cut_index": 716,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\EventListener;
use PHPUnit\Framework\TestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Reque... | lfValidatingPassport;
use Symfony\Component\Security\Http\Event\CheckPassportEvent;
use Symfony\Component\Security\Http\Event\LoginFailureEvent;
use Symfony\Component\Security\Http\EventListener\LoginThrottlingListener;
use Symfony\Component\Security\Http\ |
use Symfony\Component\Security\Core\Exception\TooManyLoginAttemptsAuthenticationException;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Se | {
"filepath": "src/Symfony/Component/Security/Http/Tests/EventListener/LoginThrottlingListenerTest.php",
"language": "php",
"file_size": 4713,
"cut_index": 614,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests\AccessToken\Oidc;
use Jose\Component\Core\AlgorithmManager;
use Jose\Component\Core\JWK;
use Jose\Component\Core\JWKSet;
use Jose\Compo... | penssl')]
class OidcTokenGeneratorTest extends TestCase
{
public function testGenerate()
{
$algorithmManager = new AlgorithmManager([new ES256()]);
$audience = 'Symfony OIDC';
$issuers = ['https://www.example.com'];
| Framework\TestCase;
use Symfony\Component\Clock\MockClock;
use Symfony\Component\Security\Http\AccessToken\Oidc\OidcTokenGenerator;
use Symfony\Component\Security\Http\AccessToken\Oidc\OidcTokenHandler;
#[RequiresPhpExtension('o | {
"filepath": "src/Symfony/Component/Security/Http/Tests/AccessToken/Oidc/OidcTokenGeneratorTest.php",
"language": "php",
"file_size": 3813,
"cut_index": 614,
"middle_length": 229
} |
file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Authenticator;
/**
* This is an extension of the authen... | * @author Wouter de Jong <wouter@wouterj.nl>
*/
interface InteractiveAuthenticatorInterface extends AuthenticatorInterface
{
/**
* Should return true to make this authenticator perform
* an interactive login.
*/
public function isI | InteractiveLoginEvent
* upon successful login.
*
| {
"filepath": "src/Symfony/Component/Security/Http/Authenticator/InteractiveAuthenticatorInterface.php",
"language": "php",
"file_size": 859,
"cut_index": 529,
"middle_length": 52
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Authenticator;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Co... | r\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
use Symfony\Component\Security\Http\Authenticator\Passport\SelfValidatingPassport;
use Symfony\Component\Security\Http\HttpUtils;
use Symfony\Component\Securit | terface;
use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\RememberMeBadge;
use Symfony\Component\Security\Http\Authenticato | {
"filepath": "src/Symfony/Component/Security/Http/Authenticator/LoginLinkAuthenticator.php",
"language": "php",
"file_size": 3461,
"cut_index": 614,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Authenticator;
use Psr\Log\LoggerInterface;
use Symfony\Componen... | Douailin <maxime.douailin@gmail.com>
*
* @internal
*/
final class RemoteUserAuthenticator extends AbstractPreAuthenticatedAuthenticator
{
public function __construct(
UserProviderInterface $userProvider,
TokenStorageInterface $tokenS | fony\Component\Security\Core\User\UserProviderInterface;
/**
* This authenticator authenticates a remote user.
*
* @author Wouter de Jong <wouter@wouterj.nl>
* @author Fabien Potencier <fabien@symfony.com>
* @author Maxime | {
"filepath": "src/Symfony/Component/Security/Http/Authenticator/RemoteUserAuthenticator.php",
"language": "php",
"file_size": 1561,
"cut_index": 537,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Authenticator;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\Request;
... |
*
* @final
*/
class X509Authenticator extends AbstractPreAuthenticatedAuthenticator
{
public function __construct(
UserProviderInterface $userProvider,
TokenStorageInterface $tokenStorage,
string $firewallName,
priva | re\User\UserProviderInterface;
/**
* This authenticator authenticates pre-authenticated (by the
* webserver) X.509 certificates.
*
* @author Wouter de Jong <wouter@wouterj.nl>
* @author Fabien Potencier <fabien@symfony.com> | {
"filepath": "src/Symfony/Component/Security/Http/Authenticator/X509Authenticator.php",
"language": "php",
"file_size": 2333,
"cut_index": 563,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Authenticator\Passport\Badge;
use Symfony\Component... | SRF token.
* Using a different string for each authenticator improves its security.
* @param string|null $csrfToken The CSRF token presented in the request, if any
*/
public function __construct(
| ong <wouter@wouterj.nl>
*
* @final
*/
class CsrfTokenBadge implements BadgeInterface
{
private bool $resolved = false;
/**
* @param string $csrfTokenId An arbitrary string used to generate the value of the C | {
"filepath": "src/Symfony/Component/Security/Http/Authenticator/Passport/Badge/CsrfTokenBadge.php",
"language": "php",
"file_size": 1500,
"cut_index": 524,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Authenticator\Passport\Badge;
use Symfony\Component\Security\Cor... | g $plaintextPassword The presented password, used in the rehash
* @param PasswordUpgraderInterface|null $passwordUpgrader The password upgrader, defaults to the UserProvider if null
*/
public function __construct(
| * @see PasswordUpgraderInterface
*
* @author Wouter de Jong <wouter@wouterj.nl>
*
* @final
*/
class PasswordUpgradeBadge implements BadgeInterface
{
private ?string $plaintextPassword = null;
/**
* @param strin | {
"filepath": "src/Symfony/Component/Security/Http/Authenticator/Passport/Badge/PasswordUpgradeBadge.php",
"language": "php",
"file_size": 1753,
"cut_index": 537,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Authenticator\Passport\Badge;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Exce... | d
* "user loader" to load the related User object.
*
* @author Wouter de Jong <wouter@wouterj.nl>
*/
class UserBadge implements BadgeInterface
{
public const MAX_USERNAME_LENGTH = 4096;
/** @var callable|null */
private $userLoader;
pr | mponent\Security\Core\User\UserInterface;
use Symfony\Component\Security\Http\EventListener\UserProviderListener;
/**
* Represents the user in the authentication process.
*
* It uses an identifier (e.g. email, or username) an | {
"filepath": "src/Symfony/Component/Security/Http/Authenticator/Passport/Badge/UserBadge.php",
"language": "php",
"file_size": 4624,
"cut_index": 614,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Authenticator\Token;
use Symfony\Component\Security\Core\Authent... | if ('' === $firewallName) {
throw new \InvalidArgumentException('$firewallName must not be empty.');
}
$this->setUser($user);
}
/**
* This is meant to be only a token, where credentials
* have already | les
*
* @throws \InvalidArgumentException
*/
public function __construct(
UserInterface $user,
private string $firewallName,
array $roles,
) {
parent::__construct($roles);
| {
"filepath": "src/Symfony/Component/Security/Http/Authenticator/Token/PostAuthenticationToken.php",
"language": "php",
"file_size": 1511,
"cut_index": 537,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Authenticator\Debug;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\H... | ner extends AbstractListener implements ResetInterface
{
private array $authenticators = [];
public function __construct(private AuthenticatorManagerListener $authenticationManagerListener)
{
}
public function supports(Request $reques | rvice\ResetInterface;
/**
* Decorates the AuthenticatorManagerListener to collect information about security authenticators.
*
* @author Robin Chalas <robin.chalas@gmail.com>
*/
final class TraceableAuthenticatorManagerListe | {
"filepath": "src/Symfony/Component/Security/Http/Authenticator/Debug/TraceableAuthenticatorManagerListener.php",
"language": "php",
"file_size": 2539,
"cut_index": 563,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Authenticator;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use ... | wordUpgradeBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Credentials\PasswordCredentials;
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
u | on\AuthenticationException;
use Symfony\Component\Security\Core\User\PasswordUpgraderInterface;
use Symfony\Component\Security\Core\User\UserProviderInterface;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\Pass | {
"filepath": "src/Symfony/Component/Security/Http/Authenticator/HttpBasicAuthenticator.php",
"language": "php",
"file_size": 3298,
"cut_index": 614,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Authenticator;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use ... | portedUserException;
use Symfony\Component\Security\Core\Exception\UserNotFoundException;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\UserBadge;
use Symfony\Component\Security\Http\Authenticator\Passport\Passport;
use Symfony\Component | e\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Core\Exception\CookieTheftException;
use Symfony\Component\Security\Core\Exception\Unsup | {
"filepath": "src/Symfony/Component/Security/Http/Authenticator/RememberMeAuthenticator.php",
"language": "php",
"file_size": 4529,
"cut_index": 614,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\Authentication\Token;
use Symfony\Component\Security\Core\User\U... | tring method
* @param $originatedFromUri The URI where was the user at the switch
*
* @throws \InvalidArgumentException
*/
public function __construct(
UserInterface $user,
string $firewallName,
array $roles, | s UsernamePasswordToken
{
private ?string $originatedFromUri = null;
/**
* @param $user The username (like a nickname, email address, etc.), or a UserInterface instance or an object implementing a __toS | {
"filepath": "src/Symfony/Component/Security/Core/Authentication/Token/SwitchUserToken.php",
"language": "php",
"file_size": 2004,
"cut_index": 537,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\Authentication\Token;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* Toke... | g representation of the Token.
*
* This is only to be used for debugging purposes.
*/
public function __toString(): string;
/**
* Returns the user identifier used during authentication (e.g. a user's email address or username). | ls from being put in the session storage.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
interface TokenInterface extends \Stringable
{
/**
* Returns a strin | {
"filepath": "src/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.php",
"language": "php",
"file_size": 2284,
"cut_index": 563,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\Authentication\Token;
use Symfony\Component\Securit... | throw new \InvalidArgumentException('$firewallName must not be empty.');
}
$this->setUser($user);
}
public function getFirewallName(): string
{
return $this->firewallName;
}
public function __serialize( | bstractToken
{
public function __construct(
UserInterface $user,
private string $firewallName,
array $roles = [],
) {
parent::__construct($roles);
if ('' === $firewallName) {
| {
"filepath": "src/Symfony/Component/Security/Core/Authentication/Token/UsernamePasswordToken.php",
"language": "php",
"file_size": 1263,
"cut_index": 524,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\Authentication\Token\Storage;
use Symfony\Component\Security\Cor... | $token = null;
private ?\Closure $initializer = null;
public function getToken(): ?TokenInterface
{
if ($initializer = $this->initializer) {
$this->initializer = null;
$initializer();
}
return | user authentication.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class TokenStorage implements TokenStorageInterface, ResetInterface
{
private ?TokenInterface | {
"filepath": "src/Symfony/Component/Security/Core/Authentication/Token/Storage/TokenStorage.php",
"language": "php",
"file_size": 1529,
"cut_index": 537,
"middle_length": 229
} |
ackage.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\Authentication\Token\Storage;
use Symfony\Component\Security\Core\Authentication\Token... | Interface;
/**
* Sets the authentication token.
*
* @param TokenInterface|null $token A TokenInterface token, or null if no further authentication information should be stored
*/
public function setToken(?TokenInterface $token) | oken.
*/
public function getToken(): ?Token | {
"filepath": "src/Symfony/Component/Security/Core/Authentication/Token/Storage/TokenStorageInterface.php",
"language": "php",
"file_size": 877,
"cut_index": 559,
"middle_length": 52
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\Authentication\Token\Storage;
use Psr\Container\ContainerInterface;
use Symfony\Component\... | rageInterface, ServiceSubscriberInterface
{
private bool $enableUsageTracking = false;
public function __construct(
private TokenStorageInterface $storage,
private ContainerInterface $container,
) {
}
public function g | ce\ServiceSubscriberInterface;
/**
* A token storage that increments the session usage index when the token is accessed.
*
* @author Nicolas Grekas <p@tchwork.com>
*/
final class UsageTrackingTokenStorage implements TokenSto | {
"filepath": "src/Symfony/Component/Security/Core/Authentication/Token/Storage/UsageTrackingTokenStorage.php",
"language": "php",
"file_size": 2244,
"cut_index": 563,
"middle_length": 229
} |
hp
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\User;
use Symfony\Component\Security\Core\... | ven user identifier (e.g. username or email) and attributes.
*
* This method must throw UserNotFoundException if the user is not found.
*
* @return TUser
*
* @throws UserNotFoundException
*/
public function loadUserBy | ns.
*
* @template-covariant TUser of UserInterface
*
* @template-extends UserProviderInterface<TUser>
*/
interface AttributesBasedUserProviderInterface extends UserProviderInterface
{
/**
* Loads the user for the gi | {
"filepath": "src/Symfony/Component/Security/Core/User/AttributesBasedUserProviderInterface.php",
"language": "php",
"file_size": 1073,
"cut_index": 515,
"middle_length": 229
} |
n Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\User;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
final class ChainUserChecker ... | id
{
foreach ($this->checkers as $checker) {
$checker->checkPreAuth($user);
}
}
public function checkPostAuth(UserInterface $user, ?TokenInterface $token = null): void
{
foreach ($this->checkers as $chec | ublic function checkPreAuth(UserInterface $user): vo | {
"filepath": "src/Symfony/Component/Security/Core/User/ChainUserChecker.php",
"language": "php",
"file_size": 967,
"cut_index": 582,
"middle_length": 52
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\User;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\Exception\UserNotFoundExcep... | UserProviderInterface> $providers
*/
public function __construct(
private iterable $providers,
) {
}
/**
* @return UserProviderInterface[]
*/
public function getProviders(): array
{
if ($this->provid | om>
*
* @template-implements AttributesBasedUserProviderInterface<UserInterface>
*/
class ChainUserProvider implements AttributesBasedUserProviderInterface, PasswordUpgraderInterface
{
/**
* @param iterable<array-key, | {
"filepath": "src/Symfony/Component/Security/Core/User/ChainUserProvider.php",
"language": "php",
"file_size": 3764,
"cut_index": 614,
"middle_length": 229
} |
file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\User;
/**
* EquatableInterface used to test if two obje... | by comparing identities (i.e. getId() === getId()).
*
* However, you do not need to compare every attribute, but only those that
* are relevant for assessing whether re-authentication is required.
*/
public function isEqualTo(UserIn | neither be done by referential equality
* nor | {
"filepath": "src/Symfony/Component/Security/Core/User/EquatableInterface.php",
"language": "php",
"file_size": 862,
"cut_index": 529,
"middle_length": 52
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\User;
/**
* UserInterface implementation used by the in-memory user provider.
*
* This ... | [],
private bool $enabled = true,
) {
if ('' === $username || null === $username) {
throw new \InvalidArgumentException('The username cannot be empty.');
}
$this->username = $username;
}
public func | , PasswordAuthenticatedUserInterface, EquatableInterface, \Stringable
{
private string $username;
public function __construct(
?string $username,
private ?string $password,
private array $roles = | {
"filepath": "src/Symfony/Component/Security/Core/User/InMemoryUser.php",
"language": "php",
"file_size": 2685,
"cut_index": 563,
"middle_length": 229
} |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\User;
use Symfony\Component\Security\Co... | if (!$user->isEnabled()) {
$ex = new DisabledException('User account is disabled.');
$ex->setUser($user);
throw $ex;
}
}
public function checkPostAuth(UserInterface $user, ?TokenInterface $token = | <fabien@symfony.com>
*/
class InMemoryUserChecker implements UserCheckerInterface
{
public function checkPreAuth(UserInterface $user): void
{
if (!$user instanceof InMemoryUser) {
return;
}
| {
"filepath": "src/Symfony/Component/Security/Core/User/InMemoryUserChecker.php",
"language": "php",
"file_size": 1024,
"cut_index": 512,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\User;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\Component\Security\Core\Exception\UserNotFoundExcep... | terface>
*/
private array $users = [];
/**
* The user array is a hash where the keys are usernames and the values are
* an array of attributes: 'password', 'enabled', and 'roles'.
*
* @param array<string, array{password?: | stance)
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @template-implements UserProviderInterface<InMemoryUser>
*/
class InMemoryUserProvider implements UserProviderInterface
{
/**
* @var array<string, UserIn | {
"filepath": "src/Symfony/Component/Security/Core/User/InMemoryUserProvider.php",
"language": "php",
"file_size": 3557,
"cut_index": 614,
"middle_length": 229
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\User;
/**
* For users that can be authentic... | hor Robin Chalas <robin.chalas@gmail.com>
*/
interface LegacyPasswordAuthenticatedUserInterface extends PasswordAuthenticatedUserInterface
{
/**
* Returns the salt that was originally used to hash the password.
*/
public function getSalt | ad.
*
* @aut | {
"filepath": "src/Symfony/Component/Security/Core/User/LegacyPasswordAuthenticatedUserInterface.php",
"language": "php",
"file_size": 802,
"cut_index": 517,
"middle_length": 14
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\User;
use Symfony\Component\Config\Definition\Excep... | __construct(string $firewall)
{
throw new InvalidConfigurationException(\sprintf('"%s" firewall requires a user provider but none was defined.', $firewall));
}
public function loadUserByUsername(string $username): UserInterface
{
| @internal
*
* @template-implements UserProviderInterface<never>
*/
class MissingUserProvider implements UserProviderInterface
{
/**
* @param string $firewall the firewall missing a provider
*/
public function | {
"filepath": "src/Symfony/Component/Security/Core/User/MissingUserProvider.php",
"language": "php",
"file_size": 1435,
"cut_index": 524,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\User;
/**
* UserInterface implementation used by the access-token security workflow with ... | ,
public readonly ?string $tokenType = null,
public readonly ?int $exp = null,
public readonly ?int $iat = null,
public readonly ?int $nbf = null,
public readonly ?string $sub = null,
public readonly ?string | // Standard Claims (https://datatracker.ietf.org/doc/html/rfc7662#section-2.2)
public readonly ?string $scope = null,
public readonly ?string $clientId = null,
public readonly ?string $username = null | {
"filepath": "src/Symfony/Component/Security/Core/User/OAuth2User.php",
"language": "php",
"file_size": 2164,
"cut_index": 563,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\User;
/**
* UserInterface implementation used by the access-token security workflow with an OIDC server.
*/
class OidcUser implements UserI... | $familyName = null,
private ?string $middleName = null,
private ?string $nickname = null,
private ?string $preferredUsername = null,
private ?string $profile = null,
private ?string $picture = null,
private | Standard Claims (https://openid.net/specs/openid-connect-core-1_0.html#StandardClaims)
private ?string $sub = null,
private ?string $name = null,
private ?string $givenName = null,
private ?string | {
"filepath": "src/Symfony/Component/Security/Core/User/OidcUser.php",
"language": "php",
"file_size": 4300,
"cut_index": 614,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\User;
/**
* For users that can be authenticated using a passwor... | ord hash
* in the session, it's also possible to hash the password hash before
* serializing it; crc32c is the only algorithm supported.
* For example:
*
* public function __serialize(): array
* {
* $data = (array) $this;
* | ed at all in the session, getPassword() should
* return null after unserialization, and then, changing the user's password
* won't invalidate its sessions.
* In order to invalidate the user sessions while not storing the passw | {
"filepath": "src/Symfony/Component/Security/Core/User/PasswordAuthenticatedUserInterface.php",
"language": "php",
"file_size": 1565,
"cut_index": 537,
"middle_length": 229
} |
hp
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\User;
use Symfony\Component\Security\Core\... | d should be opportunistic:
* it's fine if it does nothing or if it fails without throwing any exception.
*
* @throws UnsupportedUserException if the implementation does not support that user
*/
public function upgradePassword(Passwo | r using a better hash algorithm.
*
* This method should persist the new password in the user storage and update the $user object accordingly.
* Because you don't want your users not being able to log in, this metho | {
"filepath": "src/Symfony/Component/Security/Core/User/PasswordUpgraderInterface.php",
"language": "php",
"file_size": 1072,
"cut_index": 515,
"middle_length": 229
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\User;
use Symfony\Component\Security\Core\Aut... | UserCheckerInterface
{
/**
* Checks the user account before authentication.
*
* @throws AccountStatusException
*/
public function checkPreAuth(UserInterface $user): void;
/**
* Checks the user account after authentica | * Can be used when you want to check the account status, e.g when the account is
* disabled or blocked. This should not be used to make authentication decisions.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
interface | {
"filepath": "src/Symfony/Component/Security/Core/User/UserCheckerInterface.php",
"language": "php",
"file_size": 1157,
"cut_index": 518,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\User;
/**
* Represents the interface that all user classes must... | implement UserProviderInterface.
*
* The __serialize/__unserialize() magic methods can be implemented on the user
* class to prevent sensitive credentials from being put in the session storage.
*
* @see UserProviderInterface
*
* @author Fabien Pote | loaded or where they come from (a database,
* configuration, web service, etc.), you will have a class that implements
* this interface. Objects that implement this interface are created and
* loaded by different objects that | {
"filepath": "src/Symfony/Component/Security/Core/User/UserInterface.php",
"language": "php",
"file_size": 1677,
"cut_index": 537,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\User;
use Symfony\Component\Security\Core\Exception\UnsupportedUserException;
use Symfony\... | ad the UserInterface object for the given identifier (via
* loadUserByIdentifier) so that the rest of the process can continue.
*
* Internally, a user provider can load users from any source (databases,
* configuration, web service). This is totally in | cation configuration, a user identifier (e.g. a
* username or email address) credential enters the system (via form login, or
* any method). The user provider that is configured with that authentication
* method is asked to lo | {
"filepath": "src/Symfony/Component/Security/Core/User/UserProviderInterface.php",
"language": "php",
"file_size": 2293,
"cut_index": 563,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\Authentication\RememberMe;
use Symfony\Component\Security\Core\E... | throw new TokenNotFoundException('No token found.');
}
return $this->tokens[$series];
}
public function updateToken(string $series, #[\SensitiveParameter] string $tokenValue, \DateTimeInterface $lastUsed): void
{
| ass InMemoryTokenProvider implements TokenProviderInterface
{
private array $tokens = [];
public function loadTokenBySeries(string $series): PersistentTokenInterface
{
if (!isset($this->tokens[$series])) {
| {
"filepath": "src/Symfony/Component/Security/Core/Authentication/RememberMe/InMemoryTokenProvider.php",
"language": "php",
"file_size": 1619,
"cut_index": 537,
"middle_length": 229
} |
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\Authentication\RememberMe;
use Symfony\Compon... | Deletes all tokens belonging to series.
*/
public function deleteTokenBySeries(string $series): void;
/**
* Updates the token according to this data.
*
* @throws TokenNotFoundException if the token is not found
*/
pub | *
* Loads the active token for the given series.
*
* @throws TokenNotFoundException if the token is not found
*/
public function loadTokenBySeries(string $series): PersistentTokenInterface;
/**
* | {
"filepath": "src/Symfony/Component/Security/Core/Authentication/RememberMe/TokenProviderInterface.php",
"language": "php",
"file_size": 1246,
"cut_index": 518,
"middle_length": 229
} |
?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\Authentication\RememberMe;
/**
* @autho... | \SensitiveParameter] string $tokenValue): bool;
/**
* Updates an existing token with a new token value and lastUsed time.
*/
public function updateExistingToken(PersistentTokenInterface $token, #[\SensitiveParameter] string $tokenValue, | to for example accept slightly outdated tokens.
*
* Do not forget to implement token comparisons using hash_equals for a secure implementation.
*/
public function verifyToken(PersistentTokenInterface $token, #[ | {
"filepath": "src/Symfony/Component/Security/Core/Authentication/RememberMe/TokenVerifierInterface.php",
"language": "php",
"file_size": 1037,
"cut_index": 513,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\Authentication\Token;
use Symfony\Component\Security\Core\User\U... | BadMethodCallException('Cannot set user on a NullToken.');
}
public function getUserIdentifier(): string
{
return '';
}
public function getAttributes(): array
{
return [];
}
public function setAttributes(a | blic function getRoleNames(): array
{
return [];
}
public function getUser(): ?UserInterface
{
return null;
}
public function setUser(UserInterface $user): never
{
throw new \ | {
"filepath": "src/Symfony/Component/Security/Core/Authentication/Token/NullToken.php",
"language": "php",
"file_size": 1620,
"cut_index": 537,
"middle_length": 229
} |
This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\Authentication\Token;
use Symfony\Component\Securit... |
if ('' === $firewallName) {
throw new \InvalidArgumentException('$firewallName must not be empty.');
}
$this->setUser($user);
}
public function getFirewallName(): string
{
return $this->firewallNam | actToken
{
/**
* @param string[] $roles
*/
public function __construct(
UserInterface $user,
private string $firewallName,
array $roles = [],
) {
parent::__construct($roles);
| {
"filepath": "src/Symfony/Component/Security/Core/Authentication/Token/PreAuthenticatedToken.php",
"language": "php",
"file_size": 1305,
"cut_index": 524,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Authenticator\Passport;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Http\Authenticator\Passport\Ba... | <wouter@wouterj.nl>
*/
class Passport
{
protected UserInterface $user;
private array $badges = [];
private array $attributes = [];
/**
* @param CredentialsInterface $credentials The credentials to check for this authentication, use
| *
* A Passport contains all security-related information that needs to be
* validated during authentication.
*
* A passport badge can be used to add any additional information to the
* passport.
*
* @author Wouter de Jong | {
"filepath": "src/Symfony/Component/Security/Http/Authenticator/Passport/Passport.php",
"language": "php",
"file_size": 3594,
"cut_index": 614,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Authenticator\Passport\Badge;
use Symfony\Component\Security\Htt... | RememberMeBadge implements BadgeInterface
{
private bool $enabled = false;
public function __construct(
public readonly array $parameters = [],
) {
}
/**
* Enables remember-me cookie creation.
*
* In most cases, | l
* cookie is only created if this badge is enabled. By default, this is done
* by the {@see CheckRememberMeConditionsListener} if all conditions are met.
*
* @author Wouter de Jong <wouter@wouterj.nl>
*
* @final
*/
class | {
"filepath": "src/Symfony/Component/Security/Http/Authenticator/Passport/Badge/RememberMeBadge.php",
"language": "php",
"file_size": 1841,
"cut_index": 537,
"middle_length": 229
} |
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Authenticator\Debug;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Secur... | ort;
use Symfony\Component\Security\Http\EntryPoint\AuthenticationEntryPointInterface;
use Symfony\Component\Security\Http\EntryPoint\Exception\NotAnEntryPointException;
use Symfony\Component\VarDumper\Caster\ClassStub;
/**
* Collects info about an authe | se Symfony\Component\Security\Http\Authenticator\InteractiveAuthenticatorInterface;
use Symfony\Component\Security\Http\Authenticator\Passport\Badge\BadgeInterface;
use Symfony\Component\Security\Http\Authenticator\Passport\Passp | {
"filepath": "src/Symfony/Component/Security/Http/Authenticator/Debug/TraceableAuthenticator.php",
"language": "php",
"file_size": 4527,
"cut_index": 614,
"middle_length": 229
} |
he Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core;
use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent;
fi... | ublic const AUTHENTICATION_SUCCESS = 'security.authentication.success';
/**
* Event aliases.
*
* These aliases can be consumed by RegisterListenersPass.
*/
public const ALIASES = [
AuthenticationSuccessEvent::class => s | ore\Event\AuthenticationSuccessEvent")
*/
p | {
"filepath": "src/Symfony/Component/Security/Core/AuthenticationEvents.php",
"language": "php",
"file_size": 893,
"cut_index": 547,
"middle_length": 52
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\Exception;
use Symfony\Component\HttpKernel\Attribute\WithHttpSt... | lic function __construct(string $message = 'Access Denied.', ?\Throwable $previous = null, int $code = 403)
{
parent::__construct($message, $code, $previous);
}
public function getAttributes(): array
{
return $this->attribu | en@symfony.com>
*/
#[WithHttpStatus(403)]
class AccessDeniedException extends RuntimeException
{
private array $attributes = [];
private mixed $subject = null;
private ?AccessDecision $accessDecision = null;
pub | {
"filepath": "src/Symfony/Component/Security/Core/Exception/AccessDeniedException.php",
"language": "php",
"file_size": 1594,
"cut_index": 537,
"middle_length": 229
} |
ge.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\Exception;
use Symfony\Component\HttpKernel\Attribute\WithHttpStatus;
use Symfony\Componen... | return $this->token;
}
public function setToken(TokenInterface $token): void
{
$this->token = $token;
}
/**
* Returns all the necessary state of the object for serialization purposes.
*
* There is no need to s | @author Alexander <iam.asm89@gmail.com>
*/
#[WithHttpStatus(401)]
class AuthenticationException extends RuntimeException
{
private ?TokenInterface $token = null;
public function getToken(): ?TokenInterface
{
| {
"filepath": "src/Symfony/Component/Security/Core/Exception/AuthenticationException.php",
"language": "php",
"file_size": 2712,
"cut_index": 563,
"middle_length": 229
} |
part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\Exception;
/**
* An authentication exception caused by the user... | n
{
private string $messageKey;
private array $messageData = [];
public function __construct(string $message = '', array $messageData = [], int $code = 0, ?\Throwable $previous = null)
{
parent::__construct($message, $code, $previo | words, avoid catching
* other exceptions and passing their message directly to this class.
*
* @author Vincent Langlet <vincentlanglet@github.com>
*/
class CustomUserMessageAccountStatusException extends AccountStatusExceptio | {
"filepath": "src/Symfony/Component/Security/Core/Exception/CustomUserMessageAccountStatusException.php",
"language": "php",
"file_size": 1980,
"cut_index": 537,
"middle_length": 229
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.