Class AccessTokenSpec
- java.lang.Object
-
- com.nimbusds.openid.connect.provider.spi.grants.TokenSpec
-
- com.nimbusds.openid.connect.provider.spi.grants.AccessTokenSpec
-
@Immutable public class AccessTokenSpec extends TokenSpec
Access token specification..
-
-
Field Summary
Fields Modifier and Type Field Description static AccessTokenSpecDEFAULTDefault access token specification.
-
Constructor Summary
Constructors Constructor Description AccessTokenSpec()Creates a new default access token specification.AccessTokenSpec(long lifetime, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, boolean encrypt)Creates a new access token specification.AccessTokenSpec(long lifetime, List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, boolean encrypt)Creates a new access token specification.AccessTokenSpec(long lifetime, List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, com.nimbusds.oauth2.sdk.id.Subject impersonatedSubject, boolean encrypt)Creates a new access token specification.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanencrypt()Returns the access token encryption flag.com.nimbusds.oauth2.sdk.token.TokenEncodinggetEncoding()Returns the access token encoding.static AccessTokenSpecparse(net.minidev.json.JSONObject jsonObject)Parses an access token specification from the specified JSON object.net.minidev.json.JSONObjecttoJSONObject()Returns a JSON object representation of this token specification.-
Methods inherited from class com.nimbusds.openid.connect.provider.spi.grants.TokenSpec
getAudience, getImpersonatedSubject, getLifetime, toString
-
-
-
-
Field Detail
-
DEFAULT
public static final AccessTokenSpec DEFAULT
Default access token specification. No explicit token lifetime is specified (to let the Connect2id server apply the default configured lifetime for access tokens). No explicit token audience is specified. No subject in impersonation and delegation cases is specified. The token is self-contained (JWT-encoded) and not encrypted.
-
-
Constructor Detail
-
AccessTokenSpec
public AccessTokenSpec()
Creates a new default access token specification. No explicit token lifetime is specified (to let the Connect2id server apply the default configured lifetime for access tokens). No explicit token audience is specified. No subject in impersonation and delegation cases is specified. The token is self-contained (JWT-encoded) and not encrypted.
-
AccessTokenSpec
public AccessTokenSpec(long lifetime, List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, com.nimbusds.oauth2.sdk.id.Subject impersonatedSubject, boolean encrypt)
Creates a new access token specification.- Parameters:
lifetime- The access token lifetime, in seconds, zero if not specified (to let the Connect2id server apply the default configured lifetime for access tokens).audList- Explicit list of audiences for the access token,nullif not specified.encoding- The access token encoding. Must not benull.impersonatedSubject- The subject in impersonation and delegation cases,nullif not applicable.encrypt- Iftrueflags the access token for encryption. Applies to self-contained (JWT) access tokens only.
-
AccessTokenSpec
public AccessTokenSpec(long lifetime, List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, boolean encrypt)
Creates a new access token specification. No subject in impersonation and delegation cases is specified.- Parameters:
lifetime- The access token lifetime, in seconds, zero if not specified (to let the Connect2id server apply the default configured lifetime for access tokens).audList- Explicit list of audiences for the access token,nullif not specified.encoding- The access token encoding. Must not benull.encrypt- Iftrueflags the access token for encryption. Applies to self-contained (JWT) access tokens only.
-
AccessTokenSpec
public AccessTokenSpec(long lifetime, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, boolean encrypt)
Creates a new access token specification. No explicit token audience is specified. No subject in impersonation and delegation cases is specified.- Parameters:
lifetime- The access token lifetime, in seconds, zero if not specified (to let the Connect2id server apply the default configured lifetime for access tokens).encoding- The access token encoding. Must not benull.encrypt- Iftrueflags the access token for encryption. Applies to self-contained (JWT) access tokens only.
-
-
Method Detail
-
getEncoding
public com.nimbusds.oauth2.sdk.token.TokenEncoding getEncoding()
Returns the access token encoding.- Returns:
- The access token encoding.
-
encrypt
public boolean encrypt()
Returns the access token encryption flag.- Returns:
- If
truethe access token is flagged for encryption. Applies to self-contained access tokens only.
-
toJSONObject
public net.minidev.json.JSONObject toJSONObject()
Description copied from class:TokenSpecReturns a JSON object representation of this token specification.- Overrides:
toJSONObjectin classTokenSpec- Returns:
- The JSON object.
-
parse
public static AccessTokenSpec parse(net.minidev.json.JSONObject jsonObject) throws com.nimbusds.oauth2.sdk.ParseException
Parses an access token specification from the specified JSON object.- Parameters:
jsonObject- The JSON object. Must not benull.- Returns:
- The access token specification.
- Throws:
com.nimbusds.oauth2.sdk.ParseException- If parsing failed.
-
-