Class AbstractRoleAssignmentDeserializer<T>

java.lang.Object
com.fasterxml.jackson.databind.JsonDeserializer<T>
com.fasterxml.jackson.databind.deser.std.StdDeserializer<T>
com.okta.sdk.impl.deserializer.AbstractRoleAssignmentDeserializer<T>
Type Parameters:
T - The response type being deserialized
All Implemented Interfaces:
com.fasterxml.jackson.databind.deser.NullValueProvider, com.fasterxml.jackson.databind.deser.ValueInstantiator.Gettable, Serializable
Direct Known Subclasses:
AssignRoleToClientResponseDeserializer, AssignRoleToGroupResponseDeserializer, AssignRoleToUserResponseDeserializer, RoleAssignmentDeserializer

public abstract class AbstractRoleAssignmentDeserializer<T> extends com.fasterxml.jackson.databind.deser.std.StdDeserializer<T>
Abstract base class for role assignment deserializers.

This class provides common deserialization logic for role assignment responses from the Okta API. The API uses the 'type' field as a discriminator for role assignments, but since generated classes don't extend the response types, Jackson's default polymorphic deserialization fails.

Security Note: This deserializer uses reflection to set read-only fields that don't have public setters. Field names are validated against a whitelist to prevent arbitrary field access from potentially malicious JSON input.

See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonDeserializer

    com.fasterxml.jackson.databind.JsonDeserializer.None
  • Field Summary

    Fields inherited from class com.fasterxml.jackson.databind.deser.std.StdDeserializer

    _valueClass, _valueType, F_MASK_ACCEPT_ARRAYS, F_MASK_INT_COERCIONS
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected abstract T
    Creates a new instance of the response type.
    deserialize(com.fasterxml.jackson.core.JsonParser jp, com.fasterxml.jackson.databind.DeserializationContext ctxt)
     
    protected boolean
    hasNonNullValue(com.fasterxml.jackson.databind.JsonNode node, String fieldName)
    Checks if a JSON node has a non-null value for the given field name.
    protected abstract void
    setAssignmentType(T response, RoleAssignmentType assignmentType)
    Sets the assignment type on the response object.
    protected abstract void
    setEmbedded(T response, StandardRoleEmbedded embedded)
    Sets the embedded object on the response.
    protected void
    setFieldValueSafe(Object target, String fieldName, Object value, com.fasterxml.jackson.databind.DeserializationContext ctxt)
    Sets a field value using reflection with security validation and caching.
    protected abstract void
    Sets the links object on the response.
    protected abstract void
    setStatus(T response, LifecycleStatus status)
    Sets the status on the response object.
    protected abstract void
    setType(T response, RoleType type)
    Sets the role type on the response object.

    Methods inherited from class com.fasterxml.jackson.databind.deser.std.StdDeserializer

    _byteOverflow, _checkBooleanToStringCoercion, _checkCoercionFail, _checkDoubleSpecialValue, _checkFloatSpecialValue, _checkFloatToIntCoercion, _checkFloatToStringCoercion, _checkFromStringCoercion, _checkFromStringCoercion, _checkIntToFloatCoercion, _checkIntToStringCoercion, _checkTextualNull, _checkToStringCoercion, _coerceBooleanFromInt, _coercedTypeDesc, _coercedTypeDesc, _coerceEmptyString, _coerceIntegral, _coerceNullToken, _coerceTextualNull, _deserializeFromArray, _deserializeFromEmpty, _deserializeFromEmptyString, _deserializeFromString, _deserializeWrappedValue, _failDoubleToIntCoercion, _findCoercionFromBlankString, _findCoercionFromEmptyArray, _findCoercionFromEmptyString, _findNullProvider, _hasTextualNull, _intOverflow, _isBlank, _isEmptyOrTextualNull, _isFalse, _isIntNumber, _isNaN, _isNegInf, _isPosInf, _isTrue, _neitherNull, _nonNullNumber, _parseBoolean, _parseBooleanFromInt, _parseBooleanPrimitive, _parseBooleanPrimitive, _parseBytePrimitive, _parseDate, _parseDate, _parseDateFromArray, _parseDouble, _parseDouble, _parseDoublePrimitive, _parseDoublePrimitive, _parseDoublePrimitive, _parseFloatPrimitive, _parseFloatPrimitive, _parseFloatPrimitive, _parseInteger, _parseInteger, _parseIntPrimitive, _parseIntPrimitive, _parseLong, _parseLong, _parseLongPrimitive, _parseLongPrimitive, _parseShortPrimitive, _parseString, _parseString, _reportFailedNullCoerce, _shortOverflow, _verifyEndArrayForSingle, _verifyNullForPrimitive, _verifyNullForPrimitiveCoercion, _verifyNullForScalarCoercion, _verifyNumberForScalarCoercion, _verifyStringForScalarCoercion, deserializeWithType, findContentNullProvider, findContentNullStyle, findConvertingContentDeserializer, findDeserializer, findFormatFeature, findFormatOverrides, findValueNullProvider, getValueClass, getValueInstantiator, getValueType, getValueType, handledType, handleMissingEndArrayForSingle, handleNestedArrayForSingle, handleUnknownProperty, isDefaultDeserializer, isDefaultKeyDeserializer

    Methods inherited from class com.fasterxml.jackson.databind.JsonDeserializer

    deserialize, deserializeWithType, findBackReference, getAbsentValue, getDelegatee, getEmptyAccessPattern, getEmptyValue, getEmptyValue, getKnownPropertyNames, getNullAccessPattern, getNullValue, getNullValue, getObjectIdReader, isCachable, logicalType, replaceDelegatee, supportsUpdate, unwrappingDeserializer

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractRoleAssignmentDeserializer

      protected AbstractRoleAssignmentDeserializer(Class<?> vc)
  • Method Details

    • createInstance

      protected abstract T createInstance()
      Creates a new instance of the response type.
      Returns:
      A new instance of type T
    • setAssignmentType

      protected abstract void setAssignmentType(T response, RoleAssignmentType assignmentType)
      Sets the assignment type on the response object.
      Parameters:
      response - The response object
      assignmentType - The assignment type to set
    • setStatus

      protected abstract void setStatus(T response, LifecycleStatus status)
      Sets the status on the response object.
      Parameters:
      response - The response object
      status - The lifecycle status to set
    • setType

      protected abstract void setType(T response, RoleType type)
      Sets the role type on the response object.
      Parameters:
      response - The response object
      type - The role type to set
    • setEmbedded

      protected abstract void setEmbedded(T response, StandardRoleEmbedded embedded)
      Sets the embedded object on the response.
      Parameters:
      response - The response object
      embedded - The embedded object to set
    • setLinks

      protected abstract void setLinks(T response, LinksCustomRoleResponse links)
      Sets the links object on the response.
      Parameters:
      response - The response object
      links - The links object to set
    • deserialize

      public T deserialize(com.fasterxml.jackson.core.JsonParser jp, com.fasterxml.jackson.databind.DeserializationContext ctxt) throws IOException
      Specified by:
      deserialize in class com.fasterxml.jackson.databind.JsonDeserializer<T>
      Throws:
      IOException
    • hasNonNullValue

      protected boolean hasNonNullValue(com.fasterxml.jackson.databind.JsonNode node, String fieldName)
      Checks if a JSON node has a non-null value for the given field name.
      Parameters:
      node - The JSON node to check
      fieldName - The field name to look for
      Returns:
      true if the field exists and is not null
    • setFieldValueSafe

      protected void setFieldValueSafe(Object target, String fieldName, Object value, com.fasterxml.jackson.databind.DeserializationContext ctxt) throws com.fasterxml.jackson.databind.JsonMappingException
      Sets a field value using reflection with security validation and caching.

      Security Note: This method validates field names against a whitelist to prevent arbitrary field access from malicious JSON input.

      Parameters:
      target - The object to set the field on
      fieldName - The name of the field to set
      value - The value to set
      ctxt - The deserialization context for error reporting
      Throws:
      com.fasterxml.jackson.databind.JsonMappingException - if the field is not allowed or cannot be set