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 Collection<String>getListValues(String metadataValue)Parse an XML value list from a metadata value object into a collection of strings.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 com.nimbusds.openid.connect.sdk.rp.ApplicationTypeparseApplicationType(OAuthRPExtensions extensions)Parse theApplicationTypefrom the given extensions.protected List<String>parseAudiences(OAuthRPExtensions extensions)Parse the SAML Audience elements.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(String value)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(String value)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 URIparseJwkUri(Iterable<Credential> credentials, String clientId)Convert the given credentials into a JWKS URI.protected com.nimbusds.jose.JWSAlgorithmparseJwsAlgorithm(String value)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.ScopeparseScopes(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(@Nonnull 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(@Nonnull 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.
-
parseJwkUri
@Nullable protected URI parseJwkUri(@Nonnull Iterable<Credential> credentials, @Nonnull String clientId)
Convert the given credentials into a JWKS URI.- Parameters:
credentials- The set to be converted.clientId- The client ID related to the credentials.- Returns:
- The given credentials converted into a JWKS URI
-
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.
-
parseScopes
@Nonnull protected com.nimbusds.oauth2.sdk.Scope parseScopes(@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 String value)Parse theJWEAlgorithmfrom the given metadata value.- Parameters:
value- 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 String value)Parse theJWSAlgorithmfrom the given metadata value.- Parameters:
value- 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 String value)Parse theEncryptionMethodfrom the given metadata value.- Parameters:
value- 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.
-
parseAudiences
@Nullable @NonnullElements protected List<String> parseAudiences(@Nonnull OAuthRPExtensions extensions)
Parse the SAML Audience elements.- Parameters:
extensions- extension container- Returns:
- audience collection or null
-
getListValues
@Nonnull @NonnullElements protected Collection<String> getListValues(@Nullable String metadataValue)
Parse an XML value list from a metadata value object into a collection of strings.- Parameters:
metadataValue- input object- Returns:
- possibly empty value collection
-
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.
-
-