How ory/hydra works
Ory Hydra is a standalone OAuth 2.0 and OpenID Connect server that delegates user authentication and consent to an external application. A client or user agent starts an authorization flow; Hydra coordinates login and consent, issues a code or token, and supports subsequent token validation and lifecycle operations. The repository also provides client and JWKS administration, device authorization, trusted JWT grants, and operational CLI/server configuration. The source index confirms the server handler’s connections to these subsystems; several feature-specific implementation links are documented by capability or remain unverified because their sources were not excerpted.
Main entry points: server/handler.go HTTP server routing · oauth2/handler.go OAuth endpoints · consent/handler.go Login and consent orchestration · authorize_request_handler.go OAuth/OIDC engine
Components 18
Server runtime
- HTTP server routing
cmd/server/handler.go - Configuration and wiring
driver/config/config.go
OAuth and OIDC
- OAuth endpoints
oauth2/handler.go - OAuth/OIDC engine
fosite/authorize_request_handler.go - Device authorization
fosite/handler/rfc8628/token_handler.go
Login and consent
- Login and consent orchestration
consent/handler.go - Authorization flow state
flow/flow.go
Administration
- Client management
client/handler.go - JWKS management
jwk/handler.go - Trusted JWT grants
oauth2/trust/handler.go - CLI operations
cmd/cmd_perform.go
Keys and persistence
- Signing key manager
jwk/manager.go - Hardware key manager
hsm/manager_hsm.go - SQL persistence
persistence/sql/persister.go - Client storage and auth
client/manager.go
Other components
- OAuth client / user agent
- Login and consent app
- Operator
Connections 20
- OAuth client / user agent → HTTP server routing: sends requests
README.md - HTTP server routing → OAuth endpoints: routes to
cmd/server/handler.go - OAuth endpoints → OAuth/OIDC engine: calls protocol
oauth2/handler.go - OAuth/OIDC engine → Login and consent orchestration: requests interaction
README.md - Login and consent orchestration → Login and consent app: redirects for decisions
README.md - Login and consent orchestration → Authorization flow state: manages flow state
- OAuth endpoints → OAuth client / user agent: redirects with result
README.md - OAuth client / user agent → OAuth endpoints: exchanges code
README.md - HTTP server routing → Device authorization: serves device flow
- HTTP server routing → Client management: routes to
cmd/server/handler.go - HTTP server routing → JWKS management: routes to
cmd/server/handler.go - HTTP server routing → Trusted JWT grants: routes to
- Operator → CLI operations: runs commands
- CLI operations → HTTP server routing: calls admin API
- HTTP server routing → Configuration and wiring: uses configuration
cmd/server/handler.go - OAuth endpoints → Signing key manager: uses signing keys
- Signing key manager → Hardware key manager: delegates key operations
- OAuth endpoints → SQL persistence: persists OAuth state
- Client management → Client storage and auth: manages clients
- Client storage and auth → SQL persistence: stores client records