public abstract class AbstractTokenConsumer<T extends Token> extends Object implements Token.Consumer<T>
Provides built-in support to extract information for a particular IdentityType
from a
Token
.
The default implementation is based on the identity stereotypes defined by the IdentityStereotype.Stereotype
.
Constructor and Description |
---|
AbstractTokenConsumer() |
Modifier and Type | Method and Description |
---|---|
protected abstract Set<String> |
extractGroups(T token)
Subclasses must override this method to extract groups from the token.
|
<I extends IdentityType> |
extractIdentity(T token,
Class<I> identityType,
StereotypeProperty.Property stereotypeProperty,
Object identifier)
Extracts a certain
IdentityType considering the information from the given Token . |
protected abstract Set<String> |
extractRoles(T token)
Subclasses must override this method to extract roles from the token.
|
protected abstract String |
extractSubject(T token)
Subclasses must override this method to extract the subject's identifier from the token.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getTokenType, validate
public <I extends IdentityType> I extractIdentity(T token, Class<I> identityType, StereotypeProperty.Property stereotypeProperty, Object identifier)
Token.Consumer
Extracts a certain IdentityType
considering the information from the given Token
.
Usually, a token contains a set of claims which can be mapped to the identity types supported by PicketLink IdentityStereotype.Stereotype
.
Each stereotype has a set of common properties that can be used to identify them. In this case, the StereotypeProperty.Property
should be
used to tell which property of the given identity type should be populated with the identifier
value if there is any claim in the token representing it.
extractIdentity
in interface Token.Consumer<T extends Token>
token
- The token.identityType
- The type of the identity type that should be created based on the claims of a token.stereotypeProperty
- The stereotype property used to identify and populate the identity type instance from the token claims.identifier
- The value of the identifier used to match the existence of a identity type based on the token claims set.protected abstract String extractSubject(T token)
Subclasses must override this method to extract the subject's identifier from the token.
token
- protected abstract Set<String> extractRoles(T token)
Subclasses must override this method to extract roles from the token.
token
- Copyright © 2018 JBoss by Red Hat. All rights reserved.