Package net.shibboleth.idp.authn.impl
Class AttributeSourcedSubjectCanonicalization
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.idp.authn.SubjectCanonicalizationFlowDescriptor
net.shibboleth.idp.authn.AbstractSubjectCanonicalizer
net.shibboleth.idp.authn.impl.AttributeSourcedSubjectCanonicalization
- All Implemented Interfaces:
Function<SubjectCanonicalizationContext,,String> Predicate<ProfileRequestContext>,SubjectCanonicalizer,FlowDescriptor,Component,DestructableComponent,IdentifiableComponent,IdentifiedComponent,InitializableComponent
A
SubjectCanonicalizer that resolves attributes and then extracts a resolved IdPAttribute value
from an AttributeContext child obtained via lookup function (by default a child of the
SubjectCanonicalizationContext), and uses it as the result of subject canonicalization.
String and scoped attribute values are supported.
- Since:
- 5.2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionOrdered list of attributes to look for and read from.private Collection<String>Attributes to resolve if explicit.private charDelimiter to use for scoped attribute serialization.private Function<ProfileRequestContext,String> Strategy used to locate the identity of the issuer associated with the attribute resolution.private final org.slf4j.LoggerClass logger.private Function<ProfileRequestContext,String> Strategy used to locate the principal name associated with the attribute resolution.private Function<ProfileRequestContext,String> Strategy used to locate the identity of the recipient associated with the attribute resolution.private Predicate<ProfileRequestContext>Condition controlling whether to run the attribute resolver.private booleanWhether to also (or instead) check the original Subject forIdPAttributePrincipals.private ReloadableService<AttributeResolver>Attribute resolver service. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringdoApply(SubjectCanonicalizationContext c14nContext) Performs c14n if possible.protected voidprivate Map<String,IdPAttribute> Extract and populate a map of any attributes found in the Subject.private StringfindValue(IdPAttribute attribute) Check for a compatible value in the input attribute.private Map<String,IdPAttribute> resolveAttributes(ProfileRequestContext profileRequestContext, SubjectCanonicalizationContext c14nContext) Perform attribute resolution inline.voidSet theAttributeResolverservice instance to use.voidsetAttributeSourceIds(List<String> ids) Set the attribute IDs to read from in order of preference.voidSet the attribute IDs to resolve.voidSet the strategy used to lookup the issuer for this attribute resolution.voidSet the strategy used to locate the principal name for this attribute resolution.voidSet the strategy used to lookup the recipient for this attribute resolution.voidsetResolutionCondition(Predicate<ProfileRequestContext> condition) Set a condition to evaluate to decide whether to resolve attributes.voidsetResolveFromSubject(boolean flag) Whether to include anyIdPAttributePrincipalobjects found in the inputSubjectwhen searching for a matching attribute ID.voidsetScopedDelimiter(char ch) Set the delimiter to use for serializing scoped attribute values.Methods inherited from class net.shibboleth.idp.authn.AbstractSubjectCanonicalizer
apply, applyTransforms, getLogPrefix, setLowercase, setTransforms, setTrim, setUppercaseMethods inherited from class net.shibboleth.idp.authn.SubjectCanonicalizationFlowDescriptor
equals, getFlowId, hashCode, setActivationCondition, setFlowId, test, toStringMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
setIdMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentExceptionMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.DestructableComponent
destroy, isDestroyedMethods inherited from interface net.shibboleth.shared.component.IdentifiableComponent
setIdMethods inherited from interface net.shibboleth.shared.component.IdentifiedComponent
getIdMethods inherited from interface net.shibboleth.shared.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
resolverService
Attribute resolver service. -
resolutionCondition
Condition controlling whether to run the attribute resolver. -
delimiter
private char delimiterDelimiter to use for scoped attribute serialization. -
resolveFromSubject
private boolean resolveFromSubjectWhether to also (or instead) check the original Subject forIdPAttributePrincipals. -
attributesToResolve
Attributes to resolve if explicit. -
attributeSourceIds
Ordered list of attributes to look for and read from. -
issuerLookupStrategy
Strategy used to locate the identity of the issuer associated with the attribute resolution. -
recipientLookupStrategy
Strategy used to locate the identity of the recipient associated with the attribute resolution. -
principalNameLookupStrategy
Strategy used to locate the principal name associated with the attribute resolution.
-
-
Constructor Details
-
AttributeSourcedSubjectCanonicalization
public AttributeSourcedSubjectCanonicalization()Constructor.
-
-
Method Details
-
setResolutionCondition
Set a condition to evaluate to decide whether to resolve attributes.Defaults to true.
- Parameters:
condition- condition to set
-
setScopedDelimiter
public void setScopedDelimiter(char ch) Set the delimiter to use for serializing scoped attribute values.Defaults to '@'.
- Parameters:
ch- delimiter to use
-
setResolveFromSubject
public void setResolveFromSubject(boolean flag) Whether to include anyIdPAttributePrincipalobjects found in the inputSubjectwhen searching for a matching attribute ID.Defaults to false.
- Parameters:
flag- flag to set
-
setAttributesToResolve
Set the attribute IDs to resolve.- Parameters:
ids- attribute IDs to resolve
-
setAttributeSourceIds
Set the attribute IDs to read from in order of preference.- Parameters:
ids- attribute IDs to read from
-
setIssuerLookupStrategy
Set the strategy used to lookup the issuer for this attribute resolution.- Parameters:
strategy- lookup strategy
-
setRecipientLookupStrategy
Set the strategy used to lookup the recipient for this attribute resolution.- Parameters:
strategy- lookup strategy
-
setPrincipalNameLookupStrategy
public void setPrincipalNameLookupStrategy(@Nullable Function<ProfileRequestContext, String> strategy) Set the strategy used to locate the principal name for this attribute resolution.- Parameters:
strategy- lookup strategy
-
doInitialize
- Overrides:
doInitializein classAbstractSubjectCanonicalizer- Throws:
ComponentInitializationException
-
doApply
Performs c14n if possible.- Specified by:
doApplyin classAbstractSubjectCanonicalizer- Parameters:
c14nContext- the current subject canonicalization context- Returns:
- event indicating result of function
-
extractSubjectSourcedAttributes
@Nonnull private Map<String,IdPAttribute> extractSubjectSourcedAttributes(@Nonnull SubjectCanonicalizationContext c14nContext) Extract and populate a map of any attributes found in the Subject.- Parameters:
c14nContext- source of Subject- Returns:
- possibly empty map
-
resolveAttributes
private Map<String,IdPAttribute> resolveAttributes(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull SubjectCanonicalizationContext c14nContext) Perform attribute resolution inline.- Parameters:
profileRequestContext- profile request contextc14nContext- subject c14n context- Returns:
- the resolved map of attributes
-
findValue
Check for a compatible value in the input attribute.- Parameters:
attribute- input attribute- Returns:
- value to use for result, or null