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 AccessTokenSpec
DEFAULT
The default access token specification.
-
Constructor Summary
Constructors Constructor Description AccessTokenSpec()
Creates a new default access token specification.AccessTokenSpec(long lifetime, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, boolean encrypt)
Deprecated.AccessTokenSpec(long lifetime, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, @Nullable com.nimbusds.oauth2.sdk.id.Subject impersonatedSubject, boolean encrypt)
Deprecated.AccessTokenSpec(long lifetime, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, @Nullable com.nimbusds.oauth2.sdk.id.Subject impersonatedSubject, boolean encrypt, com.nimbusds.openid.connect.sdk.SubjectType subjectType)
Deprecated.AccessTokenSpec(long lifetime, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, @Nullable com.nimbusds.oauth2.sdk.id.Subject impersonatedSubject, Optional<Boolean> encryptSelfContained, com.nimbusds.openid.connect.sdk.SubjectType subjectType)
Creates a new access token specification.AccessTokenSpec(long lifetime, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, Optional<Boolean> encryptSelfContained)
Creates a new access token specification.AccessTokenSpec(long lifetime, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, boolean encrypt)
Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
encrypt()
Deprecated.UsegetEncryptSelfContained()
instead.com.nimbusds.oauth2.sdk.token.TokenEncoding
getEncoding()
Returns the access token encoding.Optional<Boolean>
getEncryptSelfContained()
Returns the optional encryption preference for self-contained (JWT) access tokens.com.nimbusds.openid.connect.sdk.SubjectType
getSubjectType()
Returns the access token subject type.static AccessTokenSpec
parse(net.minidev.json.JSONObject jsonObject)
Parses an access token specification from the specified JSON object.net.minidev.json.JSONObject
toJSONObject()
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
The 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 the optional encryption preference is not set.
- The access token subject type is public.
-
-
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 the optional encryption preference is not set. The access token subject type is public.
-
AccessTokenSpec
@Deprecated public AccessTokenSpec(long lifetime, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, boolean encrypt)
Deprecated.Creates a new access token specification. No explicit token audience is specified. No subject in impersonation and delegation cases is specified. The access token subject type is public.- 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
- Iftrue
flags the access token for encryption. Applies to self-contained (JWT) access tokens only.
-
AccessTokenSpec
@Deprecated public AccessTokenSpec(long lifetime, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, boolean encrypt)
Deprecated.Creates a new access token specification. No subject in impersonation and delegation cases is specified. The access token subject type is public.- 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,null
if not specified.encoding
- The access token encoding. Must not benull
.encrypt
- Iftrue
flags the access token for encryption. Applies to self-contained (JWT) access tokens only.
-
AccessTokenSpec
@Deprecated public AccessTokenSpec(long lifetime, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, @Nullable com.nimbusds.oauth2.sdk.id.Subject impersonatedSubject, boolean encrypt)
Deprecated.Creates a new access token specification. The access token subject type is public.- 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,null
if not specified.encoding
- The access token encoding. Must not benull
.impersonatedSubject
- The subject in impersonation and delegation cases,null
if not applicable.encrypt
- Iftrue
flags the access token for encryption. Applies to self-contained (JWT) access tokens only.
-
AccessTokenSpec
@Deprecated public AccessTokenSpec(long lifetime, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, @Nullable com.nimbusds.oauth2.sdk.id.Subject impersonatedSubject, boolean encrypt, com.nimbusds.openid.connect.sdk.SubjectType subjectType)
Deprecated.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,null
if not specified.encoding
- The access token encoding. Must not benull
.impersonatedSubject
- The subject in impersonation and delegation cases,null
if not applicable.encrypt
- Iftrue
flags the access token for encryption. Applies to self-contained (JWT) access tokens only.subjectType
- The access token subject type.
-
AccessTokenSpec
public AccessTokenSpec(long lifetime, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, Optional<Boolean> encryptSelfContained)
Creates a new access token specification. No subject in impersonation and delegation cases is specified. The access token subject type is public.- 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,null
if not specified.encoding
- The access token encoding. Must not benull
.encryptSelfContained
- The optional encryption preference for self-contained (JWT) access tokens. Must not benull
.
-
AccessTokenSpec
public AccessTokenSpec(long lifetime, @Nullable List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.token.TokenEncoding encoding, @Nullable com.nimbusds.oauth2.sdk.id.Subject impersonatedSubject, Optional<Boolean> encryptSelfContained, com.nimbusds.openid.connect.sdk.SubjectType subjectType)
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,null
if not specified.encoding
- The access token encoding. Must not benull
.impersonatedSubject
- The subject in impersonation and delegation cases,null
if not applicable.encryptSelfContained
- The optional encryption preference for self-contained (JWT) access tokens. Must not benull
.subjectType
- The access token subject type.
-
-
Method Detail
-
getEncoding
public com.nimbusds.oauth2.sdk.token.TokenEncoding getEncoding()
Returns the access token encoding.- Returns:
- The access token encoding.
-
encrypt
@Deprecated public boolean encrypt()
Deprecated.UsegetEncryptSelfContained()
instead.Returns the access token encryption flag.- Returns:
- If
true
the access token is flagged for encryption. Applies to self-contained access tokens only.
-
getEncryptSelfContained
public Optional<Boolean> getEncryptSelfContained()
Returns the optional encryption preference for self-contained (JWT) access tokens.- Returns:
- The encryption preference.
-
getSubjectType
public com.nimbusds.openid.connect.sdk.SubjectType getSubjectType()
Returns the access token subject type.- Returns:
- The subject type.
-
toJSONObject
public net.minidev.json.JSONObject toJSONObject()
Description copied from class:TokenSpec
Returns a JSON object representation of this token specification.- Overrides:
toJSONObject
in 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.
-
-