Class TokenResult
- java.lang.Object
-
- org.glassfish.jersey.client.oauth2.TokenResult
-
public class TokenResult extends java.lang.Object
Class that contains a result of the Authorization Flow including a access token.All result properties can be get by the method
getAllProperties()
. Some of the properties are standardized by the OAuth 2 specification and therefore the class contains getters that extract these properties from the property map.- Since:
- 2.3
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.Object>
properties
-
Constructor Summary
Constructors Constructor Description TokenResult(java.util.Map<java.lang.String,java.lang.Object> properties)
Create a new instance initiated from the property map.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getAccessToken()
Get access token.java.util.Map<java.lang.String,java.lang.Object>
getAllProperties()
Get the map of all properties returned in the Access Token Response.java.lang.Long
getExpiresIn()
Get expiration time of theaccess token
in seconds.private java.lang.String
getProperty(java.lang.String name)
java.lang.String
getRefreshToken()
Get the refresh token.java.lang.String
getTokenType()
Get the type of the returned access token.
-
-
-
Method Detail
-
getAccessToken
public java.lang.String getAccessToken()
Get access token.- Returns:
- Access token.
-
getExpiresIn
public java.lang.Long getExpiresIn()
Get expiration time of theaccess token
in seconds.- Returns:
- Expiration time in seconds or
null
if the value is not provided.
-
getRefreshToken
public java.lang.String getRefreshToken()
Get the refresh token. Note that the refresh token must not be issued during the authorization flow. Some Service Providers issue refresh token only on first user authorization and some providers does not support refresh token at all and authorization flow must be always performed when token expires.- Returns:
- Refresh token or
null
if the value is not provided.
-
getTokenType
public java.lang.String getTokenType()
Get the type of the returned access token. Type is in most casesbearer
(no cryptography is used) but provider might support also other kinds of token likemac
.- Returns:
- Token type.
-
getAllProperties
public java.util.Map<java.lang.String,java.lang.Object> getAllProperties()
Get the map of all properties returned in the Access Token Response.- Returns:
- Map with all token properties.
-
getProperty
private java.lang.String getProperty(java.lang.String name)
-
-