Package net.shibboleth.idp.cas.attribute
Class AbstractCASAttributeTranscoder<EncodedType extends net.shibboleth.idp.attribute.IdPAttributeValue>
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- net.shibboleth.idp.attribute.transcoding.AbstractAttributeTranscoder<Attribute>
-
- net.shibboleth.idp.cas.attribute.AbstractCASAttributeTranscoder<EncodedType>
-
- Type Parameters:
EncodedType- the type of data that can be handled by the transcoder
- All Implemented Interfaces:
net.shibboleth.idp.attribute.transcoding.AttributeTranscoder<Attribute>,CASAttributeTranscoder,net.shibboleth.utilities.java.support.component.Component,net.shibboleth.utilities.java.support.component.DestructableComponent,net.shibboleth.utilities.java.support.component.InitializableComponent
public abstract class AbstractCASAttributeTranscoder<EncodedType extends net.shibboleth.idp.attribute.IdPAttributeValue> extends net.shibboleth.idp.attribute.transcoding.AbstractAttributeTranscoder<Attribute> implements CASAttributeTranscoder
Base class for transcoders that support CAS attributes.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractCASAttributeTranscoder.NamingFunctionA function to produce a "canonical" name for a CASAttributefor transcoding rules.
-
Field Summary
Fields Modifier and Type Field Description private org.slf4j.LoggerlogClass logger.-
Fields inherited from interface net.shibboleth.idp.cas.attribute.CASAttributeTranscoder
PROP_NAME
-
-
Constructor Summary
Constructors Constructor Description AbstractCASAttributeTranscoder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected net.shibboleth.idp.attribute.IdPAttributebuildIdPAttribute(org.opensaml.profile.context.ProfileRequestContext profileRequestContext, Attribute attribute, net.shibboleth.idp.attribute.transcoding.TranscodingRule rule, List<net.shibboleth.idp.attribute.IdPAttributeValue> attributeValues)Builds anIdPAttributefrom the given values.protected abstract booleancanEncodeValue(net.shibboleth.idp.attribute.IdPAttribute idpAttribute, net.shibboleth.idp.attribute.IdPAttributeValue value)Checks if the given value can be handled by the transcoder.protected abstract net.shibboleth.idp.attribute.IdPAttributeValuedecodeValue(org.opensaml.profile.context.ProfileRequestContext profileRequestContext, Attribute attribute, net.shibboleth.idp.attribute.transcoding.TranscodingRule rule, String value)Function to decode a single string value into anIdPAttributeValue.net.shibboleth.idp.attribute.IdPAttributedoDecode(org.opensaml.profile.context.ProfileRequestContext profileRequestContext, Attribute input, net.shibboleth.idp.attribute.transcoding.TranscodingRule rule)AttributedoEncode(org.opensaml.profile.context.ProfileRequestContext profileRequestContext, net.shibboleth.idp.attribute.IdPAttribute attribute, Class<? extends Attribute> to, net.shibboleth.idp.attribute.transcoding.TranscodingRule rule)protected abstract StringencodeValue(org.opensaml.profile.context.ProfileRequestContext profileRequestContext, net.shibboleth.idp.attribute.IdPAttribute attribute, net.shibboleth.idp.attribute.transcoding.TranscodingRule rule, EncodedType value)Encodes an attribute value into a string.StringgetEncodedName(net.shibboleth.idp.attribute.transcoding.TranscodingRule rule)Class<Attribute>getEncodedType()-
Methods inherited from class net.shibboleth.idp.attribute.transcoding.AbstractAttributeTranscoder
decode, encode, setActivationCondition
-
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
-
-
-
-
Method Detail
-
getEncodedType
@Nonnull public Class<Attribute> getEncodedType()
- Specified by:
getEncodedTypein interfacenet.shibboleth.idp.attribute.transcoding.AttributeTranscoder<EncodedType extends net.shibboleth.idp.attribute.IdPAttributeValue>
-
getEncodedName
@Nullable public String getEncodedName(@Nonnull net.shibboleth.idp.attribute.transcoding.TranscodingRule rule)
- Specified by:
getEncodedNamein interfacenet.shibboleth.idp.attribute.transcoding.AttributeTranscoder<EncodedType extends net.shibboleth.idp.attribute.IdPAttributeValue>
-
doEncode
@Nullable public Attribute doEncode(@Nullable org.opensaml.profile.context.ProfileRequestContext profileRequestContext, @Nonnull net.shibboleth.idp.attribute.IdPAttribute attribute, @Nonnull Class<? extends Attribute> to, @Nonnull net.shibboleth.idp.attribute.transcoding.TranscodingRule rule) throws net.shibboleth.idp.attribute.AttributeEncodingException
- Specified by:
doEncodein classnet.shibboleth.idp.attribute.transcoding.AbstractAttributeTranscoder<Attribute>- Throws:
net.shibboleth.idp.attribute.AttributeEncodingException
-
doDecode
@Nullable public net.shibboleth.idp.attribute.IdPAttribute doDecode(@Nullable org.opensaml.profile.context.ProfileRequestContext profileRequestContext, @Nonnull Attribute input, @Nonnull net.shibboleth.idp.attribute.transcoding.TranscodingRule rule) throws net.shibboleth.idp.attribute.AttributeDecodingException- Specified by:
doDecodein classnet.shibboleth.idp.attribute.transcoding.AbstractAttributeTranscoder<Attribute>- Throws:
net.shibboleth.idp.attribute.AttributeDecodingException
-
canEncodeValue
protected abstract boolean canEncodeValue(@Nonnull net.shibboleth.idp.attribute.IdPAttribute idpAttribute, @Nonnull net.shibboleth.idp.attribute.IdPAttributeValue value)Checks if the given value can be handled by the transcoder.In many cases this is simply a check to see if the given object is of the right type.
- Parameters:
idpAttribute- the attribute being encoded, never nullvalue- the value to check, never null- Returns:
- true if the transcoder can encode this value, false if not
-
encodeValue
@Nullable protected abstract String encodeValue(@Nullable org.opensaml.profile.context.ProfileRequestContext profileRequestContext, @Nonnull net.shibboleth.idp.attribute.IdPAttribute attribute, @Nonnull net.shibboleth.idp.attribute.transcoding.TranscodingRule rule, @Nonnull EncodedType value) throws net.shibboleth.idp.attribute.AttributeEncodingException
Encodes an attribute value into a string.- Parameters:
profileRequestContext- current profile requestattribute- the attribute being encodedrule- properties to control encodingvalue- the value to encode- Returns:
- the attribute value or null if the resulting attribute value would be empty
- Throws:
net.shibboleth.idp.attribute.AttributeEncodingException- thrown if there is a problem encoding the attribute value
-
buildIdPAttribute
@Nonnull protected net.shibboleth.idp.attribute.IdPAttribute buildIdPAttribute(@Nullable org.opensaml.profile.context.ProfileRequestContext profileRequestContext, @Nonnull Attribute attribute, @Nonnull net.shibboleth.idp.attribute.transcoding.TranscodingRule rule, @Nonnull @NonnullElements List<net.shibboleth.idp.attribute.IdPAttributeValue> attributeValues) throws net.shibboleth.idp.attribute.AttributeDecodingExceptionBuilds anIdPAttributefrom the given values.- Parameters:
profileRequestContext- current profile requestattribute- the attribute being decodedrule- properties to control decodingattributeValues- the decoded values for the attribute- Returns:
- the IdPAttribute object
- Throws:
net.shibboleth.idp.attribute.AttributeDecodingException- thrown if there is a problem constructing the IdPAttribute
-
decodeValue
@Nullable protected abstract net.shibboleth.idp.attribute.IdPAttributeValue decodeValue(@Nullable org.opensaml.profile.context.ProfileRequestContext profileRequestContext, @Nonnull Attribute attribute, @Nonnull net.shibboleth.idp.attribute.transcoding.TranscodingRule rule, @Nullable String value)Function to decode a single string value into anIdPAttributeValue.- Parameters:
profileRequestContext- current profile requestattribute- the attribute being decodedrule- properties to control decodingvalue- the value to decode- Returns:
- the returned final
IdPAttributeValueor null if decoding failed
-
-