Class BearerToken

    • 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".

        1. Authorization Request Header Field
        2. Form-Encoded Body Parameter
        3. URI Query Parameter

        To be concrete, this method assumes that the format of the input string is either of the following two.

        1. "Bearer {access-token}"
        2. Parameters formatted in application/x-www-form-urlencoded containing access_token={access-token}.

        For example, both parse method calls below return "hello-world".

         BearerToken.parse("Bearer hello-world");
        input - The input string to be parsed.
        The extracted access token, or null if not found.
        See Also:
        RFC 6750 (OAuth 2.0 Bearer Token Usage)