Class DefaultOpenIdAuthenticationMapper
- java.lang.Object
-
- io.micronaut.security.oauth2.endpoint.token.response.DefaultOpenIdAuthenticationMapper
-
- All Implemented Interfaces:
OpenIdAuthenticationMapper
@Singleton @Requires(configuration="io.micronaut.security.token.jwt") public class DefaultOpenIdAuthenticationMapper extends java.lang.Object implements OpenIdAuthenticationMapper
The default implementation ofOpenIdAuthenticationMapperthat uses the subject claim for the username and populates the attributes with the non JWT standard claims. If anOpenIdAuthenticationMapperbean is created with a named qualifier that is the same name of the provider, that bean will be used instead of this one.- Since:
- 1.2.0
-
-
Field Summary
-
Fields inherited from interface io.micronaut.security.oauth2.endpoint.token.response.OpenIdAuthenticationMapper
OPENID_TOKEN_KEY
-
-
Constructor Summary
Constructors Constructor Description DefaultOpenIdAuthenticationMapper(OpenIdAdditionalClaimsConfiguration openIdAdditionalClaimsConfiguration, io.micronaut.security.config.AuthenticationModeConfiguration authenticationModeConfiguration)Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.util.Map<java.lang.String,java.lang.Object>buildAttributes(java.lang.String providerName, OpenIdTokenResponse tokenResponse, OpenIdClaims openIdClaims)io.micronaut.security.authentication.AuthenticationResponsecreateAuthenticationResponse(java.lang.String providerName, OpenIdTokenResponse tokenResponse, OpenIdClaims openIdClaims, State state)protected java.util.List<java.lang.String>getRoles(java.lang.String providerName, OpenIdTokenResponse tokenResponse, OpenIdClaims openIdClaims)protected java.lang.StringgetUsername(java.lang.String providerName, OpenIdTokenResponse tokenResponse, OpenIdClaims openIdClaims)
-
-
-
Constructor Detail
-
DefaultOpenIdAuthenticationMapper
public DefaultOpenIdAuthenticationMapper(OpenIdAdditionalClaimsConfiguration openIdAdditionalClaimsConfiguration, io.micronaut.security.config.AuthenticationModeConfiguration authenticationModeConfiguration)
Default constructor.- Parameters:
openIdAdditionalClaimsConfiguration- The additional claims configurationauthenticationModeConfiguration- Authentication Mode Configuration
-
-
Method Detail
-
createAuthenticationResponse
@NonNull public io.micronaut.security.authentication.AuthenticationResponse createAuthenticationResponse(java.lang.String providerName, OpenIdTokenResponse tokenResponse, OpenIdClaims openIdClaims, @Nullable State state)- Specified by:
createAuthenticationResponsein interfaceOpenIdAuthenticationMapper- Parameters:
providerName- The OpenID provider nametokenResponse- The token responseopenIdClaims- The OpenID claimsstate- The state of the response- Returns:
- An authentication response
-
buildAttributes
protected java.util.Map<java.lang.String,java.lang.Object> buildAttributes(java.lang.String providerName, OpenIdTokenResponse tokenResponse, OpenIdClaims openIdClaims)- Parameters:
providerName- The OpenID provider nametokenResponse- The token responseopenIdClaims- The OpenID claims- Returns:
- The attributes to set in the
Authentication
-
getRoles
protected java.util.List<java.lang.String> getRoles(java.lang.String providerName, OpenIdTokenResponse tokenResponse, OpenIdClaims openIdClaims)- Parameters:
providerName- The OpenID provider nametokenResponse- The token responseopenIdClaims- The OpenID claims- Returns:
- The roles to set in the
Authentication
-
getUsername
protected java.lang.String getUsername(java.lang.String providerName, OpenIdTokenResponse tokenResponse, OpenIdClaims openIdClaims)- Parameters:
providerName- The OpenID provider nametokenResponse- The token responseopenIdClaims- The OpenID claims- Returns:
- The username to set in the {
Authentication
-
-