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 Stringformat()Create a value suitable as the value ofAuthorizationheader.StringgetPassword()Get the password.StringgetUserId()Get the user ID.static BasicCredentialsparse(String input)ParseAuthorizationheader 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)
ParseAuthorizationheader for Basic authentication.- Parameters:
input- The value ofAuthorizationheader. Expected inputs are either"Basic {Base64-Encoded-UserID-and-Password}", or"{Base64-Encoded-UserID-and-Password}".- Returns:
- Parsed credentials. If
inputisnullis returned.
-
format
public String format()
Create a value suitable as the value ofAuthorizationheader.- Returns:
Authorizationheader value for Basic authentication.
-
-