Skip to content

[Security] API Key Authentication with Session #4060

Closed
@peterrehm

Description

@peterrehm

I assume there is an issue with storing the authentication within the session in the following doc entry.

http://symfony.com/doc/current/cookbook/security/api_key_authentication.html#storing-authentication-in-the-session

The (in the article) above mentioned authenticateToken() method relies only on the provided token / the credentials. But after the authentication the credentials are being erased by default. To adjust the situation we could add

        if (($user = $token->getUser()) instanceof User) {
            return new PreAuthenticatedToken(
                $user,
                $authToken,
                $providerKey,
                $user->getRoles()
            );
        }

to return the user stored in the session (which is at this step after the refresh of the provider). If it is as I describe here I will create a doc PR.

/cc @Seldaek

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions