Class SealedPrincipalSerializer<T extends Principal>
java.lang.Object
net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
net.shibboleth.idp.authn.principal.AbstractPrincipalSerializer<String>
net.shibboleth.idp.authn.principal.SimplePrincipalSerializer<T>
net.shibboleth.idp.authn.principal.SealedPrincipalSerializer<T>
- Type Parameters:
T
- principal type
- All Implemented Interfaces:
PrincipalSerializer<String>
,Component
,DestructableComponent
,InitializableComponent
public class SealedPrincipalSerializer<T extends Principal> extends SimplePrincipalSerializer<T>
Principal serializer that encrypts/decrypts the data when serializing.
- Since:
- 4.1.0
-
Field Summary
Fields Modifier and Type Field Description private org.slf4j.Logger
log
Class logger.private static String
PASSWORD_FIELD
Field name of password.private DataSealer
sealer
Data sealer. -
Constructor Summary
Constructors Constructor Description SealedPrincipalSerializer(Class<T> claz, String name)
Constructor. -
Method Summary
Modifier and Type Method Description protected String
getName(String serializedName)
Return the appropriate value to create thePrincipal
around based on the serialized form.protected String
getName(Principal principal)
Return the appropriate value to serialize from the input object.void
setDataSealer(DataSealer theSealer)
Set theDataSealer
to use.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.SimplePrincipalSerializer
deserialize, serialize
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
-
PASSWORD_FIELD
Field name of password.- See Also:
- Constant Field Values
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
sealer
Data sealer.
-
-
Constructor Details
-
SealedPrincipalSerializer
public SealedPrincipalSerializer(@Nonnull @ParameterName(name="claz") Class<T> claz, @Nonnull @NotEmpty @ParameterName(name="name") String name) throws NoSuchMethodException, SecurityExceptionConstructor.- Parameters:
claz
- principal typename
- field name of JSON structure- Throws:
SecurityException
- if the constructor cannot be accessedNoSuchMethodException
- if the constructor does not exist
-
-
Method Details
-
setDataSealer
Set theDataSealer
to use.- Parameters:
theSealer
- encrypting component to use
-
supports
Whether the supplied principal can be serialized.- Specified by:
supports
in interfacePrincipalSerializer<T extends Principal>
- Overrides:
supports
in classSimplePrincipalSerializer<T extends Principal>
- Parameters:
principal
- to examine- Returns:
- whether principal can be serialized
-
supports
Whether the supplied value can be deserialized.- Specified by:
supports
in interfacePrincipalSerializer<T extends Principal>
- Overrides:
supports
in classSimplePrincipalSerializer<T extends Principal>
- Parameters:
value
- to examine- Returns:
- whether value can be deserialized
-
getName
Return the appropriate value to serialize from the input object.- Overrides:
getName
in classSimplePrincipalSerializer<T extends Principal>
- Parameters:
principal
- input object- Returns:
- the value to serialize.
- Throws:
IOException
- if an error occurs
-
getName
Return the appropriate value to create thePrincipal
around based on the serialized form.- Overrides:
getName
in classSimplePrincipalSerializer<T extends Principal>
- Parameters:
serializedName
- the value in the serialization.- Returns:
- the transformed value
- Throws:
IOException
- if an error occurs
-