Interface ClientCredentialsRateLimiter

All Known Implementing Classes:
CacheClientCredentialsRateLimiter
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface ClientCredentialsRateLimiter

token 端點的速率限制接點(ADR-025 決策四)

置於憑證比對之前——目的是保護密碼雜湊的 CPU(每次比對一次 bcrypt ≈ 100ms,端點又是 公開的),不是防猜測:client_secret 為高熵隨機值,暴力破解本就不可行。

框架不提供實作——無 bean 時不限流ClientCredentialsServiceOptional 依賴)。 儲存策略(本機快取/Redis)與門檻歸消費端。

  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    allow(String clientId)
    是否允許本次請求
  • Method Details

    • allow

      boolean allow(String clientId)
      是否允許本次請求
      Parameters:
      clientId - 請求宣稱的 client_id;未提供時由呼叫端以來源位址等替代鍵帶入
      Returns:
      true 放行;false → OAuth2TokenException.rateLimited()(HTTP 429)