Class IdPAttributePrincipalSerializer
java.lang.Object
net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
net.shibboleth.idp.authn.principal.AbstractPrincipalSerializer<String>
net.shibboleth.idp.authn.principal.impl.IdPAttributePrincipalSerializer
- All Implemented Interfaces:
PrincipalSerializer<String>
,Component
,DestructableComponent
,InitializableComponent
@ThreadSafe public class IdPAttributePrincipalSerializer extends AbstractPrincipalSerializer<String>
Principal serializer for
IdPAttributePrincipal
.-
Field Summary
Fields Modifier and Type Field Description private static String
EMPTY_VALUE_FIELD
Field name of type code of anEmptyAttributeValue
.private static Pattern
JSON_PATTERN
Pattern used to determine if input is supported.private org.slf4j.Logger
log
Class logger.private javax.json.JsonBuilderFactory
objectBuilderFactory
JSON object bulder factory.private static String
PRINCIPAL_ENTRY_FIELD
Field name of principal entry.private static String
PRINCIPAL_NAME_FIELD
Field name of principal name.private static String
SCOPED_VALUE_FIELD
Field name of type code of anScopedStringAttributeValue
.private static String
STRING_VALUE_FIELD
Field name of type code of anStringAttributeValue
. -
Constructor Summary
Constructors Constructor Description IdPAttributePrincipalSerializer()
Constructor. -
Method Summary
Modifier and Type Method Description IdPAttributePrincipal
deserialize(String value)
Deserialize the supplied value.protected IdPAttributeValue
deserializeValue(javax.json.JsonObject object)
Deserialize an attribute value from aJsonObject
.private javax.json.JsonArrayBuilder
getJsonArrayBuilder()
Get aJsonArrayBuilder
in a thread-safe manner.private javax.json.JsonObjectBuilder
getJsonObjectBuilder()
Get aJsonObjectBuilder
in a thread-safe manner.String
serialize(Principal principal)
Serialize the supplied principal.protected javax.json.JsonObject
serializeValue(IdPAttributeValue value)
Serialize an attribute value and produce aJsonObject
.boolean
supports(String value)
Whether the supplied value can be deserialized.boolean
supports(Principal principal)
Whether the supplied principal can be serialized.Methods inherited from class net.shibboleth.idp.authn.principal.AbstractPrincipalSerializer
getJsonGenerator, getJsonReader
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.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
PRINCIPAL_NAME_FIELD
Field name of principal name.- See Also:
- Constant Field Values
-
PRINCIPAL_ENTRY_FIELD
Field name of principal entry.- See Also:
- Constant Field Values
-
EMPTY_VALUE_FIELD
Field name of type code of anEmptyAttributeValue
.- See Also:
- Constant Field Values
-
STRING_VALUE_FIELD
Field name of type code of anStringAttributeValue
.- See Also:
- Constant Field Values
-
SCOPED_VALUE_FIELD
Field name of type code of anScopedStringAttributeValue
.- See Also:
- Constant Field Values
-
JSON_PATTERN
Pattern used to determine if input is supported. -
log
@Nonnull private final org.slf4j.Logger logClass logger. -
objectBuilderFactory
@Nonnull private final javax.json.JsonBuilderFactory objectBuilderFactoryJSON object bulder factory.
-
-
Constructor Details
-
IdPAttributePrincipalSerializer
public IdPAttributePrincipalSerializer()Constructor.
-
-
Method Details
-
supports
Whether the supplied principal can be serialized.- Parameters:
principal
- to examine- Returns:
- whether principal can be serialized
-
serialize
Serialize the supplied principal.- Parameters:
principal
- to serialize- Returns:
- serialized value
- Throws:
IOException
- if an error occurs during serialization
-
supports
Whether the supplied value can be deserialized.- Parameters:
value
- to examine- Returns:
- whether value can be deserialized
-
deserialize
@Nullable public IdPAttributePrincipal deserialize(@Nonnull @NotEmpty String value) throws IOExceptionDeserialize the supplied value.- Parameters:
value
- to deserialize- Returns:
- principal
- Throws:
IOException
- if an error occurs during deserialization
-
serializeValue
Serialize an attribute value and produce aJsonObject
.Override this method to support additional value types.
- Parameters:
value
- the attribute value to serialize- Returns:
- the object
-
deserializeValue
Deserialize an attribute value from aJsonObject
.Override this method to support additional value types.
- Parameters:
object
- object to deserialize- Returns:
- the attribute value, or null
-
getJsonObjectBuilder
@Nonnull private javax.json.JsonObjectBuilder getJsonObjectBuilder()Get aJsonObjectBuilder
in a thread-safe manner.- Returns:
- an object builder
-
getJsonArrayBuilder
@Nonnull private javax.json.JsonArrayBuilder getJsonArrayBuilder()Get aJsonArrayBuilder
in a thread-safe manner.- Returns:
- an array builder
-