Class IdpClaimsContributor
java.lang.Object
com.irurueta.authserver.authorization.api.web.social.IdpClaimsContributor
- All Implemented Interfaces:
JwtClaimsContributor
@Component
@Order(110)
public class IdpClaimsContributor
extends Object
implements JwtClaimsContributor
Adds to the tokens of a user who signed in with an external provider the claim
idp (the registration id of
the provider). The sub is the local account's username, because the principal's name is (see
FederatedUserMapper), so a token of a federated sign-in is indistinguishable from any other in what it says
about the user.
When the provider is trusted for its multi-factor authentication and proved it (the strong factor,
FederatedFactor.STRONG_AUTHORITY), the upstream amr values are added to the amr claim the
MfaClaimsContributor wrote (each value once, so the
repeated ones of the factor and of the provider are listed once, and mfa is there exactly once). The
acr is not set here: the strong factor is multi-factor alone, so the
multi-factor contributor already wrote the multi-factor class, from the same rule the step-up checks use. The
upstream amr of a provider that is not trusted is never copied: it would claim a strength the server did not
accept.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of the claim that says which provider authenticated the user.static final intOrder of the contributor: after the multi-factor one, whoseamrit extends.private final FederatedUserMapperReads the upstreamamr. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcontribute(org.springframework.security.oauth2.server.authorization.token.OAuth2TokenContext context, Map<String, Object> claims) Adds the claims.existingAmr(Map<String, Object> claims) Reads theamralready in the claims.
-
Field Details
-
ORDER
public static final int ORDEROrder of the contributor: after the multi-factor one, whoseamrit extends.- See Also:
-
IDP_CLAIM
Name of the claim that says which provider authenticated the user.- See Also:
-
userMapper
Reads the upstreamamr.
-
-
Constructor Details
-
IdpClaimsContributor
public IdpClaimsContributor()
-
-
Method Details
-
contribute
public void contribute(org.springframework.security.oauth2.server.authorization.token.OAuth2TokenContext context, Map<String, Object> claims) Adds the claims.- Specified by:
contributein interfaceJwtClaimsContributor- Parameters:
context- the token context.claims- the claims, which this method extends.
-
existingAmr
Reads theamralready in the claims.- Parameters:
claims- the claims.- Returns:
- its values; empty when there is none.
-