Class GrantedOAuth2AccessToken
java.lang.Object
com.linecorp.armeria.common.auth.oauth2.GrantedOAuth2AccessToken
- All Implemented Interfaces:
Serializable
Defines a structure of the Access Token Response, as per
[RFC6749], Section 5.1.
- See Also:
- Serialized Form
-
Method Summary
Modifier and TypeMethodDescription"access_token" Access Token response field, REQUIRED.A value of theHttpHeaderNames.AUTHORIZATION
header based on this access token.Creates a newGrantedOAuth2AccessTokenBuilder
to build a newGrantedOAuth2AccessToken
and supplied it with a value ofaccess_token
Access Token response field.boolean
AnInstant
representing a derived value usingissuedAt() + expiresIn()
."expires_in" Access Token response field, RECOMMENDED.extras()
AMap
of extra system-specific token parameters included with Access Token response, OPTIONAL.int
hashCode()
boolean
Indicates whether or not the Access Token is refreshable via refresh token.issuedAt()
AnInstant
indicating when the Access Token was issued.boolean
isValid()
Indicates whether or not the Access Token already expired based onexpiresAt()
function.boolean
Indicates whether or not the Access Token expire at the givenInstant
time based onexpiresAt()
function.static GrantedOAuth2AccessToken
Creates a newGrantedOAuth2AccessToken
based on theJSON
-formatted raw response body and optional raw formattedscope
used to request the token.JSON
-formatted raw Token Introspection Response body."refresh_token" Access Token response field, OPTIONAL.scope()
"scope" Access Token response field, OPTIONAL, if identical to the scope requested by the client; otherwise, REQUIRED.scopeSet()
"scope" Access Token response field, OPTIONAL, if identical to the scope requested by the client; otherwise, REQUIRED."token_type" Access Token response field, REQUIRED.toString()
-
Method Details
-
parse
public static GrantedOAuth2AccessToken parse(String rawResponse, @Nullable @Nullable String requestScope)Creates a newGrantedOAuth2AccessToken
based on theJSON
-formatted raw response body and optional raw formattedscope
used to request the token.- Parameters:
rawResponse
-JSON
-formatted raw response body.requestScope
- OPTIONAL. A list of space-delimited, case-sensitive strings. The strings are defined by the authorization server. The authorization server MAY fully or partially ignore the scope requested by the client, based on the authorization server policy or the resource owner's instructions. If the issued access token scope is different from the one requested by the client, the authorization server MUST include the "scope" response parameter to inform the client of the actual scope granted. If the client omits the scope parameter when requesting authorization, the authorization server MUST either process the request using a pre-defined default value or fail the request indicating an invalid scope.- Returns:
- A new instance of
GrantedOAuth2AccessToken
.
-
builder
Creates a newGrantedOAuth2AccessTokenBuilder
to build a newGrantedOAuth2AccessToken
and supplied it with a value ofaccess_token
Access Token response field.- Returns:
- A new instance of
GrantedOAuth2AccessTokenBuilder
.
-
accessToken
"access_token" Access Token response field, REQUIRED. The access token issued by the authorization server. -
tokenType
"token_type" Access Token response field, REQUIRED. The type of the token issued as described at [RFC6749], Section 7.1. Value is case insensitive. -
expiresIn
"expires_in" Access Token response field, RECOMMENDED.Duration
indicating the lifetime of the access token. For example, the value 3600 seconds denotes that the access token will expire in one hour from the time the response was generated. If omitted, the authorization server SHOULD provide the expiration time via other means or document the default value. -
issuedAt
AnInstant
indicating when the Access Token was issued. The value is NOT supplied with the Access Token response and calculated approximately using "expires_in" field. -
expiresAt
AnInstant
representing a derived value usingissuedAt() + expiresIn()
. -
isValid
Indicates whether or not the Access Token expire at the givenInstant
time based onexpiresAt()
function. -
isValid
public boolean isValid()Indicates whether or not the Access Token already expired based onexpiresAt()
function. -
isRefreshable
public boolean isRefreshable()Indicates whether or not the Access Token is refreshable via refresh token. -
refreshToken
"refresh_token" Access Token response field, OPTIONAL. The refresh token, which can be used to obtain new access tokens using the same authorization grant as described at [RFC6749], Section 6. -
scope
"scope" Access Token response field, OPTIONAL, if identical to the scope requested by the client; otherwise, REQUIRED. The scope of the access token as described at [RFC6749], Section 3.3. A list of space-delimited, case-sensitive scope strings. The strings are defined by the authorization server. The authorization server MAY fully or partially ignore the scope requested by the client, based on the authorization server policy or the resource owner's instructions. If the issued access token scope is different from the one requested by the client, the authorization server MUST include the "scope" response parameter to inform the client of the actual scope granted. If the client omits the scope parameter when requesting authorization, the authorization server MUST either process the request using a pre-defined default value or fail the request indicating an invalid scope. -
scopeSet
"scope" Access Token response field, OPTIONAL, if identical to the scope requested by the client; otherwise, REQUIRED. The scope of the access token as described at [RFC6749], Section 3.3. ASet
of case-sensitive scope strings. The strings are defined by the authorization server. The authorization server MAY fully or partially ignore the scope requested by the client, based on the authorization server policy or the resource owner's instructions. If the issued access token scope is different from the one requested by the client, the authorization server MUST include the "scope" response parameter to inform the client of the actual scope granted. If the client omits the scope parameter when requesting authorization, the authorization server MUST either process the request using a pre-defined default value or fail the request indicating an invalid scope. -
extras
AMap
of extra system-specific token parameters included with Access Token response, OPTIONAL. -
authorization
A value of theHttpHeaderNames.AUTHORIZATION
header based on this access token. -
rawResponse
JSON
-formatted raw Token Introspection Response body. If theGrantedOAuth2AccessToken
was not parsed out of the raw response body, this value calculated based on the otherGrantedOAuth2AccessToken
values. -
toString
-
equals
-
hashCode
public int hashCode()
-