Package com.helger.http.basicauth
Class HttpBasicAuth
java.lang.Object
com.helger.http.basicauth.HttpBasicAuth
Handling for HTTP Basic Authentication
- Author:
- Philip Helger
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic BasicAuthClientCredentialsgetBasicAuthClientCredentials(String sAuthHeader) Get the Basic authentication credentials from the passed HTTP header value.static StringgetHttpHeaderValue(String sUserName, String sPassword) Create the request HTTP header value for use with theCHttpHeader.AUTHORIZATIONheader name.
-
Field Details
-
HEADER_VALUE_PREFIX_BASIC
- See Also:
-
USERNAME_PASSWORD_SEPARATOR
public static final char USERNAME_PASSWORD_SEPARATOR- See Also:
-
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 benull.- Returns:
nullif 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 theCHttpHeader.AUTHORIZATIONheader name.- Parameters:
sUserName- The user name to use. May neither benullnor empty.sPassword- The password to use. May benullor empty to indicate that no password is present.- Returns:
- The HTTP header value to use. Neither
nullnor empty. - Since:
- 9.3.5
-