Class JWTToken

java.lang.Object
org.gcube.oidc.rest.JWTToken
All Implemented Interfaces:
Serializable

public class JWTToken extends Object implements Serializable
JWT token wrapper.
Author:
Mauro Mugnaini
See Also:
  • Field Details

    • logger

      protected static org.slf4j.Logger logger
      Logger.
    • ACCOUNT_RESOURCE

      public static final String ACCOUNT_RESOURCE
      Account resource.
      See Also:
  • Method Details

    • fromString

      public static JWTToken fromString(String tokenString)
      Creates a JWTToken from a string.
      Parameters:
      tokenString - the token string.
      Returns:
      the JWTToken.
    • getRaw

      public String getRaw()
      Returns the raw token string.
      Returns:
      the raw token string.
    • getAccessTokenString

      public String getAccessTokenString()
      Returns the access token string.
      Returns:
      the access token string.
    • getRefreshTokenString

      public String getRefreshTokenString()
      Returns the refresh token string.
      Returns:
      the refresh token string.
    • getAsBearer

      @Deprecated public String getAsBearer()
      Deprecated.
      Use getAccessTokenAsBearer() method instead.
      Returns the access token as bearer.
      Returns:
      the access token as bearer.
    • getAccessTokenAsBearer

      public String 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

      public String getAzp()
      Returns the azp.
      Returns:
      the azp.
    • getExp

      public Long getExp()
      Returns the exp.
      Returns:
      the exp.
    • getRefreshTokenExp

      public Long getRefreshTokenExp()
      Returns the refresh token exp.
      Returns:
      the refresh token exp.
    • getExpAsDate

      public Date getExpAsDate()
      Returns the exp as date.
      Returns:
      the exp as date.
    • getRefreshTokenExpAsDate

      public Date getRefreshTokenExpAsDate()
      Returns the refresh token exp as date.
      Returns:
      the refresh token exp as date.
    • getExpAsCalendar

      public Calendar 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

      public List<String> getAud()
      Returns the aud.
      Returns:
      the aud.
    • getJti

      public String getJti()
      Returns the jti.
      Returns:
      the jti.
    • getSub

      public String getSub()
      Returns the sub.
      Returns:
      the sub.
    • getEmail

      public String getEmail()
      Returns the email.
      Returns:
      the email.
    • getFamily

      public String getFamily()
      Returns the family name.
      Returns:
      the family name.
    • getGiven

      public String getGiven()
      Returns the given name.
      Returns:
      the given name.
    • getUserName

      public String getUserName()
      Returns the preferred username.
      Returns:
      the preferred username.
    • getDisplayName

      public String getDisplayName()
      Returns the name.
      Returns:
      the name.
    • getResourceAccess

      protected org.json.simple.JSONObject getResourceAccess()
      Returns the resource access.
      Returns:
      the resource access.
    • getResourceAccessKeys

      protected Iterator<String> getResourceAccessKeys()
      Returns the resource access keys.
      Returns:
      the resource access keys.
    • getResourceAccessRoles

      public List<String> getResourceAccessRoles(String resource)
      Returns the resource access roles.
      Parameters:
      resource - the resource.
      Returns:
      the roles.
    • getResourceNameToAccessRolesMap

      public Map<String,List<String>> getResourceNameToAccessRolesMap(List<String> resourcesToSkip)
      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

      public List<String> getAuthorizationPermissionRSNames()
      Returns the authorization permission RS names.
      Returns:
      the names.
    • getAuthorizationPermissionRSNameResourceScopes

      public List<String> getAuthorizationPermissionRSNameResourceScopes(String rsname)
      Returns the authorization permission RS name resource scopes.
      Parameters:
      rsname - the RS name.
      Returns:
      the scopes.
    • getAuthorizationPermissionRSNameToResourceScopesMap

      public Map<String,List<String>> getAuthorizationPermissionRSNameToResourceScopesMap()
      Returns the authorization permission RS name to resource scopes map.
      Returns:
      the map.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getTokenEssentials

      public String getTokenEssentials()
      Returns the token essentials.
      Returns:
      the token essentials.