Class LegacyImplicitAuthorizationRequestConverter
java.lang.Object
com.irurueta.authserver.authorization.api.web.implicit.LegacyImplicitAuthorizationRequestConverter
- All Implemented Interfaces:
org.springframework.security.web.authentication.AuthenticationConverter
public class LegacyImplicitAuthorizationRequestConverter
extends Object
implements org.springframework.security.web.authentication.AuthenticationConverter
Reads an authorization request with
response_type=token. The framework refuses that response type; this
converter, installed first, takes it over for the one client of the legacy flow and refuses it, with the same
unsupported_response_type and no redirect, for any other client.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLegacyImplicitAuthorizationRequestConverter(String clientId, String authorizationEndpoint) Creates the converter. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.core.Authenticationconvert(jakarta.servlet.http.HttpServletRequest request) Reads the request.private static org.springframework.security.core.AuthenticationReads the user of the request from the security context, an anonymous one when there is none.private static booleanisRepeated(jakarta.servlet.http.HttpServletRequest request, String name) Tells whether a parameter is sent more than once.private static org.springframework.security.oauth2.server.authorization.authentication.OAuth2AuthorizationCodeRequestAuthenticationExceptionBuilds the refusal, which carries no authentication and so is answered with400.
-
Field Details
-
RESPONSE_TYPE_TOKEN
Response type of the implicit flow.- See Also:
-
clientId
Identifier of the only client that may use the flow. -
authorizationRequest
private final org.springframework.security.web.util.matcher.RequestMatcher authorizationRequestMatches aGETof the authorization endpoint.
-
-
Constructor Details
-
LegacyImplicitAuthorizationRequestConverter
Creates the converter.- Parameters:
clientId- identifier of the only client that may use the flow.authorizationEndpoint- path of the authorization endpoint.
-
-
Method Details
-
convert
public org.springframework.security.core.Authentication convert(jakarta.servlet.http.HttpServletRequest request) Reads the request.- Specified by:
convertin interfaceorg.springframework.security.web.authentication.AuthenticationConverter- Parameters:
request- the request.- Returns:
- the request of the legacy flow, or
nullwhen the request is not aGETof the authorization endpoint withresponse_type=token. - Throws:
org.springframework.security.oauth2.server.authorization.authentication.OAuth2AuthorizationCodeRequestAuthenticationException-unsupported_response_type(no redirect) when the client is not the one of the legacy flow,invalid_request(no redirect) when a parameter is repeated.
-
isRepeated
Tells whether a parameter is sent more than once.- Parameters:
request- the request.name- name of the parameter.- Returns:
truewhen it has more than one value.
-
currentUser
private static org.springframework.security.core.Authentication currentUser()Reads the user of the request from the security context, an anonymous one when there is none.- Returns:
- the user.
-
refused
private static org.springframework.security.oauth2.server.authorization.authentication.OAuth2AuthorizationCodeRequestAuthenticationException refused(String code) Builds the refusal, which carries no authentication and so is answered with400.- Parameters:
code- error code.- Returns:
- the exception.
-