Skip to content

[2.8][Security][Guard] GuardTokenInterface vs. TokenInterface in phpDoc #15884

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function checkCredentials($credentials, UserInterface $user);
* @param UserInterface $user
* @param string $providerKey The provider (i.e. firewall) key
*
* @return GuardTokenInterface
* @return TokenInterface|GuardTokenInterface
*/
public function createAuthenticatedToken(UserInterface $user, $providerKey);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
namespace Symfony\Component\Security\Guard\Provider;

use Symfony\Component\Security\Core\Authentication\Provider\AuthenticationProviderInterface;
use Symfony\Component\Security\Core\Authentication\Token\AnonymousToken;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Symfony\Component\Security\Guard\GuardAuthenticatorInterface;
use Symfony\Component\Security\Guard\Token\GuardTokenInterface;
Expand Down Expand Up @@ -56,9 +55,9 @@ public function __construct(array $guardAuthenticators, UserProviderInterface $u
/**
* Finds the correct authenticator for the token and calls it.
*
* @param GuardTokenInterface $token
* @param TokenInterface|GuardTokenInterface $token
*
* @return TokenInterface
* @return TokenInterface|GuardTokenInterface
*/
public function authenticate(TokenInterface $token)
{
Expand Down Expand Up @@ -101,6 +100,12 @@ public function authenticate(TokenInterface $token)
// instances that will be checked if you have multiple firewalls.
}

/**
* @param GuardAuthenticatorInterface $guardAuthenticator
* @param PreAuthenticationGuardToken $token
*
* @return TokenInterface|GuardTokenInterface
*/
private function authenticateViaGuard(GuardAuthenticatorInterface $guardAuthenticator, PreAuthenticationGuardToken $token)
{
// get the user from the GuardAuthenticator
Expand Down Expand Up @@ -138,6 +143,9 @@ private function authenticateViaGuard(GuardAuthenticatorInterface $guardAuthenti
return $authenticatedToken;
}

/**
* {@inheritdoc}
*/
public function supports(TokenInterface $token)
{
return $token instanceof GuardTokenInterface;
Expand Down