Class AbstractOIDCAttributeTranscoder

  • All Implemented Interfaces:
    net.shibboleth.idp.attribute.transcoding.AttributeTranscoder<net.minidev.json.JSONObject>, net.shibboleth.utilities.java.support.component.Component, net.shibboleth.utilities.java.support.component.DestructableComponent, net.shibboleth.utilities.java.support.component.InitializableComponent, OIDCAttributeTranscoder

    public abstract class AbstractOIDCAttributeTranscoder
    extends net.shibboleth.idp.attribute.transcoding.AbstractAttributeTranscoder<net.minidev.json.JSONObject>
    implements OIDCAttributeTranscoder
    Abstract class for OIDC attribute encoders.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected net.minidev.json.JSONObject buildClaim​(org.opensaml.profile.context.ProfileRequestContext profileRequestContext, net.shibboleth.idp.attribute.IdPAttribute attribute, net.shibboleth.idp.attribute.transcoding.TranscodingRule rule, Object claimValues)
      Builds an OIDC claim structure with the given values.
      protected net.shibboleth.idp.attribute.IdPAttribute buildIdPAttribute​(org.opensaml.profile.context.ProfileRequestContext profileRequestContext, net.minidev.json.JSONObject claim, net.shibboleth.idp.attribute.transcoding.TranscodingRule rule, List<net.shibboleth.idp.attribute.IdPAttributeValue> attributeValues)
      Builds an IdPAttribute from the given values.
      protected abstract List<net.shibboleth.idp.attribute.IdPAttributeValue> decodeValues​(org.opensaml.profile.context.ProfileRequestContext profileRequestContext, Object input, net.shibboleth.idp.attribute.transcoding.TranscodingRule rule)
      Subclasses should override this method to perform specific claim value decoding into IdPAttributeValue objects.
      net.shibboleth.idp.attribute.IdPAttribute doDecode​(org.opensaml.profile.context.ProfileRequestContext profileRequestContext, net.minidev.json.JSONObject input, net.shibboleth.idp.attribute.transcoding.TranscodingRule rule)
      net.minidev.json.JSONObject doEncode​(org.opensaml.profile.context.ProfileRequestContext profileRequestContext, net.shibboleth.idp.attribute.IdPAttribute attribute, Class<? extends net.minidev.json.JSONObject> to, net.shibboleth.idp.attribute.transcoding.TranscodingRule rule)
      protected abstract Object encodeValues​(org.opensaml.profile.context.ProfileRequestContext profileRequestContext, net.shibboleth.idp.attribute.IdPAttribute attribute, net.shibboleth.idp.attribute.transcoding.TranscodingRule rule)
      Performs encoding of IdPAttribute's values based on rule into a claim value.
      String getEncodedName​(net.shibboleth.idp.attribute.transcoding.TranscodingRule rule)
      Class<net.minidev.json.JSONObject> 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

      • AbstractOIDCAttributeTranscoder

        public AbstractOIDCAttributeTranscoder()
    • Method Detail

      • getEncodedType

        public Class<net.minidev.json.JSONObject> getEncodedType()
        Specified by:
        getEncodedType in interface net.shibboleth.idp.attribute.transcoding.AttributeTranscoder<net.minidev.json.JSONObject>
      • getEncodedName

        @Nullable
        public String getEncodedName​(@Nonnull
                                     net.shibboleth.idp.attribute.transcoding.TranscodingRule rule)
        Specified by:
        getEncodedName in interface net.shibboleth.idp.attribute.transcoding.AttributeTranscoder<net.minidev.json.JSONObject>
      • doEncode

        @Nullable
        public net.minidev.json.JSONObject doEncode​(@Nullable
                                                    org.opensaml.profile.context.ProfileRequestContext profileRequestContext,
                                                    @Nonnull
                                                    net.shibboleth.idp.attribute.IdPAttribute attribute,
                                                    @Nonnull
                                                    Class<? extends net.minidev.json.JSONObject> 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<net.minidev.json.JSONObject>
        Throws:
        net.shibboleth.idp.attribute.AttributeEncodingException
      • buildClaim

        @Nonnull
        protected net.minidev.json.JSONObject buildClaim​(@Nullable
                                                         org.opensaml.profile.context.ProfileRequestContext profileRequestContext,
                                                         @Nullable
                                                         net.shibboleth.idp.attribute.IdPAttribute attribute,
                                                         @Nonnull
                                                         net.shibboleth.idp.attribute.transcoding.TranscodingRule rule,
                                                         @Nonnull @NonnullElements
                                                         Object claimValues)
                                                  throws net.shibboleth.idp.attribute.AttributeEncodingException
        Builds an OIDC claim structure with the given values.
        Parameters:
        profileRequestContext - current profile request context
        attribute - the attribute being encoded
        rule - properties to control encoding
        claimValues - the encoded value(s) for the claim
        Returns:
        the OIDC claim (for the moment in the form of a single-valued JSON structure
        Throws:
        net.shibboleth.idp.attribute.AttributeEncodingException - if there's a problem constructing the claim
      • encodeValues

        @Nullable
        protected abstract Object encodeValues​(@Nullable
                                               org.opensaml.profile.context.ProfileRequestContext profileRequestContext,
                                               @Nonnull
                                               net.shibboleth.idp.attribute.IdPAttribute attribute,
                                               @Nonnull
                                               net.shibboleth.idp.attribute.transcoding.TranscodingRule rule)
                                        throws net.shibboleth.idp.attribute.AttributeEncodingException
        Performs encoding of IdPAttribute's values based on rule into a claim value.
        Parameters:
        profileRequestContext - current profile request
        attribute - the attribute being encoded
        rule - properties to control encoding
        Returns:
        Integer, Boolean, String, JSON Array or JSON Object value for claim
        Throws:
        net.shibboleth.idp.attribute.AttributeEncodingException - if there's a problem encoding the values
      • doDecode

        @Nullable
        public net.shibboleth.idp.attribute.IdPAttribute doDecode​(@Nullable
                                                                  org.opensaml.profile.context.ProfileRequestContext profileRequestContext,
                                                                  @Nonnull
                                                                  net.minidev.json.JSONObject 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<net.minidev.json.JSONObject>
        Throws:
        net.shibboleth.idp.attribute.AttributeDecodingException
      • buildIdPAttribute

        @Nonnull
        protected net.shibboleth.idp.attribute.IdPAttribute buildIdPAttribute​(@Nullable
                                                                              org.opensaml.profile.context.ProfileRequestContext profileRequestContext,
                                                                              @Nonnull
                                                                              net.minidev.json.JSONObject claim,
                                                                              @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
        claim - the claim being decoded
        rule - properties to control decoding
        attributeValues - the decoded values for the attribute
        Returns:
        the IdPAttribute object
        Throws:
        net.shibboleth.idp.attribute.AttributeDecodingException - if there's a problem constructing the IdPAttribute
      • decodeValues

        @Nonnull
        @NonnullElements
        protected abstract List<net.shibboleth.idp.attribute.IdPAttributeValue> decodeValues​(@Nullable
                                                                                             org.opensaml.profile.context.ProfileRequestContext profileRequestContext,
                                                                                             @Nonnull
                                                                                             Object input,
                                                                                             @Nonnull
                                                                                             net.shibboleth.idp.attribute.transcoding.TranscodingRule rule)
                                                                                      throws net.shibboleth.idp.attribute.AttributeDecodingException
        Subclasses should override this method to perform specific claim value decoding into IdPAttributeValue objects.
        Parameters:
        profileRequestContext - current profile request context
        input - the raw claim value
        rule - properties to control decoding
        Returns:
        a possibly empty list of decoded values
        Throws:
        net.shibboleth.idp.attribute.AttributeDecodingException - if there's a problem decoding the claim value