Class AccessToken

    • Constructor Detail

      • AccessToken

        public AccessToken()
      • AccessToken

        public AccessToken​(AccessToken other)
    • Method Detail

      • getMember

        public Member getMember()
        Returns the Member this token allows to sign in
        Returns:
        a Member id
      • setMember

        public void setMember​(Member member)
        Set the Member this token allows to sign in
        Parameters:
        member -
      • getMemberId

        public java.lang.String getMemberId()
        Returns the id of the member this token allows to sign in
        Returns:
        a Member id
      • setMemberId

        public void setMemberId​(java.lang.String memberId)
        Sets the id of the Member that this AccessToken allow to sign in
        Parameters:
        memberId - the id of the Member
      • getFingerprint

        public java.lang.String getFingerprint()
        Retrieve the token fingerprint.
        Returns:
        a unique signature of the token
      • setFingerprint

        public void setFingerprint​(java.lang.String fingerprint)
        Set the token fingerprint.
        Parameters:
        fingerprint - a unique value identifying the token value (must fit in 256 characters)
      • getTokenType

        public java.lang.String getTokenType()
        Retrieve the type of authentication Token (jwt/authkey)
        Returns:
        "JWT" or "AUTHKEY", null if unknown
      • setTokenType

        public void setTokenType​(java.lang.String tokenType)
        Set the type of authentication Token (jwt/authkey)
        Parameters:
        tokenType - "JWT" or "AUTHKEY", null if unknown
      • getName

        public java.lang.String getName()
        Retrieve the name describing the token
        Returns:
        a name or null if it was not specified
      • setName

        public void setName​(java.lang.String name)
        Set the name describing the token
        Parameters:
        name - a text describing the token
      • getUrl

        public java.lang.String getUrl()
        Retrieve the URL for which the token was emitted.
        Returns:
        an URL
      • setUrl

        public void setUrl​(java.lang.String url)
        Set the URL for which the token is emitted.
        Parameters:
        url - an URL
      • isPrefixMode

        public boolean isPrefixMode()
        Retrieve wether token was emitted in prefix or exact mode
        Returns:
        true if token is prefix mode, false if token is in exact mode
      • setPrefixMode

        public void setPrefixMode​(java.lang.Boolean prefixMode)
        Set wether token is in prefix or exact mode
        Parameters:
        prefixMode - true if token is prefix mode, false if token is in exact mode
      • getMethods

        public java.lang.String getMethods()
        Retrieve methods accepted by token
        Returns:
        a coma separated list of HTTP methods accepted for token
      • setMethods

        public void setMethods​(java.lang.String methods)
        Set methods accepted by token
        Parameters:
        methods - a coma separated list of HTTP methods accepted for token
      • getIpMask

        public java.lang.String getIpMask()
        Retrieve regular expression used to match IP authorized for this token
        Returns:
        a regular expression
      • setIpMask

        public void setIpMask​(java.lang.String ipMask)
        Set regular expression to use to match IP authorized for this token
        Parameters:
        ipMask - a regular expression
      • getExpirationDate

        public java.util.Date getExpirationDate()
        Retrieve the expiration date that was intially computed when the Authentication key was sent.

        This date is informative and is used for automatic purge of expired keys.
        However it may not be completely accurate if any max age configuration is changed, either globally for site settings or for the Member (though its groups).

        Returns:
        the Date at which the key is considered expired, may return null
      • setExpirationDate

        public void setExpirationDate​(java.util.Date expirationDate)
        Set the expiration date of this AccessToken.
        Parameters:
        expirationDate - a Date after which this AccessToken can be deleted/purged.
      • isTechnical

        public boolean isTechnical()
        Check if this token was created manually or programmatically
        Returns:
        true if token was created automatically by a program, false if token was created manually by a user action in the token manager UI
      • setTechnical

        public void setTechnical​(java.lang.Boolean technical)
        Set if this token was created manually or programmatically
        Parameters:
        technical - true if token was created automatically by a program, false if token was created manually by a user action in the token manager UI
      • getLastUsedDate

        public java.util.Date getLastUsedDate()
        Retrieve the date this AccessToken was last used.
        Returns:
        a Date or null if it was never used.
      • setLastUsedDate

        public void setLastUsedDate​(java.util.Date lastUsedDate)
        Set the date this AccessToken was last used.
        Parameters:
        lastUsedDate - Date or null to indicated it was never used.
      • getUseCount

        public long getUseCount()
        Retrieve the number of time this AccessToken was used
        Returns:
        a count
      • setUseCount

        public void setUseCount​(java.lang.Long useCount)
        Set the number of time this AccessToken was used
        Parameters:
        useCount - the use count to assign
      • incrementUseCount

        public void incrementUseCount()
        Increment the use count of this access token by one.
      • getDataName

        public java.lang.String getDataName​(java.lang.String language)
        Description copied from class: Data
        Return the name of this Data, every sub class Data which will be displayed to user should implements this method already.
        • The Title (multi-language) for a Publication.
        • The Name (multi-language) for a Category.
        • The Name for a Group, a Member.
        • The Title (multi-language) for a Workspace.
        Can be seen as a smart multi-language toString(), but never returning null.
        Default behaviour is to return toFullString() of Data or empty string if toFullString is null.
        Overrides:
        getDataName in class Data
        Parameters:
        language - the language in which to return the name if multilang available for the data.
        Returns:
        a String, MUST NOT return null.
      • canBeReadBy

        public boolean canBeReadBy​(Member member,
                                   boolean searchInGroups,
                                   RightInfo rightInfo)
        Description copied from class: Data
        Checks if the specified member is authorized to read this Data.
        Overrides:
        canBeReadBy in class Data
        Parameters:
        member - the member to check (may be null for anonymous user)
        searchInGroups - set to true to check for read right authorization using Member's group(s).
        rightInfo - a RightInfo instance in which explanation of read right authorization acceptance or refusal will be indicated. Value is required and cannot be null.
        Returns:
        true if the member can read this Data, false otherwise