Documentation
¶
Overview ¶
Package kratos is backplane-kratos as a library: Main runs it. It joins an Ory Kratos installation to Backplane: the courier's messages and the self-service flows become hooks and events, the admin API becomes activities and a console module, and the settings an operator edits are written to a configuration overlay Kratos reloads.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoKey = errors.New("kratos: callbacks.key or backplane.internal_secret is required")
ErrNoKey: neither a callbacks key nor an internal secret is configured.
var ErrOverlayMode = errors.New("kratos: overlay_mode must be octal permission bits like 0640")
ErrOverlayMode: overlay_mode is not octal permission bits.
Functions ¶
Types ¶
type Callbacks ¶
type Callbacks struct {
Listen string `json:"listen" schemapb:"default=:8090"`
// URL is the listener as Kratos reaches it.
URL string `json:"url" schemapb:"default=http://127.0.0.1:8090"`
// Key authenticates Kratos; empty: derived from the internal secret,
// the same on every replica.
Key config.Secret `json:"key,omitempty"`
}
Callbacks listener.
type Config ¶
type Config struct {
config.Backplane `json:"backplane"`
// Kratos is the installation.
Kratos Connection `json:"kratos"`
// Callbacks is the listener Kratos calls (courier, hooks, events).
Callbacks Callbacks `json:"callbacks"`
// Overlay is the file Kratos loads after its own (-c base -c overlay),
// shared with the Kratos container; empty: nothing is written, the
// console shows the configuration to paste.
Overlay string `json:"overlay,omitempty" schemapb:"description=Path of the overlay file Kratos loads (empty: snippets only)"`
// OverlayMode is the file's permission bits (octal): Kratos's user
// must read it.
OverlayMode string `json:"overlay_mode,omitempty" schemapb:"default=0644"`
// Settings are Kratos's settings rendered into the overlay; live.
Settings config.Live[overlay.Settings] `json:"settings"`
// OIDCSecrets are the OIDC providers' client secrets by provider id;
// live, kept apart from the settings.
OIDCSecrets config.Live[map[string]config.Secret] `json:"oidc_secrets,omitempty" schemapb:"description=Client secrets of the OIDC providers by provider id"`
// OAuth2ProviderHeaders go with Kratos's requests to Hydra; live.
OAuth2ProviderHeaders config.Live[map[string]config.Secret] `json:"oauth2_provider_headers,omitempty" schemapb:"description=Headers of Kratos's requests to Hydra's admin API"`
// TokenKey is the private JWK (JSON) session tokens are signed with; its
// public key must be the first of settings.tokens.keys. Live, a secret.
TokenKey config.Live[config.Secret] `json:"token_key,omitempty" schemapb:"description=Private JWK the session tokens are signed with (empty: no tokens)"`
// FailOpen names flow hooks whose failure lets the flow continue.
FailOpen config.Live[[]string] `json:"fail_open,omitempty" schemapb:"description=Flow hooks (e.g. AfterLogin) whose failure lets the flow continue"`
}
Config is the whole configuration: file (BACKPLANE_CONFIG_FILE) < env KRATOS_* (BACKPLANE_* for the SDK block) < Consul KV for Live fields.
type Connection ¶
type Connection struct {
AdminURL string `json:"admin_url" schemapb:"default=http://127.0.0.1:4434"`
PublicURL string `json:"public_url" schemapb:"default=http://127.0.0.1:4433"`
Headers map[string]config.Secret `json:"headers,omitempty" schemapb:"description=Headers of every request (a proxy's authorization)"`
Timeout time.Duration `json:"timeout" schemapb:"default=10s"`
}
Connection to Kratos.
type State ¶
type State struct {
// Kratos is the installation, probed for the console's health but not
// part of readiness: Kratos calls this service (webhooks), so it starts
// after it is ready.
Kratos deps.Optional[ory.Client]
Flows *flows.Flows
Applier *apply.Applier
Activities *activities.Activities
Admin *admin.Admin
// contains filtered or unexported fields
}
State is the service's tree.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
kratos
command
Command kratos runs backplane-kratos.
|
Command kratos runs backplane-kratos. |
|
internal
|
|
|
activities
Package activities offers Kratos's admin API to wiring: identities, credentials, sessions, recovery and the courier's queue.
|
Package activities offers Kratos's admin API to wiring: identities, credentials, sessions, recovery and the courier's queue. |
|
admin
Package admin is the console module's API: the Kratos installation, its identities, sessions and courier, and the overlay.
|
Package admin is the console module's API: the Kratos installation, its identities, sessions and courier, and the overlay. |
|
apply
Package apply keeps the overlay file equal to the settings and the bound hooks: rendered at start, after every settings change and every binding change, and every resync interval (a file someone replaced).
|
Package apply keeps the overlay file equal to the settings and the bound hooks: rendered at start, after every settings change and every binding change, and every resync interval (a file someone replaced). |
|
events
Package events builds the payloads of backplane-kratos's events, whose contract is proto/kratos/events/v1.
|
Package events builds the payloads of backplane-kratos's events, whose contract is proto/kratos/events/v1. |
|
flows
Package flows turns Kratos's callbacks into Backplane hooks and events: the courier's messages (hook Deliver), the before/after points of the self-service flows (hooks Before<Flow>/After<Flow>) and the facts of completed flows (events).
|
Package flows turns Kratos's callbacks into Backplane hooks and events: the courier's messages (hook Deliver), the before/after points of the self-service flows (hooks Before<Flow>/After<Flow>) and the facts of completed flows (events). |
|
insight
Package insight finds settings that Kratos's schema accepts but that do not work together: a flow without its UI, links without the link method, codes with nowhere to go, nobody able to sign in.
|
Package insight finds settings that Kratos's schema accepts but that do not work together: a flow without its UI, links without the link method, codes with nowhere to go, nobody able to sign in. |
|
jwks
Package jwks serves the session tokens' public keys: services verify a token's signature with them (pkg/auth).
|
Package jwks serves the session tokens' public keys: services verify a token's signature with them (pkg/auth). |
|
ory
Package ory is a small client of an Ory Kratos installation: the admin API (identities, sessions, recovery, courier messages) and the parts of the public API an operator needs (identity schemas, whoami).
|
Package ory is a small client of an Ory Kratos installation: the admin API (identities, sessions, recovery, courier messages) and the parts of the public API an operator needs (identity schemas, whoami). |
|
overlay
Package overlay renders the Kratos configuration file backplane-kratos owns: the settings an operator edits in the console and the callbacks of bound hooks.
|
Package overlay renders the Kratos configuration file backplane-kratos owns: the settings an operator edits in the console and the callbacks of bound hooks. |
|
ui
Package ui carries the console module: web/dist/plugin copied here by `make web` and embedded into the binary.
|
Package ui carries the console module: web/dist/plugin copied here by `make web` and embedded into the binary. |
|
pkg
|
|
|
auth
Package auth tells a service who made a request, from the credentials Ory Kratos gives a signed-in user.
|
Package auth tells a service who made a request, from the credentials Ory Kratos gives a signed-in user. |
|
proto
|
|