Package com.authlete.common.web
Class BasicCredentials
- java.lang.Object
-
- com.authlete.common.web.BasicCredentials
-
public class BasicCredentials extends Object
Credentials in Basic authentication.- Author:
- Takahiko Kawasaki
- See Also:
- RFC 2617 (HTTP Authentication), 2. Basic Authentication Scheme
-
-
Constructor Summary
Constructors Constructor Description BasicCredentials(String userId, String password)
Constructor with credentials.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
format()
Create a value suitable as the value ofAuthorization
header.String
getPassword()
Get the password.String
getUserId()
Get the user ID.static BasicCredentials
parse(String input)
ParseAuthorization
header for Basic authentication.
-
-
-
Method Detail
-
getUserId
public String getUserId()
Get the user ID.- Returns:
- The user ID.
-
getPassword
public String getPassword()
Get the password.- Returns:
- The password.
-
parse
public static BasicCredentials parse(String input)
ParseAuthorization
header for Basic authentication.- Parameters:
input
- The value ofAuthorization
header. Expected inputs are either"Basic {Base64-Encoded-UserID-and-Password}"
, or"{Base64-Encoded-UserID-and-Password}"
.- Returns:
- Parsed credentials. If
input
isnull
is returned.
-
format
public String format()
Create a value suitable as the value ofAuthorization
header.- Returns:
Authorization
header value for Basic authentication.
-
-