public class BearerToken extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
parse(String input)
Extract the access token embedded in the input string.
|
public static String parse(String input)
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-urlencodedcontainingaccess_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");
input - The input string to be parsed.null if not found.Copyright © 2017. All rights reserved.