Enum Class OAuth2ErrorCode

java.lang.Object
java.lang.Enum<OAuth2ErrorCode>
cloud.opencode.base.oauth2.exception.OAuth2ErrorCode
All Implemented Interfaces:
Serializable, Comparable<OAuth2ErrorCode>, Constable

public enum OAuth2ErrorCode extends Enum<OAuth2ErrorCode>
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:
  • Enum Constant Details

    • TOKEN_EXPIRED

      public static final OAuth2ErrorCode TOKEN_EXPIRED
      Token has expired Token 已过期
    • TOKEN_INVALID

      public static final OAuth2ErrorCode TOKEN_INVALID
      Token is invalid Token 无效
    • TOKEN_REFRESH_FAILED

      public static final OAuth2ErrorCode TOKEN_REFRESH_FAILED
      Failed to refresh token Token 刷新失败
    • TOKEN_REVOKED

      public static final OAuth2ErrorCode TOKEN_REVOKED
      Token has been revoked Token 已被撤销
    • TOKEN_STORE_ERROR

      public static final OAuth2ErrorCode TOKEN_STORE_ERROR
      Token store error Token 存储错误
    • TOKEN_NOT_FOUND

      public static final OAuth2ErrorCode TOKEN_NOT_FOUND
      Token not found Token 未找到
    • TOKEN_PARSE_ERROR

      public static final OAuth2ErrorCode TOKEN_PARSE_ERROR
      Token parse error Token 解析错误
    • AUTHORIZATION_FAILED

      public static final OAuth2ErrorCode AUTHORIZATION_FAILED
      Authorization failed 授权失败
    • AUTHORIZATION_DENIED

      public static final OAuth2ErrorCode AUTHORIZATION_DENIED
      Authorization denied by user 用户拒绝授权
    • INVALID_GRANT

      public static final OAuth2ErrorCode INVALID_GRANT
      Invalid authorization grant 无效的授权许可
    • INVALID_SCOPE

      public static final OAuth2ErrorCode INVALID_SCOPE
      Invalid scope 无效的权限范围
    • INVALID_STATE

      public static final OAuth2ErrorCode INVALID_STATE
      Invalid state parameter 无效的 state 参数
    • CODE_EXPIRED

      public static final OAuth2ErrorCode CODE_EXPIRED
      Authorization code expired 授权码已过期
    • AUTHORIZATION_PENDING

      public static final OAuth2ErrorCode AUTHORIZATION_PENDING
      Authorization pending (device code flow) 授权待定(设备码流程)
    • SLOW_DOWN

      public static final OAuth2ErrorCode SLOW_DOWN
      Slow down polling (device code flow) 降低轮询频率(设备码流程)
    • ACCESS_DENIED

      public static final OAuth2ErrorCode ACCESS_DENIED
      Access denied 访问被拒绝
    • PROVIDER_NOT_FOUND

      public static final OAuth2ErrorCode PROVIDER_NOT_FOUND
      OAuth2 provider not found OAuth2 Provider 未找到
    • PROVIDER_ERROR

      public static final OAuth2ErrorCode PROVIDER_ERROR
      OAuth2 provider error OAuth2 Provider 错误
    • USERINFO_NOT_SUPPORTED

      public static final OAuth2ErrorCode USERINFO_NOT_SUPPORTED
      User info endpoint not supported 用户信息端点不支持
    • REVOCATION_NOT_SUPPORTED

      public static final OAuth2ErrorCode REVOCATION_NOT_SUPPORTED
      Token revocation not supported Token 撤销不支持
    • DEVICE_CODE_NOT_SUPPORTED

      public static final OAuth2ErrorCode DEVICE_CODE_NOT_SUPPORTED
      Device code endpoint not supported 设备码端点不支持
    • PKCE_ERROR

      public static final OAuth2ErrorCode PKCE_ERROR
      PKCE error PKCE 错误
    • PKCE_REQUIRED

      public static final OAuth2ErrorCode PKCE_REQUIRED
      PKCE is required PKCE 是必需的
    • INVALID_PKCE_VERIFIER

      public static final OAuth2ErrorCode INVALID_PKCE_VERIFIER
      Invalid PKCE verifier 无效的 PKCE 验证器
    • NETWORK_ERROR

      public static final OAuth2ErrorCode NETWORK_ERROR
      Network error 网络错误
    • TIMEOUT

      public static final OAuth2ErrorCode TIMEOUT
      Request timeout 请求超时
    • SERVER_ERROR

      public static final OAuth2ErrorCode SERVER_ERROR
      Server error 服务器错误
    • INVALID_RESPONSE

      public static final OAuth2ErrorCode INVALID_RESPONSE
      Invalid response 无效的响应
    • INVALID_CONFIG

      public static final OAuth2ErrorCode INVALID_CONFIG
      Invalid OAuth2 configuration 无效的 OAuth2 配置
    • MISSING_CLIENT_ID

      public static final OAuth2ErrorCode MISSING_CLIENT_ID
      Client ID is required Client ID 是必需的
    • MISSING_CLIENT_SECRET

      public static final OAuth2ErrorCode MISSING_CLIENT_SECRET
      Client secret is required Client Secret 是必需的
    • MISSING_REDIRECT_URI

      public static final OAuth2ErrorCode MISSING_REDIRECT_URI
      Redirect URI is required Redirect URI 是必需的
    • MISSING_TOKEN_ENDPOINT

      public static final OAuth2ErrorCode MISSING_TOKEN_ENDPOINT
      Token endpoint is required Token 端点是必需的
  • Method Details

    • values

      public static OAuth2ErrorCode[] 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 OAuth2ErrorCode 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
    • code

      public int code()
      Get the error code number 获取错误码数字
      Returns:
      the error code | 错误码
    • message

      public String message()
      Get the error message 获取错误消息
      Returns:
      the error message | 错误消息
    • toString

      public String toString()
      Overrides:
      toString in class Enum<OAuth2ErrorCode>