Package com.authlete.common.web
Class BearerToken
- java.lang.Object
-
- com.authlete.common.web.BearerToken
-
public class BearerToken extends Object
Utility class for Bearer Token defined in RFC 6750.- Author:
- Takahiko Kawasaki
- See Also:
- RFC 6750 (OAuth 2.0 Bearer Token Usage)
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
parse(String input)
Extract the access token embedded in the input string.
-
-
-
Method Detail
-
parse
public static String parse(String input)
Extract the access token embedded in the input string.This method assumes that the input string comes from one of the following three places that are mentioned in "RFC 6750 (OAuth 2.0 Bearer Token Usage), 2. Authenticated Requests".
To be concrete, this method assumes that the format of the input string is either of the following two.
"Bearer {access-token}"
- Parameters formatted in
application/x-www-form-urlencoded
containingaccess_token={access-token}
.
For example, both
parse
method calls below return"hello-world"
.BearerToken.parse("Bearer hello-world"); BearerToken.parse("key1=value1&access_token=hello-world");
- Parameters:
input
- The input string to be parsed.- Returns:
- The extracted access token, or
null
if not found. - See Also:
- RFC 6750 (OAuth 2.0 Bearer Token Usage)
-
-