Class MessageSourceConsentFunction
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.idp.consent.logic.impl.MessageSourceConsentFunction
- All Implemented Interfaces:
Function<ProfileRequestContext,,Map<String, Consent>> Component,DestructableComponent,InitializableComponent,Aware,MessageSourceAware
public class MessageSourceConsentFunction
extends AbstractInitializableComponent
implements Function<ProfileRequestContext,Map<String,Consent>>, MessageSourceAware
Function that returns a consent object whose id and value are resolved from a lookup function
and
MessageSource.
The lookup function's return value is a key, mapped via the MessageSource to an ID.
A suffix is attached to the ID to obtain the message key of the value.
-
Field Summary
FieldsModifier and TypeFieldDescriptionConsent flow descriptor lookup strategy.private Function<ProfileRequestContext,String> Lookup strategy for the consent message key to use.private StringMessage code suffix used to resolve the consent value.Function used to create a hash of the consent value.private Function<ProfileRequestContext,Locale> Locale lookup strategy.private MessageSourceMessageSource injected by Spring, typically the parent ApplicationContext itself. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply(ProfileRequestContext input) protected voidprotected StringgetConsentId(ProfileRequestContext profileRequestContext, Locale locale) Get the consent id.protected StringgetConsentValue(String consentId, Locale locale) Get the consent value.protected StringgetConsentValueHash(String consentId, Locale locale) Get the consent value hash.Get the hash function.(package private) LocalegetLocale(ProfileRequestContext profileRequestContext) Get the locale.protected booleanisCompareValues(ProfileRequestContext profileRequestContext) Whether consent equality includes comparing consent values.voidsetConsentFlowDescriptorLookupStrategy(Function<ProfileRequestContext, ConsentFlowDescriptor> strategy) Set the consent flow descriptor lookup strategy.voidSet the lookup strategy for the consent message key.voidSet the consent value message code suffix.voidsetHashFunction(Function<String, String> function) Set the hash function.voidSet the locale lookup strategy.voidsetMessageSource(MessageSource source) Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException, initialize, isDestroyed, isInitialized
-
Field Details
-
consentKeyLookupStrategy
Lookup strategy for the consent message key to use. -
consentValueMessageCodeSuffix
Message code suffix used to resolve the consent value. -
consentFlowDescriptorLookupStrategy
@Nonnull private Function<ProfileRequestContext,ConsentFlowDescriptor> consentFlowDescriptorLookupStrategyConsent flow descriptor lookup strategy. -
hashFunction
Function used to create a hash of the consent value. -
localeLookupStrategy
Locale lookup strategy. -
messageSource
MessageSource injected by Spring, typically the parent ApplicationContext itself.
-
-
Constructor Details
-
MessageSourceConsentFunction
public MessageSourceConsentFunction()Constructor.
-
-
Method Details
-
setMessageSource
- Specified by:
setMessageSourcein interfaceMessageSourceAware
-
setConsentKeyLookupStrategy
Set the lookup strategy for the consent message key.- Parameters:
strategy- lookup strategy
-
setConsentValueMessageCodeSuffix
Set the consent value message code suffix.- Parameters:
suffix- suffix of message code for the consent value
-
setConsentFlowDescriptorLookupStrategy
public void setConsentFlowDescriptorLookupStrategy(@Nonnull Function<ProfileRequestContext, ConsentFlowDescriptor> strategy) Set the consent flow descriptor lookup strategy.- Parameters:
strategy- consent flow descriptor lookup strategy
-
getHashFunction
Get the hash function.- Returns:
- hash function
- Since:
- 4.1.0
-
setHashFunction
Set the hash function.- Parameters:
function- hash function
-
setLocaleLookupStrategy
Set the locale lookup strategy.- Parameters:
strategy- The localeLookupStrategy to set.
-
doInitialize
- Overrides:
doInitializein classAbstractInitializableComponent- Throws:
ComponentInitializationException
-
apply
@Nullable @Unmodifiable @NotLive public Map<String,Consent> apply(@Nullable ProfileRequestContext input) -
getConsentId
@Nullable protected String getConsentId(@Nonnull ProfileRequestContext profileRequestContext, @Nonnull Locale locale) Get the consent id.- Parameters:
profileRequestContext- profile request contextlocale- locale to use- Returns:
- consent id
-
getConsentValue
@Nullable protected String getConsentValue(@Nonnull @NotEmpty String consentId, @Nonnull Locale locale) Get the consent value.- Parameters:
consentId- consent IDlocale- locale to use- Returns:
- consent value
-
getConsentValueHash
@Nullable protected String getConsentValueHash(@Nonnull @NotEmpty String consentId, @Nonnull Locale locale) Get the consent value hash.- Parameters:
consentId- consent IDlocale- locale to use- Returns:
- consent value hash
-
getLocale
Get the locale.- Parameters:
profileRequestContext- profile request context- Returns:
- locale
-
isCompareValues
Whether consent equality includes comparing consent values.- Parameters:
profileRequestContext- profile request context- Returns:
- true if consent equality includes comparing consent values
-