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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected <T> TexecuteWithAuthToken(AuthToken authToken, Callable<T> callable) Executes the givencallablein the context of the givenauthToken.io.vavr.control.Try<AuthToken>Returns aTryof the currentAuthToken.
-
Constructor Details
-
DefaultAuthTokenFacade
public DefaultAuthTokenFacade()Default constructor.
-
-
Method Details
-
tryGetCurrentToken
Description copied from interface:AuthTokenFacadeReturns aTryof the currentAuthToken. AnAuthTokenis not available if no request is available or the request does not contain an "Authorization" header.- Returns:
- A
Tryof the currentAuthToken.
-
executeWithAuthToken
@Nullable protected <T> T executeWithAuthToken(@Nonnull AuthToken authToken, @Nonnull Callable<T> callable) throws ThreadContextExecutionException Executes the givencallablein 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- TheCallableto be executed with the givenauthToken.- Returns:
- The value returned by executing the given
callablein the context of the givenAuthToken. - Throws:
ThreadContextExecutionException
-