Class MessageSourceConsentFunction
java.lang.Object
net.shibboleth.utilities.java.support.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 String
Message 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 MessageSource
MessageSource injected by Spring, typically the parent ApplicationContext itself. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionapply
(ProfileRequestContext input) protected void
protected String
getConsentId
(ProfileRequestContext profileRequestContext, Locale locale) Get the consent id.protected String
getConsentValue
(String consentId, Locale locale) Get the consent value.protected String
getConsentValueHash
(String consentId, Locale locale) Get the consent value hash.Get the hash function.protected Locale
getLocale
(ProfileRequestContext profileRequestContext) Get the locale.protected boolean
isCompareValues
(ProfileRequestContext profileRequestContext) Whether consent equality includes comparing consent values.void
setConsentFlowDescriptorLookupStrategy
(Function<ProfileRequestContext, ConsentFlowDescriptor> strategy) Set the consent flow descriptor lookup strategy.void
Set the lookup strategy for the consent message key.void
Set the consent value message code suffix.void
setHashFunction
(Function<String, String> function) Set the hash function.void
Set the locale lookup strategy.void
setMessageSource
(MessageSource source) Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, 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:
setMessageSource
in 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:
doInitialize
in classAbstractInitializableComponent
- Throws:
ComponentInitializationException
-
apply
-
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
-