Enum Class LinkRedemption

java.lang.Object
java.lang.Enum<LinkRedemption>
io.leandev.appfuse.security.link.LinkRedemption
All Implemented Interfaces:
Serializable, Comparable<LinkRedemption>, Constable

public enum LinkRedemption extends Enum<LinkRedemption>

簽章連結的贖回政策

決定一張 SignedLinkToken 在有效期內可被消費幾次,以及消費時是否需要 查詢 SignedLinkStore

Since:
1.0
  • Enum Constant Details

    • SINGLE_USE

      public static final LinkRedemption SINGLE_USE

      單次使用:簽章 + 未過期 + jti 原子消費。

      第一次 consume 成功後即失效(jti 自 store 移除),再次消費丟出 VerificationException。適用於免密碼登入、 session 換發 code 等「用過即廢」的連結。消費時會查詢並更新 store

    • REUSABLE

      public static final LinkRedemption REUSABLE

      可重複使用(僅時間保護):簽章 + 未過期即有效。

      在 TTL 視窗內可被多次消費,純 stateless JWT,不查詢 store。適用於事件 通知深連結等「使用者可能先點開瞭解、稍後再點處理」的情境;「同一動作不可 重複執行」應由目標資源自身的狀態把關,不是連結的責任。

  • Method Details

    • values

      public static LinkRedemption[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static LinkRedemption valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null