Class ClientInformationNodeProcessor
- java.lang.Object
-
- net.shibboleth.oidc.metadata.impl.ClientInformationNodeProcessor
-
- All Implemented Interfaces:
MetadataNodeProcessor
public class ClientInformationNodeProcessor extends Object implements MetadataNodeProcessor
An implementation ofMetadataNodeProcessorwhich supports adding an instance ofOIDCClientInformationto the object metadata ofSPSSODescriptor. The data is fetched mainly viaOAuthRPExtensions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classClientInformationNodeProcessor.SkeletonEchoingRoleDescriptorResolver
-
Field Summary
Fields Modifier and Type Field Description static StringBINDING_ID_REDIRECT_URIThe ACS binding identifier matching to the redirect_uri.private KeyInfoCredentialResolverkeyInfoCredentialResolverTheKeyInfoCredentialResolverto be used for the resolution.private org.slf4j.LoggerlogClass logger.
-
Constructor Summary
Constructors Constructor Description ClientInformationNodeProcessor(List<KeyInfoProvider> keyInfoProviders)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<MetadataValueSAMLObject>getFromExtensions(Extensions extension, QName type)Get all objects of the given type from the given extensions.protected OAuthRPExtensionsgetOAuthRPExtensions(SPSSODescriptor roleDescriptor)Get theOAuthRPExtensionsfrom the givenSPSSODescriptor, it it was found from its extensions.protected URIgetSingleURIValue(String value)protected URIgetSingleURIValue(MetadataValueSAMLObject metadataValue)Converts the metadata value object value into aURI.protected StringgetSingleValue(MetadataValueSAMLObject metadataValue)Gets the trimmedStringvalue from the given metadata value object.protected com.nimbusds.openid.connect.sdk.rp.ApplicationTypeparseApplicationType(OAuthRPExtensions extensions)Parse theApplicationTypefrom the given extensions.protected com.nimbusds.oauth2.sdk.auth.ClientAuthenticationMethodparseClientAuthenticationMethod(OAuthRPExtensions extensions)Parse theClientAuthenticationMethodfrom the given extensions.protected com.nimbusds.oauth2.sdk.id.ClientIDparseClientID(SPSSODescriptor roleDescriptor)Converts the entityID of the givenSPSSODescriptorinto aClientID.protected com.nimbusds.oauth2.sdk.auth.SecretparseClientSecret(Iterable<Credential> credentials)Fetches the client secret from given the set ofCredentials.protected List<com.nimbusds.openid.connect.sdk.claims.ACR>parseDefaultAcrValues(OAuthRPExtensions extensions)Parse the defaultACRvalues from the given extensions.protected com.nimbusds.jose.EncryptionMethodparseEncryptionMethod(MetadataValueSAMLObject metadataValue)Parse theEncryptionMethodfrom the given metadata value.protected Set<com.nimbusds.oauth2.sdk.GrantType>parseGrantTypes(OAuthRPExtensions extensions)Parse theGrantTypes from the given extensions.protected com.nimbusds.jose.JWEAlgorithmparseJweAlgorithm(MetadataValueSAMLObject metadataValue)Parse theJWEAlgorithmfrom the given metadata value.protected com.nimbusds.jose.jwk.JWKSetparseJwkSet(Iterable<Credential> credentials, String clientId)Convert the given credentials into the NimbusJWKSet.protected com.nimbusds.jose.JWSAlgorithmparseJwsAlgorithm(MetadataValueSAMLObject metadataValue)Parse theJWSAlgorithmfrom the given metadata value.protected Set<URI>parseRedirectUris(SPSSODescriptor roleDescriptor)Parse the redirection URIs from the given role descriptor.protected Set<com.nimbusds.oauth2.sdk.ResponseType>parseResponseTypes(OAuthRPExtensions extensions)Parse theResponseTypes from the given extensions.protected com.nimbusds.oauth2.sdk.ScopeparseScope(OAuthRPExtensions extensions)Parse theScopefrom the given extensions.protected com.nimbusds.openid.connect.sdk.SubjectTypeparseSubjectType(SPSSODescriptor roleDescriptor)Parse theSubjectTypefrom the given role descriptor's name ID formats.protected Set<URI>parseUris(List<? extends MetadataValueSAMLObject> listOfValues)Parse the URIs from the given list of metadata values.protected com.nimbusds.openid.connect.sdk.rp.OIDCClientMetadatapopulateMetadata(SPSSODescriptor roleDescriptor, Iterable<Credential> credentials, String clientId)Populates theOIDCClientMetadatausing the values found from the givenSPSSODescriptor, the set ofCredentials and the client ID.voidprocess(XMLObject metadataNode)protected Iterable<Credential>resolveCredentials(SPSSODescriptor roleDescriptor)Get all the credentials attached to the givenSPSSODescriptor.
-
-
-
Field Detail
-
BINDING_ID_REDIRECT_URI
public static final String BINDING_ID_REDIRECT_URI
The ACS binding identifier matching to the redirect_uri.- See Also:
- Constant Field Values
-
log
private final org.slf4j.Logger log
Class logger.
-
keyInfoCredentialResolver
@Nonnull private final KeyInfoCredentialResolver keyInfoCredentialResolver
TheKeyInfoCredentialResolverto be used for the resolution.
-
-
Constructor Detail
-
ClientInformationNodeProcessor
public ClientInformationNodeProcessor(@Nonnull List<KeyInfoProvider> keyInfoProviders)Constructor.- Parameters:
keyInfoProviders- The list of key info providers.
-
-
Method Detail
-
process
public void process(@Nullable XMLObject metadataNode) throws FilterException- Specified by:
processin interfaceMetadataNodeProcessor- Throws:
FilterException
-
parseClientID
@Nullable protected com.nimbusds.oauth2.sdk.id.ClientID parseClientID(@Nonnull SPSSODescriptor roleDescriptor)Converts the entityID of the givenSPSSODescriptorinto aClientID. The value is fetched from theEntityDescriptor, expected to be the parent element of the given role decriptor.- Parameters:
roleDescriptor- TheSPSSODescriptorto be used as a source.- Returns:
- The entityID value as
ClientID.
-
parseClientSecret
@Nullable protected com.nimbusds.oauth2.sdk.auth.Secret parseClientSecret(@Nonnull Iterable<Credential> credentials)Fetches the client secret from given the set ofCredentials. The first credential matching the typeNimbusSecretCredentialis used as the source.- Parameters:
credentials- The source set ofCredentials.- Returns:
- The client secret as
Secret.
-
populateMetadata
@Nonnull protected com.nimbusds.openid.connect.sdk.rp.OIDCClientMetadata populateMetadata(@Nonnull SPSSODescriptor roleDescriptor, @Nonnull Iterable<Credential> credentials, @Nonnull String clientId)Populates theOIDCClientMetadatausing the values found from the givenSPSSODescriptor, the set ofCredentials and the client ID.- Parameters:
roleDescriptor- TheSPSSODescriptorto be used as a source.credentials- The source set ofCredentials to be used for client secret and remote/local JWKS.clientId- The client ID.- Returns:
- The
OIDCClientMetadataparsed from the given parameters.
-
getOAuthRPExtensions
@Nullable protected OAuthRPExtensions getOAuthRPExtensions(SPSSODescriptor roleDescriptor)
Get theOAuthRPExtensionsfrom the givenSPSSODescriptor, it it was found from its extensions.- Parameters:
roleDescriptor- The role descriptor to get the extensions from.- Returns:
- The extensions, if they were found from the role descriptor.
nullotherwise.
-
resolveCredentials
@Nonnull protected Iterable<Credential> resolveCredentials(SPSSODescriptor roleDescriptor)
Get all the credentials attached to the givenSPSSODescriptor. They are resolved using thekeyInfoCredentialResolver.- Parameters:
roleDescriptor- The role descriptor to parse the credentials from.- Returns:
- All the resolved credentials. Or empty set if none was found.
-
parseJwkSet
@Nullable protected com.nimbusds.jose.jwk.JWKSet parseJwkSet(@Nonnull Iterable<Credential> credentials, @Nonnull String clientId)Convert the given credentials into the NimbusJWKSet.- Parameters:
credentials- The set to be converted.clientId- The client ID related to the credentials.- Returns:
- The given credentials converted into a JWKSet.
-
getFromExtensions
@Nonnull protected List<MetadataValueSAMLObject> getFromExtensions(@Nonnull Extensions extension, @Nonnull QName type)
Get all objects of the given type from the given extensions.- Parameters:
extension- The extensions to get the object from.type- The type of the objects to get.- Returns:
- The list of objects of the given type.
-
parseClientAuthenticationMethod
@Nullable protected com.nimbusds.oauth2.sdk.auth.ClientAuthenticationMethod parseClientAuthenticationMethod(@Nonnull OAuthRPExtensions extensions)Parse theClientAuthenticationMethodfrom the given extensions.- Parameters:
extensions- The extensions to parse from.- Returns:
- The client authentication method, or
nullit was not found.
-
parseApplicationType
@Nonnull protected com.nimbusds.openid.connect.sdk.rp.ApplicationType parseApplicationType(@Nonnull OAuthRPExtensions extensions)Parse theApplicationTypefrom the given extensions.- Parameters:
extensions- The extensions to parse from.- Returns:
ApplicationType.NATIVEif it was defined in the extensions,ApplicationType.WEBotherwise.
-
parseSubjectType
@Nonnull protected com.nimbusds.openid.connect.sdk.SubjectType parseSubjectType(@Nonnull SPSSODescriptor roleDescriptor)Parse theSubjectTypefrom the given role descriptor's name ID formats.- Parameters:
roleDescriptor- The role descriptor to parse from. Only the first nameID definition is taken into consideration.- Returns:
SubjectType.PAIRWISEifpairwisewas defined as the name ID format.SubjectType.PUBLICotherwise.
-
parseDefaultAcrValues
@Nonnull protected List<com.nimbusds.openid.connect.sdk.claims.ACR> parseDefaultAcrValues(@Nonnull OAuthRPExtensions extensions)
Parse the defaultACRvalues from the given extensions.- Parameters:
extensions- The extensions to parse from.- Returns:
- The list of ACR values that were found.
-
parseGrantTypes
@Nonnull protected Set<com.nimbusds.oauth2.sdk.GrantType> parseGrantTypes(@Nonnull OAuthRPExtensions extensions)
Parse theGrantTypes from the given extensions.- Parameters:
extensions- The extensions to parse from.- Returns:
- The set of grant types that were found.
-
parseResponseTypes
@Nonnull protected Set<com.nimbusds.oauth2.sdk.ResponseType> parseResponseTypes(@Nonnull OAuthRPExtensions extensions)
Parse theResponseTypes from the given extensions.- Parameters:
extensions- The extensions to parse from.- Returns:
- The set of response types that were found.
-
parseScope
@Nonnull protected com.nimbusds.oauth2.sdk.Scope parseScope(@Nonnull OAuthRPExtensions extensions)Parse theScopefrom the given extensions.- Parameters:
extensions- The extensions to parse from.- Returns:
- The scope that was found.
-
parseJweAlgorithm
@Nullable protected com.nimbusds.jose.JWEAlgorithm parseJweAlgorithm(@Nullable MetadataValueSAMLObject metadataValue)Parse theJWEAlgorithmfrom the given metadata value.- Parameters:
metadataValue- The metadata value to parse from.- Returns:
- The JWE algorithm, or
nullif no value was found.
-
parseJwsAlgorithm
@Nullable protected com.nimbusds.jose.JWSAlgorithm parseJwsAlgorithm(@Nullable MetadataValueSAMLObject metadataValue)Parse theJWSAlgorithmfrom the given metadata value.- Parameters:
metadataValue- The metadata value to parse from.- Returns:
- The JWS algorithm, or
nullif no value was found.
-
parseEncryptionMethod
@Nullable protected com.nimbusds.jose.EncryptionMethod parseEncryptionMethod(@Nullable MetadataValueSAMLObject metadataValue)Parse theEncryptionMethodfrom the given metadata value.- Parameters:
metadataValue- The metadata value to parse from.- Returns:
- The encryption method, or
nullif no value was found.
-
parseRedirectUris
@Nonnull protected Set<URI> parseRedirectUris(@Nonnull SPSSODescriptor roleDescriptor)
Parse the redirection URIs from the given role descriptor. Only the assertion consumer service URLs whose binding matches toBINDING_ID_REDIRECT_URIare taken into consideration.- Parameters:
roleDescriptor- The role descriptor to parse from.- Returns:
- The set of redirection URIs that were successfully parsed.
-
parseUris
@Nonnull protected Set<URI> parseUris(@Nonnull List<? extends MetadataValueSAMLObject> listOfValues)
Parse the URIs from the given list of metadata values.- Parameters:
listOfValues- The list to parse from.- Returns:
- Set of URIs that were successfully parsed from the list.
-
getSingleValue
@Nullable protected String getSingleValue(@Nullable MetadataValueSAMLObject metadataValue)
Gets the trimmedStringvalue from the given metadata value object.- Parameters:
metadataValue- The object to get the value from.- Returns:
- The value as trimmed value, or
nullif no value was found.
-
getSingleURIValue
@Nullable protected URI getSingleURIValue(@Nonnull MetadataValueSAMLObject metadataValue)
Converts the metadata value object value into aURI.- Parameters:
metadataValue- The metadata object value to convert from.- Returns:
- The value as URI if it was successfully parsed,
nullotherwise.
-
-