Class DefaultAuthTokenFacade
java.lang.Object
com.sap.cloud.sdk.cloudplatform.security.DefaultAuthTokenFacade
- All Implemented Interfaces:
AuthTokenFacade
- Direct Known Subclasses:
DwcAuthTokenFacade
Facade for retrieving the current
AuthToken
.-
Field Summary
Fields inherited from interface com.sap.cloud.sdk.cloudplatform.security.AuthTokenFacade
NULL
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected <T> T
executeWithAuthToken
(AuthToken authToken, Callable<T> callable) Executes the givencallable
in the context of the givenauthToken
.io.vavr.control.Try<AuthToken>
Returns aTry
of the currentAuthToken
.
-
Constructor Details
-
DefaultAuthTokenFacade
public DefaultAuthTokenFacade()Default constructor.
-
-
Method Details
-
tryGetCurrentToken
Description copied from interface:AuthTokenFacade
Returns aTry
of the currentAuthToken
. AnAuthToken
is not available if no request is available or the request does not contain an "Authorization" header.- Returns:
- A
Try
of the currentAuthToken
.
-
executeWithAuthToken
@Nullable protected <T> T executeWithAuthToken(@Nonnull AuthToken authToken, @Nonnull Callable<T> callable) throws ThreadContextExecutionException Executes the givencallable
in the context of the givenauthToken
.- Type Parameters:
T
- The type of the return value of thecallable
.- Parameters:
authToken
- The token to be used in the execution of the givencallable
.callable
- TheCallable
to be executed with the givenauthToken
.- Returns:
- The value returned by executing the given
callable
in the context of the givenAuthToken
. - Throws:
ThreadContextExecutionException
-