Class SAML2DateTimeAttributeTranscoder
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- net.shibboleth.idp.attribute.transcoding.AbstractAttributeTranscoder<AttributeType>
-
- net.shibboleth.idp.saml.attribute.transcoding.AbstractSAMLAttributeTranscoder<Attribute,EncodedType>
-
- net.shibboleth.idp.saml.attribute.transcoding.AbstractSAML2AttributeTranscoder<DateTimeAttributeValue>
-
- net.shibboleth.idp.saml.attribute.transcoding.impl.SAML2DateTimeAttributeTranscoder
-
- All Implemented Interfaces:
AttributeTranscoder<Attribute>,SAML2AttributeTranscoder<DateTimeAttributeValue>,Component,DestructableComponent,InitializableComponent
public class SAML2DateTimeAttributeTranscoder extends AbstractSAML2AttributeTranscoder<DateTimeAttributeValue>
- Since:
- 4.3.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.shibboleth.idp.saml.attribute.transcoding.AbstractSAML2AttributeTranscoder
AbstractSAML2AttributeTranscoder.NamingFunction
-
-
Field Summary
Fields Modifier and Type Field Description private org.slf4j.LoggerlogClass logger.static StringPROP_EPOCH_UNITSOne of "ms" or "s", controlling the unit to use when converting to an epoch.-
Fields inherited from interface net.shibboleth.idp.saml.attribute.transcoding.SAML2AttributeTranscoder
PROP_ENCODE_TYPE, PROP_FRIENDLY_NAME, PROP_NAME, PROP_NAME_FORMAT
-
-
Constructor Summary
Constructors Constructor Description SAML2DateTimeAttributeTranscoder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanEncodeValue(IdPAttribute attribute, IdPAttributeValue value)Checks if the given value can be handled by the transcoder.protected IdPAttributeValuedecodeValue(ProfileRequestContext profileRequestContext, Attribute attribute, TranscodingRule rule, XMLObject value)Function to decode a singleXMLObjectinto anIdPAttributeValue.protected XMLObjectencodeValue(ProfileRequestContext profileRequestContext, IdPAttribute attribute, TranscodingRule rule, DateTimeAttributeValue value)Encodes an attribute value into a SAML AttributeValue element.protected InstantgetDateTimeValue(TranscodingRule rule, Long value)Convert a long value into anInstant.protected InstantgetDateTimeValue(TranscodingRule rule, String value)Convert a string value into anInstant.protected InstantgetDateTimeValue(TranscodingRule rule, XMLObject object)Function to return an XML object in date/time form.-
Methods inherited from class net.shibboleth.idp.saml.attribute.transcoding.AbstractSAML2AttributeTranscoder
buildAttribute, buildIdPAttribute, getEncodedName, getEncodedType, getValues
-
Methods inherited from class net.shibboleth.idp.saml.attribute.transcoding.AbstractSAMLAttributeTranscoder
doDecode, doEncode, getStringValue
-
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 Detail
-
PROP_EPOCH_UNITS
@Nonnull @NotEmpty public static final String PROP_EPOCH_UNITS
One of "ms" or "s", controlling the unit to use when converting to an epoch.- See Also:
- Constant Field Values
-
log
@Nonnull private final org.slf4j.Logger log
Class logger.
-
-
Method Detail
-
canEncodeValue
protected boolean canEncodeValue(@Nonnull IdPAttribute attribute, @Nonnull 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.
- Specified by:
canEncodeValuein classAbstractSAMLAttributeTranscoder<Attribute,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 XMLObject encodeValue(@Nullable ProfileRequestContext profileRequestContext, @Nonnull IdPAttribute attribute, @Nonnull TranscodingRule rule, @Nonnull DateTimeAttributeValue value) throws AttributeEncodingException
Encodes an attribute value into a SAML AttributeValue element.- Specified by:
encodeValuein classAbstractSAMLAttributeTranscoder<Attribute,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 XMLObject value)
Function to decode a singleXMLObjectinto anIdPAttributeValue.- Specified by:
decodeValuein classAbstractSAMLAttributeTranscoder<Attribute,DateTimeAttributeValue>- 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
-
getDateTimeValue
@Nullable protected Instant getDateTimeValue(@Nonnull TranscodingRule rule, @Nonnull XMLObject object)
Function to return an XML object in date/time form.- Parameters:
rule- transcoding ruleobject- object to decode- Returns:
- decoded date/time, or null
-
getDateTimeValue
@Nullable protected Instant getDateTimeValue(@Nonnull TranscodingRule rule, @Nullable String value)
Convert a string value into anInstant.- Parameters:
rule- transcoding rulevalue- input value- Returns:
- converted result or null
-
getDateTimeValue
@Nullable protected Instant getDateTimeValue(@Nonnull TranscodingRule rule, @Nonnull Long value)
Convert a long value into anInstant.- Parameters:
rule- transcoding rulevalue- input value- Returns:
- converted result
-
-