Enum Class OAuth2ErrorCode
- All Implemented Interfaces:
Serializable, Comparable<OAuth2ErrorCode>, Constable
OAuth2 Error Code Enum
OAuth2 错误码枚举
Defines all error codes for OAuth2 operations.
定义所有 OAuth2 操作的错误码。
Error Code Ranges | 错误码范围:
- 7001-7020: Token errors - Token 错误
- 7021-7040: Authorization errors - 授权错误
- 7041-7060: Provider errors - Provider 错误
- 7061-7070: PKCE errors - PKCE 错误
- 7071-7080: Network errors - 网络错误
- 7081-7090: Configuration errors - 配置错误
Features | 主要功能:
- Standard OAuth2 error code enumeration - 标准OAuth2错误码枚举
- RFC 6749 compliant error codes - 符合RFC 6749的错误码
- Human-readable error descriptions - 可读的错误描述
Usage Examples | 使用示例:
// Check error codes in OAuth2 responses
// 检查OAuth2响应中的错误码
OAuth2ErrorCode code = OAuth2ErrorCode.INVALID_GRANT;
String description = code.getDescription();
Security | 安全性:
- Thread-safe: Yes (immutable enum) - 线程安全: 是(不可变枚举)
- Null-safe: Yes - 空值安全: 是
- Since:
- JDK 25, opencode-base-oauth2 V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAccess denied 访问被拒绝Authorization denied by user 用户拒绝授权Authorization failed 授权失败Authorization pending (device code flow) 授权待定(设备码流程)Authorization code expired 授权码已过期Device code endpoint not supported 设备码端点不支持OIDC discovery failed OIDC 发现失败OIDC discovery returned invalid response OIDC 发现返回无效响应Token introspection failed Token 内省失败Token introspection not supported Token 内省不支持Invalid OAuth2 configuration 无效的 OAuth2 配置Invalid authorization grant 无效的授权许可Invalid PKCE verifier 无效的 PKCE 验证器Invalid response 无效的响应Invalid scope 无效的权限范围Invalid state parameter 无效的 state 参数Authorization server issuer mismatch 授权服务器颁发者不匹配Client ID is required Client ID 是必需的Client secret is required Client Secret 是必需的Redirect URI is required Redirect URI 是必需的Token endpoint is required Token 端点是必需的Network error 网络错误Pushed authorization request failed 推送授权请求失败Pushed authorization requests not supported 推送授权请求不支持PKCE error PKCE 错误PKCE is required PKCE 是必需的OAuth2 provider error OAuth2 Provider 错误OAuth2 provider not found OAuth2 Provider 未找到Token revocation not supported Token 撤销不支持Server error 服务器错误Slow down polling (device code flow) 降低轮询频率(设备码流程)Request timeout 请求超时Token has expired Token 已过期Token is invalid Token 无效Token not found Token 未找到Token parse error Token 解析错误Failed to refresh token Token 刷新失败Token has been revoked Token 已被撤销Token store error Token 存储错误User info endpoint not supported 用户信息端点不支持 -
Method Summary
Modifier and TypeMethodDescriptionintcode()Get the error code number 获取错误码数字message()Get the error message 获取错误消息toString()static OAuth2ErrorCodeReturns the enum constant of this class with the specified name.static OAuth2ErrorCode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
TOKEN_EXPIRED
Token has expired Token 已过期 -
TOKEN_INVALID
Token is invalid Token 无效 -
TOKEN_REFRESH_FAILED
Failed to refresh token Token 刷新失败 -
TOKEN_REVOKED
Token has been revoked Token 已被撤销 -
TOKEN_STORE_ERROR
Token store error Token 存储错误 -
TOKEN_NOT_FOUND
Token not found Token 未找到 -
TOKEN_PARSE_ERROR
Token parse error Token 解析错误 -
AUTHORIZATION_FAILED
Authorization failed 授权失败 -
AUTHORIZATION_DENIED
Authorization denied by user 用户拒绝授权 -
INVALID_GRANT
Invalid authorization grant 无效的授权许可 -
INVALID_SCOPE
Invalid scope 无效的权限范围 -
INVALID_STATE
Invalid state parameter 无效的 state 参数 -
CODE_EXPIRED
Authorization code expired 授权码已过期 -
AUTHORIZATION_PENDING
Authorization pending (device code flow) 授权待定(设备码流程) -
SLOW_DOWN
Slow down polling (device code flow) 降低轮询频率(设备码流程) -
ACCESS_DENIED
Access denied 访问被拒绝 -
PROVIDER_NOT_FOUND
OAuth2 provider not found OAuth2 Provider 未找到 -
PROVIDER_ERROR
OAuth2 provider error OAuth2 Provider 错误 -
USERINFO_NOT_SUPPORTED
User info endpoint not supported 用户信息端点不支持 -
REVOCATION_NOT_SUPPORTED
Token revocation not supported Token 撤销不支持 -
DEVICE_CODE_NOT_SUPPORTED
Device code endpoint not supported 设备码端点不支持 -
PKCE_ERROR
PKCE error PKCE 错误 -
PKCE_REQUIRED
PKCE is required PKCE 是必需的 -
INVALID_PKCE_VERIFIER
Invalid PKCE verifier 无效的 PKCE 验证器 -
NETWORK_ERROR
Network error 网络错误 -
TIMEOUT
Request timeout 请求超时 -
SERVER_ERROR
Server error 服务器错误 -
INVALID_RESPONSE
Invalid response 无效的响应 -
INVALID_CONFIG
Invalid OAuth2 configuration 无效的 OAuth2 配置 -
MISSING_CLIENT_ID
Client ID is required Client ID 是必需的 -
MISSING_CLIENT_SECRET
Client secret is required Client Secret 是必需的 -
MISSING_REDIRECT_URI
Redirect URI is required Redirect URI 是必需的 -
MISSING_TOKEN_ENDPOINT
Token endpoint is required Token 端点是必需的 -
DISCOVERY_FAILED
OIDC discovery failed OIDC 发现失败 -
DISCOVERY_INVALID_RESPONSE
OIDC discovery returned invalid response OIDC 发现返回无效响应 -
INTROSPECTION_FAILED
Token introspection failed Token 内省失败 -
INTROSPECTION_NOT_SUPPORTED
Token introspection not supported Token 内省不支持 -
PAR_FAILED
Pushed authorization request failed 推送授权请求失败 -
PAR_NOT_SUPPORTED
Pushed authorization requests not supported 推送授权请求不支持 -
ISSUER_MISMATCH
Authorization server issuer mismatch 授权服务器颁发者不匹配
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
code
public int code()Get the error code number 获取错误码数字- Returns:
- the error code | 错误码
-
message
-
toString
- Overrides:
toStringin classEnum<OAuth2ErrorCode>
-