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 Object
implements OpenIdAuthenticationMapper
The default implementation of 
OpenIdAuthenticationMapper that uses
 the subject claim for the username and populates the attributes with the
 non JWT standard claims. If an OpenIdAuthenticationMapper bean 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
 - Author:
 - James Kleeh
 
- 
Field Summary
Fields inherited from interface io.micronaut.security.oauth2.endpoint.token.response.OpenIdAuthenticationMapper
OPENID_TOKEN_KEY - 
Constructor Summary
ConstructorsConstructorDescriptionDefaultOpenIdAuthenticationMapper(OpenIdAdditionalClaimsConfiguration openIdAdditionalClaimsConfiguration, AuthenticationModeConfiguration authenticationModeConfiguration) Default constructor. - 
Method Summary
Modifier and TypeMethodDescriptionbuildAttributes(String providerName, OpenIdTokenResponse tokenResponse, OpenIdClaims openIdClaims) createAuthenticationResponse(String providerName, OpenIdTokenResponse tokenResponse, OpenIdClaims openIdClaims, State state) getRoles(String providerName, OpenIdTokenResponse tokenResponse, OpenIdClaims openIdClaims) protected StringgetUsername(String providerName, OpenIdTokenResponse tokenResponse, OpenIdClaims openIdClaims)  
- 
Constructor Details
- 
DefaultOpenIdAuthenticationMapper
public DefaultOpenIdAuthenticationMapper(OpenIdAdditionalClaimsConfiguration openIdAdditionalClaimsConfiguration, AuthenticationModeConfiguration authenticationModeConfiguration) Default constructor.- Parameters:
 openIdAdditionalClaimsConfiguration- The additional claims configurationauthenticationModeConfiguration- Authentication Mode Configuration
 
 - 
 - 
Method Details
- 
createAuthenticationResponse
@NonNull public AuthenticationResponse createAuthenticationResponse(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 Map<String,Object> buildAttributes(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 List<String> getRoles(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 String getUsername(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 
 
 -