Package io.strimzi.kafka.oauth.common
Class TokenInfo
java.lang.Object
io.strimzi.kafka.oauth.common.TokenInfo
TokenInfo encapsulates the information about the access token.
It can also be used for storing extra application information associated with the access token by directly accessing the payload JSON object.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instanceTokenInfo(com.fasterxml.jackson.databind.JsonNode payload, String token, String principal, Set<String> groups) Create a new instanceTokenInfo(String token, String scope, String principal, Set<String> groups, long issuedAtMs, long expiresAtMs) TokenInfo(String token, Set<String> scopes, String principal, Set<String> groups, long issuedAtMs, long expiresAtMs, com.fasterxml.jackson.databind.JsonNode payload) -
Method Summary
Modifier and TypeMethodDescriptionbooleanlongGet token expiry time in ISO millis timegroups()Get groups for this tokeninthashCode()longGet token creation time ISO milliscom.fasterxml.jackson.databind.node.ObjectNodepayload()Get the payload object passed during construction.Get a principal (user id) for this tokenscope()Get scopes for this tokentoken()Get raw access token
-
Field Details
-
SCOPE
"scope"- See Also:
-
IAT
"iat"- See Also:
-
EXP
"exp"- See Also:
-
ISS
"iss"- See Also:
-
TYP
"typ"- See Also:
-
TOKEN_TYPE
"token_type"- See Also:
-
AUD
"aud"- See Also:
-
-
Constructor Details
-
TokenInfo
Create a new instance- Parameters:
payload- The body of the JWT token or composed of authorization server's introspection endpoint responsetoken- The raw access tokenprincipal- The extracted user ID
-
TokenInfo
public TokenInfo(com.fasterxml.jackson.databind.JsonNode payload, String token, String principal, Set<String> groups) Create a new instance- Parameters:
payload- The body of the JWT token or composed of authorization server's introspection endpoint responsetoken- The raw access tokenprincipal- The extracted user IDgroups- A set of groups extracted from JWT token or authorization server's inspect endpoint response
-
TokenInfo
public TokenInfo(String token, String scope, String principal, Set<String> groups, long issuedAtMs, long expiresAtMs) - Parameters:
token- The raw access tokenscope- The scope returned by authorization server's inspect endpoint responseprincipal- The extracted user IDgroups- A set of groups extracted from JWT token or authorization server's inspect endpoint responseissuedAtMs- The token's `issued at` time in millisexpiresAtMs- The token's `expires at` time in millis
-
TokenInfo
public TokenInfo(String token, Set<String> scopes, String principal, Set<String> groups, long issuedAtMs, long expiresAtMs, com.fasterxml.jackson.databind.JsonNode payload) - Parameters:
token- The raw access tokenscopes- The list of scopesprincipal- The extracted user IDgroups- A set of groups extracted from JWT token or authorization server's inspect endpoint responseissuedAtMs- The token's `issued at` time in millisexpiresAtMs- The token's `expires at` time in millispayload- The body of the JWT token or composed of authorization server's introspection endpoint response
-
-
Method Details
-
token
Get raw access token- Returns:
- Access token as String
-
scope
Get scopes for this token- Returns:
- A Set of scopes as strings
-
expiresAtMs
public long expiresAtMs()Get token expiry time in ISO millis time- Returns:
- Long value representing time
-
principal
Get a principal (user id) for this token- Returns:
- User id as String
-
groups
Get groups for this token- Returns:
- Set of groups as strings
-
issuedAtMs
public long issuedAtMs()Get token creation time ISO millis- Returns:
- Long value representing time
-
payload
public com.fasterxml.jackson.databind.node.ObjectNode payload()Get the payload object passed during construction.The same instance, passed to the TokenInfo constructor is returned which makes it possible to add custom attributes or make modifications during request processing.
- Returns:
- The payload object.
-
equals
-
hashCode
public int hashCode()
-