Class CASDateTimeAttributeTranscoder
java.lang.Object
net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
net.shibboleth.idp.attribute.transcoding.AbstractAttributeTranscoder<Attribute>
net.shibboleth.idp.cas.attribute.AbstractCASAttributeTranscoder<DateTimeAttributeValue>
net.shibboleth.idp.cas.attribute.transcoding.impl.CASDateTimeAttributeTranscoder
- All Implemented Interfaces:
AttributeTranscoder<Attribute>
,CASAttributeTranscoder
,Component
,DestructableComponent
,InitializableComponent
public class CASDateTimeAttributeTranscoder
extends AbstractCASAttributeTranscoder<DateTimeAttributeValue>
-
Nested Class Summary
Nested classes/interfaces inherited from class net.shibboleth.idp.cas.attribute.AbstractCASAttributeTranscoder
AbstractCASAttributeTranscoder.NamingFunction
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final org.slf4j.Logger
Class logger.static final String
One of "ms" or "s", controlling the unit to use when converting to an epoch.Fields inherited from interface net.shibboleth.idp.cas.attribute.CASAttributeTranscoder
PROP_NAME
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
canEncodeValue
(IdPAttribute attribute, IdPAttributeValue value) Checks if the given value can be handled by the transcoder.protected IdPAttributeValue
decodeValue
(ProfileRequestContext profileRequestContext, Attribute attribute, TranscodingRule rule, String value) Function to decode a single string value into anIdPAttributeValue
.protected String
encodeValue
(ProfileRequestContext profileRequestContext, IdPAttribute attribute, TranscodingRule rule, DateTimeAttributeValue value) Encodes an attribute value into a string.protected Instant
getDateTimeValue
(TranscodingRule rule, Long value) Convert a long value into anInstant
.protected Instant
getDateTimeValue
(TranscodingRule rule, String value) Convert a string value into anInstant
.Methods inherited from class net.shibboleth.idp.cas.attribute.AbstractCASAttributeTranscoder
buildIdPAttribute, doDecode, doEncode, getEncodedName, 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
Methods inherited from interface net.shibboleth.idp.attribute.transcoding.AttributeTranscoder
decode, encode
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
PROP_EPOCH_UNITS
One of "ms" or "s", controlling the unit to use when converting to an epoch.- See Also:
-
log
@Nonnull private final org.slf4j.Logger logClass logger.
-
-
Constructor Details
-
CASDateTimeAttributeTranscoder
public CASDateTimeAttributeTranscoder()
-
-
Method Details
-
canEncodeValue
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.
- Specified by:
canEncodeValue
in classAbstractCASAttributeTranscoder<DateTimeAttributeValue>
- Parameters:
attribute
- 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 String encodeValue(@Nullable ProfileRequestContext profileRequestContext, @Nonnull IdPAttribute attribute, @Nonnull TranscodingRule rule, @Nonnull DateTimeAttributeValue value) throws AttributeEncodingException Encodes an attribute value into a string.- Specified by:
encodeValue
in classAbstractCASAttributeTranscoder<DateTimeAttributeValue>
- 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:
AttributeEncodingException
- thrown if there is a problem encoding the attribute value
-
decodeValue
@Nullable protected IdPAttributeValue decodeValue(@Nullable ProfileRequestContext profileRequestContext, @Nonnull Attribute attribute, @Nonnull TranscodingRule rule, @Nullable String value) Function to decode a single string value into anIdPAttributeValue
.- Specified by:
decodeValue
in classAbstractCASAttributeTranscoder<DateTimeAttributeValue>
- Parameters:
profileRequestContext
- current profile requestattribute
- the attribute being decodedrule
- properties to control decodingvalue
- the value to decode- Returns:
- the returned final
IdPAttributeValue
or null if decoding failed
-
getDateTimeValue
Convert a string value into anInstant
.- Parameters:
rule
- transcoding rulevalue
- input value- Returns:
- converted result or null
-
getDateTimeValue
Convert a long value into anInstant
.- Parameters:
rule
- transcoding rulevalue
- input value- Returns:
- converted result
-