Class HttpBasicAuth

java.lang.Object
com.helger.http.basicauth.HttpBasicAuth

@Immutable public final class HttpBasicAuth extends Object
Handling for HTTP Basic Authentication
Author:
Philip Helger
  • Field Details

    • HEADER_VALUE_PREFIX_BASIC

      public static final String HEADER_VALUE_PREFIX_BASIC
      See Also:
    • USERNAME_PASSWORD_SEPARATOR

      public static final char USERNAME_PASSWORD_SEPARATOR
      See Also:
    • CHARSET

      public static final Charset CHARSET
  • Method Details

    • getBasicAuthClientCredentials

      @Nullable public static BasicAuthClientCredentials getBasicAuthClientCredentials(@Nullable String sAuthHeader)
      Get the Basic authentication credentials from the passed HTTP header value.
      Parameters:
      sAuthHeader - The HTTP header value to be interpreted. May be null.
      Returns:
      null if the passed value is not a correct HTTP Basic Authentication header value.
    • getHttpHeaderValue

      @Nonnull @Nonempty public static String getHttpHeaderValue(@Nonnull @Nonempty String sUserName, @Nullable String sPassword)
      Create the request HTTP header value for use with the CHttpHeader.AUTHORIZATION header name.
      Parameters:
      sUserName - The user name to use. May neither be null nor empty.
      sPassword - The password to use. May be null or empty to indicate that no password is present.
      Returns:
      The HTTP header value to use. Neither null nor empty.
      Since:
      9.3.5