Package com.okta.sdk.impl.deserializer
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 -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract TCreates a new instance of the response type.deserialize(com.fasterxml.jackson.core.JsonParser jp, com.fasterxml.jackson.databind.DeserializationContext ctxt) protected booleanhasNonNullValue(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 voidsetAssignmentType(T response, RoleAssignmentType assignmentType) Sets the assignment type on the response object.protected abstract voidsetEmbedded(T response, StandardRoleEmbedded embedded) Sets the embedded object on the response.protected voidsetFieldValueSafe(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 voidsetLinks(T response, LinksCustomRoleResponse links) Sets the links object on the response.protected abstract voidsetStatus(T response, LifecycleStatus status) Sets the status on the response object.protected abstract voidSets 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, isDefaultKeyDeserializerMethods 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
-
Constructor Details
-
AbstractRoleAssignmentDeserializer
-
-
Method Details
-
createInstance
Creates a new instance of the response type.- Returns:
- A new instance of type T
-
setAssignmentType
Sets the assignment type on the response object.- Parameters:
response- The response objectassignmentType- The assignment type to set
-
setStatus
Sets the status on the response object.- Parameters:
response- The response objectstatus- The lifecycle status to set
-
setType
Sets the role type on the response object.- Parameters:
response- The response objecttype- The role type to set
-
setEmbedded
Sets the embedded object on the response.- Parameters:
response- The response objectembedded- The embedded object to set
-
setLinks
Sets the links object on the response.- Parameters:
response- The response objectlinks- 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:
deserializein classcom.fasterxml.jackson.databind.JsonDeserializer<T>- Throws:
IOException
-
hasNonNullValue
Checks if a JSON node has a non-null value for the given field name.- Parameters:
node- The JSON node to checkfieldName- 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 onfieldName- The name of the field to setvalue- The value to setctxt- The deserialization context for error reporting- Throws:
com.fasterxml.jackson.databind.JsonMappingException- if the field is not allowed or cannot be set
-