Package org.gcube.oidc.rest
Class JWTToken
java.lang.Object
org.gcube.oidc.rest.JWTToken
- All Implemented Interfaces:
Serializable
JWT token wrapper.
- Author:
- Mauro Mugnaini
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAccount resource.protected static org.slf4j.LoggerLogger. -
Method Summary
Modifier and TypeMethodDescriptionstatic JWTTokenfromString(String tokenString) Creates aJWTTokenfrom a string.Returns the access token as bearer.Returns the access token string.Deprecated.getAud()Returns the aud.Returns the authorization permission RS name resource scopes.Returns the authorization permission RS names.Returns the authorization permission RS name to resource scopes map.protected org.json.simple.JSONArrayReturns the authorization permissions.getAzp()Returns the azp.Returns the name.getEmail()Returns the email.getExp()Returns the exp.Returns the exp as calendar.Returns the exp as date.Returns the family name.getGiven()Returns the given name.getJti()Returns the jti.org.json.simple.JSONObjectReturns the payload.getRaw()Returns the raw token string.org.json.simple.JSONObjectReturns the refresh token.Returns the refresh token exp.Returns the refresh token exp as date.Returns the refresh token string.protected org.json.simple.JSONObjectReturns the resource access.Returns the resource access keys.getResourceAccessRoles(String resource) Returns the resource access roles.getResourceNameToAccessRolesMap(List<String> resourcesToSkip) Returns the resource name to access roles map.getSub()Returns the sub.Returns the token essentials.Returns the preferred username.booleanChecks if a refresh token exists.booleanChecks if the token is expired.booleanChecks if the refresh token is expired.toString()
-
Field Details
-
logger
protected static org.slf4j.Logger loggerLogger. -
ACCOUNT_RESOURCE
Account resource.- See Also:
-
-
Method Details
-
fromString
Creates aJWTTokenfrom a string.- Parameters:
tokenString- the token string.- Returns:
- the
JWTToken.
-
getRaw
Returns the raw token string.- Returns:
- the raw token string.
-
getAccessTokenString
Returns the access token string.- Returns:
- the access token string.
-
getRefreshTokenString
Returns the refresh token string.- Returns:
- the refresh token string.
-
getAsBearer
Deprecated.UsegetAccessTokenAsBearer()method instead.Returns the access token as bearer.- Returns:
- the access token as bearer.
-
getAccessTokenAsBearer
Returns the access token as bearer.- Returns:
- the access token as bearer.
-
getPayload
public org.json.simple.JSONObject getPayload()Returns the payload.- Returns:
- the payload.
-
hasRefreshToken
public boolean hasRefreshToken()Checks if a refresh token exists.- Returns:
- true if a refresh token exists, false otherwise.
-
getRefreshToken
public org.json.simple.JSONObject getRefreshToken()Returns the refresh token.- Returns:
- the refresh token.
-
getAzp
Returns the azp.- Returns:
- the azp.
-
getExp
Returns the exp.- Returns:
- the exp.
-
getRefreshTokenExp
Returns the refresh token exp.- Returns:
- the refresh token exp.
-
getExpAsDate
Returns the exp as date.- Returns:
- the exp as date.
-
getRefreshTokenExpAsDate
Returns the refresh token exp as date.- Returns:
- the refresh token exp as date.
-
getExpAsCalendar
Returns the exp as calendar.- Returns:
- the exp as calendar.
-
isExpired
public boolean isExpired()Checks if the token is expired.- Returns:
- true if the token is expired, false otherwise.
-
isRefreshTokenExpired
public boolean isRefreshTokenExpired()Checks if the refresh token is expired.- Returns:
- true if the refresh token is expired, false otherwise.
-
getAud
Returns the aud.- Returns:
- the aud.
-
getJti
Returns the jti.- Returns:
- the jti.
-
getSub
Returns the sub.- Returns:
- the sub.
-
getEmail
Returns the email.- Returns:
- the email.
-
getFamily
Returns the family name.- Returns:
- the family name.
-
getGiven
Returns the given name.- Returns:
- the given name.
-
getUserName
Returns the preferred username.- Returns:
- the preferred username.
-
getDisplayName
Returns the name.- Returns:
- the name.
-
getResourceAccess
protected org.json.simple.JSONObject getResourceAccess()Returns the resource access.- Returns:
- the resource access.
-
getResourceAccessKeys
Returns the resource access keys.- Returns:
- the resource access keys.
-
getResourceAccessRoles
Returns the resource access roles.- Parameters:
resource- the resource.- Returns:
- the roles.
-
getResourceNameToAccessRolesMap
Returns the resource name to access roles map.- Parameters:
resourcesToSkip- the resources to skip.- Returns:
- the map.
-
getAuthorizationPermissions
protected org.json.simple.JSONArray getAuthorizationPermissions()Returns the authorization permissions.- Returns:
- the permissions.
-
getAuthorizationPermissionRSNames
Returns the authorization permission RS names.- Returns:
- the names.
-
getAuthorizationPermissionRSNameResourceScopes
Returns the authorization permission RS name resource scopes.- Parameters:
rsname- the RS name.- Returns:
- the scopes.
-
getAuthorizationPermissionRSNameToResourceScopesMap
Returns the authorization permission RS name to resource scopes map.- Returns:
- the map.
-
toString
-
getTokenEssentials
Returns the token essentials.- Returns:
- the token essentials.
-
getAccessTokenAsBearer()method instead.