Class GenericPrincipalSerializer
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- net.shibboleth.idp.authn.principal.AbstractPrincipalSerializer<String>
-
- net.shibboleth.idp.authn.principal.impl.GenericPrincipalSerializer
-
- All Implemented Interfaces:
net.shibboleth.idp.authn.principal.PrincipalSerializer<String>,net.shibboleth.utilities.java.support.component.Component,net.shibboleth.utilities.java.support.component.DestructableComponent,net.shibboleth.utilities.java.support.component.InitializableComponent
@ThreadSafeAfterInit public class GenericPrincipalSerializer extends net.shibboleth.idp.authn.principal.AbstractPrincipalSerializer<String>
Principal serializer for arbitrary principal types.
-
-
Field Summary
Fields Modifier and Type Field Description private Set<Class<? extends Principal>>compatiblePrincipalTypesA cache of Principal types that support string-based construction.private static PatternJSON_PATTERNPattern used to determine if input is supported.private org.slf4j.LoggerlogClass logger.private static StringPRINCIPAL_NAME_FIELDField name of principal name.private static StringPRINCIPAL_TYPE_FIELDField name of principal type.private BiMap<String,Integer>symbolicsShrinkage of long constants into symbolic numbers.
-
Constructor Summary
Constructors Constructor Description GenericPrincipalSerializer()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Principaldeserialize(String value)protected Stringdesymbolize(javax.json.JsonValue field)Map a field value to a string, either directly or via the symbolic map.Stringserialize(Principal principal)voidsetSymbolics(Map<String,Integer> mappings)Sets mappings of string constants to symbolic constants.booleansupports(String value)booleansupports(Principal principal)-
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
-
-
-
-
Field Detail
-
PRINCIPAL_TYPE_FIELD
@Nonnull @NotEmpty private static final String PRINCIPAL_TYPE_FIELD
Field name of principal type.- See Also:
- Constant Field Values
-
PRINCIPAL_NAME_FIELD
@Nonnull @NotEmpty private static final String PRINCIPAL_NAME_FIELD
Field name of principal name.- See Also:
- Constant Field Values
-
JSON_PATTERN
@Nonnull private static final Pattern JSON_PATTERN
Pattern used to determine if input is supported.
-
log
@Nonnull private final org.slf4j.Logger log
Class logger.
-
symbolics
@Nonnull @NonnullElements private BiMap<String,Integer> symbolics
Shrinkage of long constants into symbolic numbers.
-
-
Method Detail
-
setSymbolics
public void setSymbolics(@Nonnull @NonnullElements Map<String,Integer> mappings)Sets mappings of string constants to symbolic constants.- Parameters:
mappings- string to symbolic mappings
-
supports
public boolean supports(@Nonnull Principal principal)
-
serialize
@Nonnull @NotEmpty public String serialize(@Nonnull Principal principal) throws IOException
- Throws:
IOException
-
supports
public boolean supports(@Nonnull @NotEmpty String value)
-
deserialize
@Nullable public Principal deserialize(@Nonnull @NotEmpty String value) throws IOException
- Throws:
IOException
-
desymbolize
@Nullable protected String desymbolize(@Nonnull javax.json.JsonValue field)
Map a field value to a string, either directly or via the symbolic map.- Parameters:
field- the object field to examine- Returns:
- the resulting string, or null if invalid
-
-