Class PreviewToken

  • All Implemented Interfaces:
    Serializable

    public class PreviewToken
    extends Object
    implements Serializable
    The response object used to provide the details of the preview token as well as the token itself.
    Author:
    Nick Crum (ncrum)
    See Also:
    Serialized Form
    • Constructor Detail

      • PreviewToken

        public PreviewToken()
    • Method Detail

      • matchesContext

        public boolean matchesContext​(ContextRequest contextRequest)
        Validates whether or not this preview token matches the provided OperationType and ContextRequest.

        A preview token is considered a match for a context when the following are all true:

        • The context includes a sandbox
        • The token includes a matching claim for the context's sandbox
        • The token includes a matching claim for the context's tenant
        • The token includes a matching claim for the context's application
        Parameters:
        contextRequest - the request context
        Returns:
        whether or not the context is a match
      • getToken

        public String getToken()
        The token string that is used to authorize that a request has access to preview data for a given sandbox.

        This token should be provided as part of the `X-Context-Request` header as the `previewToken` property along with the `sandboxId` the user wishes to access.

      • getExpirationTime

        public Instant getExpirationTime()
        The expiration time of the preview token in UTC. This is used to inform clients of when to expect the token to be expired.
      • getAuthor

        public String getAuthor()
        The username of the author associated with the preview token.
      • getSandboxIds

        public Set<String> getSandboxIds()
        The set of sandbox IDs the preview token is authorized for.
      • getTenantId

        public String getTenantId()
        The ID of the tenant this preview token is authorized for.
      • getApplicationId

        public String getApplicationId()
        The ID of the application this preview token is authorized for.
      • setToken

        public void setToken​(String token)
        The token string that is used to authorize that a request has access to preview data for a given sandbox.

        This token should be provided as part of the `X-Context-Request` header as the `previewToken` property along with the `sandboxId` the user wishes to access.

      • setExpirationTime

        public void setExpirationTime​(Instant expirationTime)
        The expiration time of the preview token in UTC. This is used to inform clients of when to expect the token to be expired.
      • setAuthor

        public void setAuthor​(String author)
        The username of the author associated with the preview token.
      • setSandboxIds

        public void setSandboxIds​(Set<String> sandboxIds)
        The set of sandbox IDs the preview token is authorized for.
      • setTenantId

        public void setTenantId​(String tenantId)
        The ID of the tenant this preview token is authorized for.
      • setApplicationId

        public void setApplicationId​(String applicationId)
        The ID of the application this preview token is authorized for.
      • canEqual

        protected boolean canEqual​(Object other)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object