Class LegacyImplicitAuthenticationProvider
java.lang.Object
com.irurueta.authserver.authorization.api.web.implicit.LegacyImplicitAuthenticationProvider
- All Implemented Interfaces:
org.springframework.security.authentication.AuthenticationProvider
public class LegacyImplicitAuthenticationProvider
extends Object
implements org.springframework.security.authentication.AuthenticationProvider
Grants the legacy implicit request: after checking the client, its redirect URI, the user, the multi-factor policy,
the
state and the scopes, it issues an access token (never a refresh token) through the token generator,
stores the authorization (so the token can be introspected and revoked) and returns it for the response handler.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MfaAuthorizationManagerApplies the multi-factor policy.private final org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationServiceStores the authorization behind the token.static final org.springframework.security.oauth2.core.AuthorizationGrantTypeGrant type recorded for the tokens of the flow; the framework has no constant for it.private final DurationLongest lifetime of the tokens of the flow.private final org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepositoryFinds the client.private final org.springframework.security.oauth2.server.authorization.token.OAuth2TokenGenerator<? extends org.springframework.security.oauth2.core.OAuth2Token> Generates the access token, with the claims of the other flows. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.core.Authenticationauthenticate(org.springframework.security.core.Authentication authentication) Grants or refuses the request.private LegacyImplicitAccessTokenTokenissue(LegacyImplicitAuthorizationRequestToken request, org.springframework.security.oauth2.server.authorization.client.RegisteredClient client, org.springframework.security.core.Authentication user, Set<String> scopes) Issues and stores the access token.private static org.springframework.security.oauth2.server.authorization.authentication.OAuth2AuthorizationCodeRequestAuthenticationExceptionBuilds a refusal that is answered with400, never redirected, because the redirect URI is not trusted yet or the user cannot be sent anywhere.booleanTells which requests this provider handles.private org.springframework.security.oauth2.server.authorization.client.RegisteredClientwithCappedLifetime(org.springframework.security.oauth2.server.authorization.client.RegisteredClient client) Copies the client with the lifetime of its access tokens limited to the maximum of the flow.
-
Field Details
-
IMPLICIT
public static final org.springframework.security.oauth2.core.AuthorizationGrantType IMPLICITGrant type recorded for the tokens of the flow; the framework has no constant for it. -
registeredClients
private final org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository registeredClientsFinds the client. -
authorizationService
private final org.springframework.security.oauth2.server.authorization.OAuth2AuthorizationService authorizationServiceStores the authorization behind the token. -
tokenGenerator
private final org.springframework.security.oauth2.server.authorization.token.OAuth2TokenGenerator<? extends org.springframework.security.oauth2.core.OAuth2Token> tokenGeneratorGenerates the access token, with the claims of the other flows. -
authorizationManager
Applies the multi-factor policy. -
maxAccessTokenTtl
Longest lifetime of the tokens of the flow.
-
-
Constructor Details
-
LegacyImplicitAuthenticationProvider
public LegacyImplicitAuthenticationProvider()
-
-
Method Details
-
authenticate
public org.springframework.security.core.Authentication authenticate(org.springframework.security.core.Authentication authentication) throws org.springframework.security.core.AuthenticationException Grants or refuses the request.- Specified by:
authenticatein interfaceorg.springframework.security.authentication.AuthenticationProvider- Parameters:
authentication- the request, aLegacyImplicitAuthorizationRequestToken.- Returns:
- the access token, or the error that must be sent in the fragment of the redirect URI.
- Throws:
org.springframework.security.core.AuthenticationException-unsupported_response_typeorunauthorized_clientwhen the client is unknown or may not use the flow,invalid_requestwhen the redirect URI is missing or not registered or the user is not signed in (none of them redirects),SecondFactorRequiredExceptionwhen the user owes a second factor, orserver_errorwhen no token can be generated.
-
supports
Tells which requests this provider handles.- Specified by:
supportsin interfaceorg.springframework.security.authentication.AuthenticationProvider- Parameters:
authentication- the type of the request.- Returns:
truefor a request of the legacy flow.
-
issue
private LegacyImplicitAccessTokenToken issue(LegacyImplicitAuthorizationRequestToken request, org.springframework.security.oauth2.server.authorization.client.RegisteredClient client, org.springframework.security.core.Authentication user, Set<String> scopes) Issues and stores the access token.- Parameters:
request- the request.client- the client.user- the signed-in user.scopes- the scopes granted.- Returns:
- the result.
-
withCappedLifetime
private org.springframework.security.oauth2.server.authorization.client.RegisteredClient withCappedLifetime(org.springframework.security.oauth2.server.authorization.client.RegisteredClient client) Copies the client with the lifetime of its access tokens limited to the maximum of the flow.- Parameters:
client- the client.- Returns:
- the client with the lifetime
min(client, maximum).
-
refused
private static org.springframework.security.oauth2.server.authorization.authentication.OAuth2AuthorizationCodeRequestAuthenticationException refused(String code) Builds a refusal that is answered with400, never redirected, because the redirect URI is not trusted yet or the user cannot be sent anywhere.- Parameters:
code- error code.- Returns:
- the exception.
-