Class RegisteredClientMapper
java.lang.Object
com.irurueta.authserver.authorization.infrastructure.persistence.clients.RegisteredClientMapper
Maps the domain
ClientRegistration onto Spring Authorization Server's RegisteredClient and back.
The audiences, which the framework has no field for, travel as the "settings.client.audiences" custom client
setting.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of the custom client setting that holds the audiences of the access tokens issued to the client.private static final StringAuthentication method that marks a public client.static final StringName of the custom client setting that holds the client's registered public JWK set as JSON, used to verifyprivate_key_jwtassertions and self-signed certificates.static final StringName of the custom client setting that makes every user of the client complete a second factor. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaudiencesOf(org.springframework.security.oauth2.server.authorization.settings.ClientSettings settings) Reads the audiences custom setting.jwksOf(org.springframework.security.oauth2.server.authorization.settings.ClientSettings settings) Reads the registered JWK set custom setting.booleanmfaRequiredOf(org.springframework.security.oauth2.server.authorization.settings.ClientSettings settings) Reads the second-factor custom setting.private StringsigningAlgorithmNameOf(org.springframework.security.oauth2.server.authorization.settings.ClientSettings settings) Reads the token endpoint authentication signing algorithm.private org.springframework.security.oauth2.jose.jws.SignatureAlgorithmsigningAlgorithmOf(String name) Resolves a JWS signature algorithm by name.org.springframework.security.oauth2.server.authorization.client.RegisteredClienttoRegisteredClient(ClientRegistration registration, String id, Instant issuedAt, String secret) Maps a registration to a registered client.toRegistration(org.springframework.security.oauth2.server.authorization.client.RegisteredClient client) Maps a registered client to a registration.
-
Field Details
-
AUDIENCES_SETTING
Name of the custom client setting that holds the audiences of the access tokens issued to the client.- See Also:
-
MFA_REQUIRED_SETTING
Name of the custom client setting that makes every user of the client complete a second factor. It is only written and read here: everybody else asksClientRegistration.mfaRequired()through the client port.- See Also:
-
JWKS_SETTING
Name of the custom client setting that holds the client's registered public JWK set as JSON, used to verifyprivate_key_jwtassertions and self-signed certificates.- See Also:
-
AUTH_METHOD_NONE
Authentication method that marks a public client.
-
-
Constructor Details
-
RegisteredClientMapper
public RegisteredClientMapper()
-
-
Method Details
-
toRegisteredClient
public org.springframework.security.oauth2.server.authorization.client.RegisteredClient toRegisteredClient(ClientRegistration registration, String id, Instant issuedAt, String secret) Maps a registration to a registered client.- Parameters:
registration- the registration.id- internal identifier of the registered client.issuedAt- instant the client identifier was issued.secret- encoded secret, ornull.- Returns:
- the registered client.
- Throws:
IllegalArgumentException- if the token endpoint signing algorithm is not a JWS signature algorithm.
-
toRegistration
public ClientRegistration toRegistration(org.springframework.security.oauth2.server.authorization.client.RegisteredClient client) Maps a registered client to a registration. The framework keeps these collections as sets, so they are returned sorted to make the result deterministic. A client is confidential unless it authenticates withnone.- Parameters:
client- the registered client.- Returns:
- the registration.
-
audiencesOf
public List<String> audiencesOf(org.springframework.security.oauth2.server.authorization.settings.ClientSettings settings) Reads the audiences custom setting.- Parameters:
settings- client settings.- Returns:
- the audiences; empty when the setting is absent (the registration then defaults to the client id).
-
mfaRequiredOf
public boolean mfaRequiredOf(org.springframework.security.oauth2.server.authorization.settings.ClientSettings settings) Reads the second-factor custom setting.- Parameters:
settings- client settings.- Returns:
trueonly when the setting is present and true.
-
jwksOf
public String jwksOf(org.springframework.security.oauth2.server.authorization.settings.ClientSettings settings) Reads the registered JWK set custom setting.- Parameters:
settings- client settings.- Returns:
- the JWK set JSON, or
nullwhen the setting is absent.
-
signingAlgorithmNameOf
private String signingAlgorithmNameOf(org.springframework.security.oauth2.server.authorization.settings.ClientSettings settings) Reads the token endpoint authentication signing algorithm.- Parameters:
settings- client settings.- Returns:
- the algorithm name, or
nullwhen none is set.
-
signingAlgorithmOf
private org.springframework.security.oauth2.jose.jws.SignatureAlgorithm signingAlgorithmOf(String name) Resolves a JWS signature algorithm by name.- Parameters:
name- the algorithm name, for exampleRS256.- Returns:
- the algorithm.
- Throws:
IllegalArgumentException- if the name is not a JWS signature algorithm.
-