@FunctionalInterface public interface PrincipalDecoder extends Function<Principal,String>
Modifier and Type | Field and Description |
---|---|
static PrincipalDecoder |
DEFAULT
The default decoder, which just calls
Principal.getName() . |
static PrincipalDecoder |
UNKNOWN
A principal decoder which cannot decode any principal.
|
Modifier and Type | Method and Description |
---|---|
static PrincipalDecoder |
aggregate(PrincipalDecoder... decoders)
Create an aggregated credential decoder.
|
default String |
apply(Principal principal) |
default UnaryOperator<Principal> |
asPrincipalRewriter()
Get this principal decoder as a principal rewriter that produces a
NamePrincipal if the decode succeeds. |
static PrincipalDecoder |
concatenating(PrincipalDecoder former,
String joinString,
PrincipalDecoder latter)
Create a principal decoder which concatenates the results of two principal decoders.
|
static PrincipalDecoder |
concatenating(String joinString,
PrincipalDecoder... decoders)
Create a principal decoder that concatenates the results of the given principal decoders in the order in which
they're given.
|
static PrincipalDecoder |
constant(String name)
Create a principal decoder which always returns the same name.
|
String |
getName(Principal principal)
Get the name from a principal.
|
default PrincipalDecoder |
withRewriter(NameRewriter nameRewriter)
Add a name rewriter to this principal decoder.
|
static final PrincipalDecoder DEFAULT
Principal.getName()
.static final PrincipalDecoder UNKNOWN
String getName(Principal principal)
null
is returned.principal
- the principal to decodenull
if this decoder does not understand the principaldefault UnaryOperator<Principal> asPrincipalRewriter()
NamePrincipal
if the decode succeeds.null
)default PrincipalDecoder withRewriter(NameRewriter nameRewriter)
nameRewriter
- the name rewriterstatic PrincipalDecoder aggregate(PrincipalDecoder... decoders)
decoders
- the constituent decodersstatic PrincipalDecoder concatenating(PrincipalDecoder former, String joinString, PrincipalDecoder latter)
null
is returned.former
- the former decoderjoinString
- the string to use to join the resultslatter
- the latter decoderstatic PrincipalDecoder concatenating(String joinString, PrincipalDecoder... decoders)
null
is returned.joinString
- the string to use to join the resultsdecoders
- the principal decoders (must not be null
, cannot have null
elements)static PrincipalDecoder constant(String name)
name
- the name to returnCopyright © 2020 JBoss by Red Hat. All rights reserved.