public class ScpCfPrincipalFacade extends Object implements PrincipalFacade
Principal
information on SAP Cloud Platform Cloud Foundry.Constructor and Description |
---|
ScpCfPrincipalFacade()
Default constructor with default strategies.
|
ScpCfPrincipalFacade(LocalScopePrefixProvider localScopePrefixProvider)
Creates a new instance of this facade with the given prefix provider.
|
Modifier and Type | Method and Description |
---|---|
Principal |
getCurrentPrincipal()
Gets the currently authenticated Principal.
|
void |
setIdExtractorFunction(String grantType,
io.vavr.CheckedFunction1<com.auth0.jwt.interfaces.DecodedJWT,String> idExtractor)
This allows to set/override the way the
Principal.getId() is obtained, given a grant_type in the
AuthToken . |
public ScpCfPrincipalFacade(@Nullable LocalScopePrefixProvider localScopePrefixProvider)
localScopePrefixProvider
- The prefix provider to be used to remove prefixes from authorizations.public ScpCfPrincipalFacade()
public void setIdExtractorFunction(@Nonnull String grantType, @Nonnull io.vavr.CheckedFunction1<com.auth0.jwt.interfaces.DecodedJWT,String> idExtractor)
Principal.getId()
is obtained, given a grant_type
in the
AuthToken
.
Every exception that the idExtractor might throw in the getCurrentPrincipal()
method will be caught and
wrapped in a PrincipalAccessException
.
grantType
- The grant type to use the extractor for.idExtractor
- The logic to obtain an id for the Principal
from the AuthToken
.@Nonnull public Principal getCurrentPrincipal() throws PrincipalAccessException
getCurrentPrincipal
in interface PrincipalFacade
Principal
.PrincipalAccessException
- if an error occurred while retrieving resources necessary to construct a Principal
.Copyright © 2019 SAP SE. All rights reserved.