Skip to content
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

Implement AuthenticatorInterface::createToken() (Symfony 5.4) #903

Merged
merged 1 commit into from
Aug 23, 2021

Conversation

chalasr
Copy link
Collaborator

@chalasr chalasr commented Aug 10, 2021

No description provided.

@chalasr chalasr changed the title Add failing test case for createAuthenticatedToken() Implement AuthenticatorInterface::createToken() (Symfony 5.4) Aug 10, 2021
{
$token = parent::createToken($passport, $firewallName);

if (!$passport instanceof SelfValidatingPassport) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you'll need the instanceof check here. The biggest need for it in createAuthenticatedToken() is with PassportInterface not having the attributes API, so someone using a custom passport with this authenticator could trigger a fatal error otherwise.

With that said, what you probably would want is to make sure $passport->getAttribute('payload') isn't null, as it seems like the important bit here is the data is attached to the passport and not necessarily the specific passport class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants