@Immutable public class TokenSpec extends Object
Constructor and Description |
---|
TokenSpec(long lifetime)
Creates a new token specification.
|
TokenSpec(long lifetime,
List<com.nimbusds.oauth2.sdk.id.Audience> audList,
com.nimbusds.oauth2.sdk.id.Subject impersonatedSubject)
Creates a new token specification.
|
Modifier and Type | Method and Description |
---|---|
List<com.nimbusds.oauth2.sdk.id.Audience> |
getAudience()
Returns the explicit list of audiences for the token.
|
com.nimbusds.oauth2.sdk.id.Subject |
getImpersonatedSubject()
Returns the subject in impersonation and delegation cases.
|
long |
getLifetime()
Returns the token lifetime.
|
static TokenSpec |
parse(net.minidev.json.JSONObject jsonObject)
Parses a token specification from the specified JSON object.
|
net.minidev.json.JSONObject |
toJSONObject()
Returns a JSON object representation of this token specification.
|
String |
toString() |
public TokenSpec(long lifetime)
lifetime
- The token lifetime, in seconds. Zero implies
permanent or not specified (to let the Connect2id
server apply the default configured lifetime),
depending on the token type. Must not be a negative
integer.public TokenSpec(long lifetime, List<com.nimbusds.oauth2.sdk.id.Audience> audList, com.nimbusds.oauth2.sdk.id.Subject impersonatedSubject)
lifetime
- The token lifetime, in seconds. Zero
implies permanent or not specified (to
let the Connect2id server apply the
default configured lifetime), depending
on the token type. Must not be a negative
integer.audList
- Explicit list of audiences for the token,
null
if not specified.impersonatedSubject
- The subject in impersonation and
delegation cases, null
if not
applicable.public long getLifetime()
public List<com.nimbusds.oauth2.sdk.id.Audience> getAudience()
null
if not specified.public com.nimbusds.oauth2.sdk.id.Subject getImpersonatedSubject()
null
if not applicable.public net.minidev.json.JSONObject toJSONObject()
public static TokenSpec parse(net.minidev.json.JSONObject jsonObject) throws com.nimbusds.oauth2.sdk.ParseException
jsonObject
- The JSON object. Must not be null
.com.nimbusds.oauth2.sdk.ParseException
- If parsing failed.Copyright © 2017 Connect2id Ltd.. All rights reserved.