Documentation
¶
Overview ¶
Package devidentity is `forge env up`'s half of managed identity: it converges an env whose identity runs on the env's own host-run Zitadel (forge.IdentityOnHost) with the SAME library the control plane runs against hosted instances, pkg/identity.
What differs from the hosted path is only where things are written:
- the non-secret outputs go to .forge/identity/<name>.json;
- every secret (the broker token, a web client secret, machine keys) goes to the env's local secret store, under the env-var name each consumer's forge.IdentityRef resolves to, so a host-run process is handed jwt_issuer, jwt_audience, oidc_*, idp_base and idp_broker_token with nothing copied by hand;
- the env lands in the Zitadel server's DEFAULT instance. The dev IdP answers only to localhost, so there is no per-instance hostname and no System API: that path is covered by the docker smoke against the real image instead.
The package performs no process management and reads no KCL. The caller resolves everything it needs into Input.
Index ¶
- func MachineKeyStoreKey(user string) string
- func OutputKeys(out identity.Output) map[string]string
- func Spec(in Input) (identity.Spec, []string, error)
- func StoreValues(in Input, out identity.Output, machineKey func(user string) ([]byte, error)) (map[string]string, error)
- func Token(s string) string
- type Input
- type Ref
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MachineKeyStoreKey ¶
MachineKeyStoreKey is the secret-store key a machine user's key document is kept under: <USER>_MACHINE_KEY.
func OutputKeys ¶
OutputKeys is the identity's outputs under the delivered key names the KCL render lowers an IdentityRef to (ISSUER, AUDIENCE, <APP>_CLIENT_ID, ...).
func Spec ¶
Spec derives the library's declaration from the rendered shape. Redirect, logout and login URIs are DERIVED from the env's origins unless the declaration gives a literal.
func StoreValues ¶
func StoreValues(in Input, out identity.Output, machineKey func(user string) ([]byte, error)) (map[string]string, error)
StoreValues maps the outputs onto secret-store keys. Each host workload's identity-backed env var gets the value its reference points at, under the variable's own name, because that is the key a host launch resolves a secret reference by. A reference whose output does not exist this pass (a snapshot that could not be taken) is simply absent.
Types ¶
type Input ¶
type Input struct {
// Project is the Bundle's project, the identity project's name unless the
// declaration sets project_name.
Project string
// Identity is the rendered declaration. Its runtime must be "host".
Identity *release.ShapeIdentity
// BaseURL is the origin the dev IdP is dialled (and registered) at, e.g.
// http://localhost:8080. It is also the issuer.
BaseURL string
// PATPath is the bootstrap service account's personal access token file.
PATPath string
// FrontendOrigin is the browser-facing origin (http://localhost:3000 plus
// the frontend's base path). The sign-in and callback routes are derived
// from it. Empty falls back to WorkloadOrigins.
FrontendOrigin string
// WorkloadOrigins maps a workload to the origin it listens on, for an
// application whose sign-in route has no frontend to live on.
WorkloadOrigins map[string]string
// Refs are the identity-backed env vars of the env's host workloads.
Refs []Ref
// Secret resolves a value from the env's secret store by name (seed-user
// and SMTP passwords).
Secret func(name string) (string, bool)
// StorePath is the local secret store credentials are written to.
StorePath string
// OutputsPath is the non-secret outputs file, .forge/identity/<name>.json.
OutputsPath string
// KeysDir is the library's own memory of the credentials it issued.
KeysDir string
Logger *slog.Logger
}
Input is everything one convergence needs.
type Ref ¶
type Ref struct {
// EnvName is the variable the process reads, and so the secret-store key.
EnvName string
// SecretName and SecretKey are what the render lowered the reference to:
// Secret forge-identity-<name>, key ISSUER, DEV_API_CLIENT_ID, ...
SecretName string
SecretKey string
}
Ref is one secret-backed env var of a host process: the shape of forge.IdentityRef after the render lowered it for a host-run identity.