Class DefaultAuthTokenFacade

java.lang.Object
com.sap.cloud.sdk.cloudplatform.security.DefaultAuthTokenFacade
All Implemented Interfaces:
AuthTokenFacade
Direct Known Subclasses:
DwcAuthTokenFacade

public class DefaultAuthTokenFacade extends Object
Facade for retrieving the current AuthToken.
  • Constructor Details

    • DefaultAuthTokenFacade

      public DefaultAuthTokenFacade()
      Default constructor.
  • Method Details

    • tryGetCurrentToken

      @Nonnull public io.vavr.control.Try<AuthToken> tryGetCurrentToken()
      Description copied from interface: AuthTokenFacade
      Returns a Try of the current AuthToken. An AuthToken is not available if no request is available or the request does not contain an "Authorization" header.
      Returns:
      A Try of the current AuthToken.
    • executeWithAuthToken

      @Nullable protected <T> T executeWithAuthToken(@Nonnull AuthToken authToken, @Nonnull Callable<T> callable) throws ThreadContextExecutionException
      Executes the given callable in the context of the given authToken.
      Type Parameters:
      T - The type of the return value of the callable.
      Parameters:
      authToken - The token to be used in the execution of the given callable.
      callable - The Callable to be executed with the given authToken.
      Returns:
      The value returned by executing the given callable in the context of the given AuthToken.
      Throws:
      ThreadContextExecutionException