Class BasicAuthenticationAccessor

java.lang.Object
com.sap.cloud.sdk.cloudplatform.security.BasicAuthenticationAccessor

public final class BasicAuthenticationAccessor extends Object
Static accessor to retrieve the BasicCredentials of the currently incoming request.
  • Method Details

    • setBasicAuthenticationFacade

      public static void setBasicAuthenticationFacade(@Nullable BasicAuthenticationFacade facade)
      Overrides the currently set facade with the given one, potentially changing the behavior of all following calls to the BasicAuthenticationAccessor.

      In case the given facade is null the default implementation will be reinstated.

      Parameters:
      facade - The facade to use for all future calls of the BasicAuthenticationAccessor. If null is passed, the DefaultBasicAuthenticationFacade will be used instead.
    • tryGetCurrentBasicCredentials

      @Nonnull public static io.vavr.control.Try<BasicCredentials> tryGetCurrentBasicCredentials()
      Getter to retrieve the basic credentials given by the currently incoming request.

      If the incoming request contains a basic authentication header the Try will contain this header as a BasicCredentials object. If the header was not given, was no basic authentication header or could not be decoded the Try will contain the corresponding exception.

      Returns:
      A Try containing either the BasicCredentials or an exception describing the error why the credentials could not be retrieved.
    • getBasicAuthenticationFacade

      @Nonnull public static BasicAuthenticationFacade getBasicAuthenticationFacade()
      The actual implementation used to forward the business logic calls to.