Class IntrospectionResult

java.lang.Object
org.gcube.common.iam.IntrospectionResult

public class IntrospectionResult extends Object
Typed result of a token introspection (D4ScienceIAMClient.introspect(String, String, String), RFC 7662), as answered by the IAM server. The claims are those the IAM server reports for the token: callers use them instead of decoding the token themselves, so that the IAM stays the only component that knows which issuers are accepted (federation).

An inactive token carries no claims: every accessor then returns an empty value.

  • Method Details

    • isActive

      public boolean isActive()
      Returns:
      true when the IAM server considers the token valid (signature, expiry, revocation, issuer)
    • getSubject

      public String getSubject()
      Returns:
      the sub claim, null if inactive
    • getPreferredUsername

      public String getPreferredUsername()
      Returns:
      the preferred_username (or username) claim
    • getIssuer

      public String getIssuer()
      Returns:
      the iss claim as reported by the IAM server
    • getAudience

      public String[] getAudience()
      Returns:
      the aud claim (empty if absent)
    • getAuthorizedParty

      public String getAuthorizedParty()
      Returns:
      the azp claim
    • getClientId

      public String getClientId()
      Returns:
      the client_id claim
    • getTokenType

      public String getTokenType()
      Returns:
      the token_type claim (or typ)
    • getScope

      public String getScope()
      Returns:
      the scope claim, space separated
    • getScopes

      public List<String> getScopes()
      Returns:
      the scopes as a list (empty if none)
    • getExpiry

      public Long getExpiry()
      Returns:
      the exp claim in seconds since the epoch, null if absent
    • getIssuedAt

      public Long getIssuedAt()
      Returns:
      the iat claim in seconds since the epoch, null if absent
    • getEmail

      public String getEmail()
      Returns:
      the email claim
    • getResourceAccessRoles

      public Map<String,Set<String>> getResourceAccessRoles()
      Returns:
      the roles per resource (resource_access)
    • getRealmRoles

      public Set<String> getRealmRoles()
      Returns:
      the realm roles (realm_access)
    • getClaims

      public Map<String,Object> getClaims()
      Returns:
      the claims of the answer not mapped to a typed accessor (read only)
    • toString

      public String toString()
      Overrides:
      toString in class Object