Class OAuth2TokenException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.leandev.appfuse.security.auth.OAuth2TokenException
- All Implemented Interfaces:
Serializable
token 端點的錯誤(RFC 6749 §5.2)
承載線層級的錯誤碼與 HTTP 狀態,由消費端的殼依方言序列化
(OAuth2 方言 → {"error": ..., "error_description": ...};其他方言可映為自家形狀)。
刻意不繼承 AuthenticationException:本例外家族涵蓋 invalid_request /
unsupported_grant_type / invalid_scope 等非認證失敗的請求錯誤,掛進認證例外家族
會讓消費端既有的認證例外處理誤攔。
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionOAuth2TokenException(String error, int status, String description) OAuth2TokenException(String error, int status, String description, Throwable cause) 建立保留原始拒絕例外的 token 錯誤。 -
Method Summary
Modifier and TypeMethodDescription錯誤描述(error_description);等同Throwable.getMessage()getError()intstatic OAuth2TokenExceptioninvalidClient(String description) client 憑證失敗;保留實際診斷,由 response policy 決定揭露程度。static OAuth2TokenExceptioninvalidClient(String description, Throwable cause) client 憑證失敗並保留底層認證例外。static OAuth2TokenExceptioninvalidRequest(String description) 請求本身有問題(缺參數、同時使用兩種 client 認證方式、Basic 標頭格式錯誤)static OAuth2TokenException請求了 scope 但本端點尚未支援(ClientCredentialsService決策:不得靜默忽略, 否則呼叫端會誤以為權限已收窄)static OAuth2TokenException速率限制逾額static OAuth2TokenExceptiongrant_type 非本端點支援者Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
OAuth2TokenException
-
OAuth2TokenException
-
-
Method Details
-
getError
-
getStatus
public int getStatus() -
getDescription
錯誤描述(error_description);等同Throwable.getMessage() -
invalidRequest
請求本身有問題(缺參數、同時使用兩種 client 認證方式、Basic 標頭格式錯誤) -
unsupportedGrantType
grant_type 非本端點支援者 -
invalidScope
請求了 scope 但本端點尚未支援(ClientCredentialsService決策:不得靜默忽略, 否則呼叫端會誤以為權限已收窄) -
invalidClient
client 憑證失敗;保留實際診斷,由 response policy 決定揭露程度。 -
invalidClient
client 憑證失敗並保留底層認證例外。 -
rateLimited
速率限制逾額
RFC 6749 §5.2 無對應的 token 端點錯誤碼——限流屬 HTTP 層關注、標準呼叫端依狀態碼 (429)處理。此處取語意最近的
temporarily_unavailable(§4.1.2.1)作為 body 的錯誤碼。
-