Ory Hydra 是一個以 Go 撰寫的開源 OAuth 2.0 / OpenID Connect server,採用 Apache 2.0 授權。它的設計理念是 headless——只負責授權協定層,不包含使用者管理、登入頁面或帳號系統,而是透過 login/consent app 整合既有的身份提供者。
| 規範 | 說明 | 狀態 |
|---|
| RFC 6749 | The OAuth 2.0 Authorization Framework | ✅ |
| RFC 6819 | OAuth 2.0 Threat Model and Security Considerations | ✅ |
| RFC 7009 | OAuth 2.0 Token Revocation | ✅ |
| RFC 7523 | JWT Profile for OAuth 2.0 Client Authentication | ✅ |
| RFC 7591 | OAuth 2.0 Dynamic Client Registration Protocol | ✅ |
| RFC 7592 | OAuth 2.0 Dynamic Client Registration Management Protocol | ✅ |
| RFC 7636 | Proof Key for Code Exchange (PKCE) | ✅ |
| RFC 7662 | OAuth 2.0 Token Introspection | ✅ |
| RFC 8628 | OAuth 2.0 Device Authorization Grant | ✅ |
| RFC 9126 | OAuth 2.0 Pushed Authorization Requests (PAR) | ✅ |
Hydra 通過 OpenID Foundation 認證,涵蓋以下 profile:
- Basic OP(
response_type=code)
- Implicit OP(
response_type=id_token、id_token token)
- Hybrid OP(
response_type=code id_token、code id_token token、code token)
- Config OP(發布 Discovery 設定資訊)
- Dynamic OP(支援動態註冊)
| Grant Type | 狀態 |
|---|
| Authorization Code | ✅ |
| Client Credentials | ✅ |
| Refresh Token | ✅ |
| Implicit | ✅(不建議使用) |
| Resource Owner Password Credentials (ROPC) | ⚠️ deprecated |
| JWT Assertion(RFC 7523) | ✅ |
| Device Code(RFC 8628) | ✅ |
Hydra 正朝 OAuth 2.1 的方向演進,但尚未完全達標:
| OAuth 2.1 要求 | Hydra 狀態 |
|---|
| 強制 PKCE | 可設定(enforced 或 enforced_for_public_clients) |
| 移除 Implicit Flow | 仍支援,但不建議使用 |
| 移除 ROPC | 標記為 deprecated,source code 中仍存在 |
| 強制 HTTPS | ✅ |
| 精確 redirect_uri 比對 | ✅ |
Hydra 支援兩種 Access Token 策略,可透過設定切換:
| 策略 | 說明 |
|---|
opaque(預設) | 不透明字串,需透過 Introspection 端點驗證 |
jwt | JWT 格式,Resource Server 可本地驗證 |