Record Class SignedLinkToken

java.lang.Object
java.lang.Record
io.leandev.appfuse.security.link.SignedLinkToken
Record Components:
subject - 身分識別(不透明字串,如 email / username)
purpose - 連結用途(消費端自定義,如 passwordless-login / event-action)
target - 導向目標(相對路徑,可為 null / 空字串表示預設首頁)
attributes - 泛用屬性袋(consume 後原樣取回;不可為 null,缺省為空 Map)
jti - JWT ID(SINGLE_USE 的單次性鍵)
issuedAt - 簽發時間
expiresAt - 過期時間
redemption - 贖回政策

public record SignedLinkToken(String subject, String purpose, String target, Map<String,Object> attributes, String jti, Instant issuedAt, Instant expiresAt, LinkRedemption redemption) extends Record

已解析的簽章連結 token

SignedLinkService.consume(String) 驗章成功後回傳的不可變結果,承載連結攜帶的語意: 身分(subject)、用途(purpose)、導向目標(target)與泛用屬性袋(attributes)。

本型別租戶中性:不認得 Account / tenant / email。需要攜帶租戶等應用層脈絡時, 由消費端在 SignedLinkSpecattributes 放入,consume 後原樣取回。

Since:
1.0
  • Constructor Details

    • SignedLinkToken

      public SignedLinkToken(String subject, String purpose, String target, Map<String,Object> attributes, String jti, Instant issuedAt, Instant expiresAt, LinkRedemption redemption)
      Creates an instance of a SignedLinkToken record class.
      Parameters:
      subject - the value for the subject record component
      purpose - the value for the purpose record component
      target - the value for the target record component
      attributes - the value for the attributes record component
      jti - the value for the jti record component
      issuedAt - the value for the issuedAt record component
      expiresAt - the value for the expiresAt record component
      redemption - the value for the redemption record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • subject

      public String subject()
      Returns the value of the subject record component.
      Returns:
      the value of the subject record component
    • purpose

      public String purpose()
      Returns the value of the purpose record component.
      Returns:
      the value of the purpose record component
    • target

      public String target()
      Returns the value of the target record component.
      Returns:
      the value of the target record component
    • attributes

      public Map<String,Object> attributes()
      Returns the value of the attributes record component.
      Returns:
      the value of the attributes record component
    • jti

      public String jti()
      Returns the value of the jti record component.
      Returns:
      the value of the jti record component
    • issuedAt

      public Instant issuedAt()
      Returns the value of the issuedAt record component.
      Returns:
      the value of the issuedAt record component
    • expiresAt

      public Instant expiresAt()
      Returns the value of the expiresAt record component.
      Returns:
      the value of the expiresAt record component
    • redemption

      public LinkRedemption redemption()
      Returns the value of the redemption record component.
      Returns:
      the value of the redemption record component