Class AbstractCASAttributeTranscoder<EncodedType extends net.shibboleth.idp.attribute.IdPAttributeValue>

  • 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.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private org.slf4j.Logger log
      Class logger.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected net.shibboleth.idp.attribute.IdPAttribute buildIdPAttribute​(org.opensaml.profile.context.ProfileRequestContext profileRequestContext, Attribute attribute, net.shibboleth.idp.attribute.transcoding.TranscodingRule rule, List<net.shibboleth.idp.attribute.IdPAttributeValue> attributeValues)
      Builds an IdPAttribute from the given values.
      protected abstract boolean canEncodeValue​(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.IdPAttributeValue decodeValue​(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 an IdPAttributeValue.
      net.shibboleth.idp.attribute.IdPAttribute doDecode​(org.opensaml.profile.context.ProfileRequestContext profileRequestContext, Attribute input, net.shibboleth.idp.attribute.transcoding.TranscodingRule rule)
      Attribute doEncode​(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 String encodeValue​(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.
      String getEncodedName​(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 interface net.shibboleth.idp.attribute.transcoding.AttributeTranscoder

        decode, encode
      • 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.
    • Constructor Detail

      • AbstractCASAttributeTranscoder

        public AbstractCASAttributeTranscoder()
    • Method Detail

      • getEncodedType

        @Nonnull
        public Class<Attribute> getEncodedType()
        Specified by:
        getEncodedType in interface net.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:
        getEncodedName in interface net.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:
        doEncode in class net.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:
        doDecode in class net.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 null
        value - 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 request
        attribute - the attribute being encoded
        rule - properties to control encoding
        value - 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.AttributeDecodingException
        Builds an IdPAttribute from the given values.
        Parameters:
        profileRequestContext - current profile request
        attribute - the attribute being decoded
        rule - properties to control decoding
        attributeValues - 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 an IdPAttributeValue.
        Parameters:
        profileRequestContext - current profile request
        attribute - the attribute being decoded
        rule - properties to control decoding
        value - the value to decode
        Returns:
        the returned final IdPAttributeValue or null if decoding failed