Class MessageSourceConsentFunction
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- net.shibboleth.idp.consent.logic.impl.MessageSourceConsentFunction
-
- All Implemented Interfaces:
Function<org.opensaml.profile.context.ProfileRequestContext,Map<String,net.shibboleth.idp.consent.Consent>>,net.shibboleth.utilities.java.support.component.Component,net.shibboleth.utilities.java.support.component.DestructableComponent,net.shibboleth.utilities.java.support.component.InitializableComponent,Aware,MessageSourceAware
public class MessageSourceConsentFunction extends net.shibboleth.utilities.java.support.component.AbstractInitializableComponent implements Function<org.opensaml.profile.context.ProfileRequestContext,Map<String,net.shibboleth.idp.consent.Consent>>, MessageSourceAware
Function that returns a consent object whose id and value are resolved from a lookup function andMessageSource.The lookup function's return value is a master key, mapped via the
MessageSourceto an ID. A suffix is attached to the ID to obtain the message key of the value.
-
-
Field Summary
Fields Modifier and Type Field Description private Function<org.opensaml.profile.context.ProfileRequestContext,ConsentFlowDescriptor>consentFlowDescriptorLookupStrategyConsent flow descriptor lookup strategy.private Function<org.opensaml.profile.context.ProfileRequestContext,String>consentKeyLookupStrategyLookup strategy for the consent message key to use.private StringconsentValueMessageCodeSuffixMessage code suffix used to resolve the consent value.private Function<String,String>hashFunctionFunction used to create a hash of the consent value.private Function<org.opensaml.profile.context.ProfileRequestContext,Locale>localeLookupStrategyLocale lookup strategy.private MessageSourcemessageSourceMessageSource injected by Spring, typically the parent ApplicationContext itself.
-
Constructor Summary
Constructors Constructor Description MessageSourceConsentFunction()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,net.shibboleth.idp.consent.Consent>apply(org.opensaml.profile.context.ProfileRequestContext input)protected StringgetConsentId(org.opensaml.profile.context.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.protected LocalegetLocale(org.opensaml.profile.context.ProfileRequestContext profileRequestContext)Get the locale.protected booleanisCompareValues(org.opensaml.profile.context.ProfileRequestContext profileRequestContext)Whether consent equality includes comparing consent values.voidsetConsentFlowDescriptorLookupStrategy(Function<org.opensaml.profile.context.ProfileRequestContext,ConsentFlowDescriptor> strategy)Set the consent flow descriptor lookup strategy.voidsetConsentKeyLookupStrategy(Function<org.opensaml.profile.context.ProfileRequestContext,String> strategy)Set the lookup strategy for the consent message key.voidsetConsentValueMessageCodeSuffix(String suffix)Set the consent value message code suffix.voidsetHashFunction(Function<String,String> function)Set the hash function.voidsetLocaleLookupStrategy(Function<org.opensaml.profile.context.ProfileRequestContext,Locale> strategy)Set the locale lookup strategy.voidsetMessageSource(MessageSource source)-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, doInitialize, initialize, isDestroyed, isInitialized
-
-
-
-
Field Detail
-
consentKeyLookupStrategy
@Nonnull private Function<org.opensaml.profile.context.ProfileRequestContext,String> consentKeyLookupStrategy
Lookup strategy for the consent message key to use.
-
consentValueMessageCodeSuffix
@Nonnull @NotEmpty private String consentValueMessageCodeSuffix
Message code suffix used to resolve the consent value.
-
consentFlowDescriptorLookupStrategy
@Nonnull private Function<org.opensaml.profile.context.ProfileRequestContext,ConsentFlowDescriptor> consentFlowDescriptorLookupStrategy
Consent flow descriptor lookup strategy.
-
hashFunction
@Nonnull private Function<String,String> hashFunction
Function used to create a hash of the consent value.
-
localeLookupStrategy
@Nonnull private Function<org.opensaml.profile.context.ProfileRequestContext,Locale> localeLookupStrategy
Locale lookup strategy.
-
messageSource
@Nonnull private MessageSource messageSource
MessageSource injected by Spring, typically the parent ApplicationContext itself.
-
-
Method Detail
-
setMessageSource
public void setMessageSource(MessageSource source)
- Specified by:
setMessageSourcein interfaceMessageSourceAware
-
setConsentKeyLookupStrategy
public void setConsentKeyLookupStrategy(@Nonnull Function<org.opensaml.profile.context.ProfileRequestContext,String> strategy)Set the lookup strategy for the consent message key.- Parameters:
strategy- lookup strategy
-
setConsentValueMessageCodeSuffix
public void setConsentValueMessageCodeSuffix(@Nonnull @NotEmpty String suffix)Set the consent value message code suffix.- Parameters:
suffix- suffix of message code for the consent value
-
setConsentFlowDescriptorLookupStrategy
public void setConsentFlowDescriptorLookupStrategy(@Nonnull Function<org.opensaml.profile.context.ProfileRequestContext,ConsentFlowDescriptor> strategy)Set the consent flow descriptor lookup strategy.- Parameters:
strategy- consent flow descriptor lookup strategy
-
setHashFunction
public void setHashFunction(@Nonnull Function<String,String> function)Set the hash function.- Parameters:
function- hash function
-
setLocaleLookupStrategy
public void setLocaleLookupStrategy(@Nonnull Function<org.opensaml.profile.context.ProfileRequestContext,Locale> strategy)Set the locale lookup strategy.- Parameters:
strategy- The localeLookupStrategy to set.
-
apply
@Nullable public Map<String,net.shibboleth.idp.consent.Consent> apply(@Nullable org.opensaml.profile.context.ProfileRequestContext input)
-
getConsentId
@Nullable protected String getConsentId(@Nonnull org.opensaml.profile.context.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
@Nullable protected Locale getLocale(@Nonnull org.opensaml.profile.context.ProfileRequestContext profileRequestContext)
Get the locale.- Parameters:
profileRequestContext- profile request context- Returns:
- locale
-
isCompareValues
protected boolean isCompareValues(@Nonnull org.opensaml.profile.context.ProfileRequestContext profileRequestContext)Whether consent equality includes comparing consent values.- Parameters:
profileRequestContext- profile request context- Returns:
- true if consent equality includes comparing consent values
-
-