Class AbstractAttributeTranscoder<T>
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- net.shibboleth.idp.attribute.transcoding.AbstractAttributeTranscoder<T>
-
- Type Parameters:
T- type of object supported
- All Implemented Interfaces:
AttributeTranscoder<T>,Component,DestructableComponent,InitializableComponent
- Direct Known Subclasses:
AbstractCASAttributeTranscoder,AbstractSAMLAttributeTranscoder
public abstract class AbstractAttributeTranscoder<T> extends AbstractInitializableComponent implements AttributeTranscoder<T>
Base class for transcoders.
-
-
Field Summary
Fields Modifier and Type Field Description private Predicate<ProfileRequestContext>activationConditionCondition for use of this transcoder.private org.slf4j.LoggerlogClass logger.
-
Constructor Summary
Constructors Constructor Description AbstractAttributeTranscoder()Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private booleancheckActivation(ProfileRequestContext profileRequestContext, TranscodingRule rule)Apply any activation rules to the request.IdPAttributedecode(ProfileRequestContext profileRequestContext, T input, TranscodingRule rule)Decode the supplied object into a protocol-neutral representation.protected abstract IdPAttributedoDecode(ProfileRequestContext profileRequestContext, T input, TranscodingRule rule)Decode the supplied object into a protocol-neutral representation.protected abstract TdoEncode(ProfileRequestContext profileRequestContext, IdPAttribute attribute, Class<? extends T> to, TranscodingRule rule)Encode the supplied attribute into a protocol specific representation.Tencode(ProfileRequestContext profileRequestContext, IdPAttribute attribute, Class<? extends T> to, TranscodingRule rule)Encode the supplied attribute into a protocol specific representation.voidsetActivationCondition(Predicate<ProfileRequestContext> condition)Set an activation condition for this transcoder.-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, doInitialize, initialize, isDestroyed, isInitialized
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.shibboleth.idp.attribute.transcoding.AttributeTranscoder
getEncodedName, getEncodedType
-
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
-
-
-
Field Detail
-
log
@Nonnull private final org.slf4j.Logger log
Class logger.
-
activationCondition
@Nonnull private Predicate<ProfileRequestContext> activationCondition
Condition for use of this transcoder.
-
-
Method Detail
-
setActivationCondition
public void setActivationCondition(@Nonnull Predicate<ProfileRequestContext> condition)Set an activation condition for this transcoder.- Parameters:
condition- condition to set
-
encode
@Nullable public T encode(@Nullable ProfileRequestContext profileRequestContext, @Nonnull IdPAttribute attribute, @Nonnull Class<? extends T> to, @Nonnull TranscodingRule rule) throws AttributeEncodingException
Encode the supplied attribute into a protocol specific representation.- Specified by:
encodein interfaceAttributeTranscoder<T>- Parameters:
profileRequestContext- current profile request contextattribute- the attribute to encodeto- specific type of object to encoderule- properties governing the encoding process, principally the resulting object's naming- Returns:
- the Object the attribute was encoded into
- Throws:
AttributeEncodingException- if unable to successfully encode attribute
-
decode
@Nullable public IdPAttribute decode(@Nullable ProfileRequestContext profileRequestContext, @Nonnull T input, @Nonnull TranscodingRule rule) throws AttributeDecodingException
Decode the supplied object into a protocol-neutral representation.- Specified by:
decodein interfaceAttributeTranscoder<T>- Parameters:
profileRequestContext- current profile request contextinput- the object to decoderule- properties governing the decoding process, principally the resulting attribute's naming- Returns:
- the attribute the object was decoded into
- Throws:
AttributeDecodingException- if unable to successfully decode object
-
doEncode
@Nullable protected abstract T doEncode(@Nullable ProfileRequestContext profileRequestContext, @Nonnull IdPAttribute attribute, @Nonnull Class<? extends T> to, @Nonnull TranscodingRule rule) throws AttributeEncodingException
Encode the supplied attribute into a protocol specific representation.- Parameters:
profileRequestContext- current profile request contextattribute- the attribute to encodeto- specific type of object to encoderule- properties governing the encoding process, principally the resulting object's naming- Returns:
- the Object the attribute was encoded into
- Throws:
AttributeEncodingException- if unable to successfully encode attribute
-
doDecode
@Nullable protected abstract IdPAttribute doDecode(@Nullable ProfileRequestContext profileRequestContext, @Nonnull T input, @Nonnull TranscodingRule rule) throws AttributeDecodingException
Decode the supplied object into a protocol-neutral representation.- Parameters:
profileRequestContext- current profile request contextinput- the object to decoderule- properties governing the decoding process, principally the resulting attribute's naming- Returns:
- the attribute the object was decoded into
- Throws:
AttributeDecodingException- if unable to successfully decode object
-
checkActivation
private boolean checkActivation(@Nullable ProfileRequestContext profileRequestContext, @Nonnull TranscodingRule rule)Apply any activation rules to the request.- Parameters:
profileRequestContext- current profile request contextrule- properties governing the transoding process- Returns:
- true iff the process should continue
-
-