Documentation
¶
Overview ¶
Package auth serves /api/whoami, /api/login and /api/logout over marotte's own sign-in vault (internal/signin): the account the agent engine is answered from. It runs no kiro-cli.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is the /api/whoami, /api/login and /api/logout bundle for one backend of the vault.
func NewHandler ¶
NewHandler returns the routes over backend's sign-in in vault.
func (*Handler) RegisterRoutes ¶
RegisterRoutes wires GET /api/whoami, POST /api/login, GET /api/login/options and POST /api/logout onto mux.
type LoginOptions ¶ added in v0.12.0
type LoginOptions struct {
IDCStartURL string `json:"idc_start_url,omitempty"`
IDCRegion string `json:"idc_region,omitempty"`
BuilderID bool `json:"builder_id"`
IDC bool `json:"idc"`
}
LoginOptions is GET /api/login/options: which of marotte's two sign-in doors the administrator permits and the start URL to pre-fill.
type LoginResponse ¶ added in v0.15.0
type LoginResponse struct {
URL string `json:"url"`
Code string `json:"code"`
Attempt uint64 `json:"attempt"`
}
LoginResponse is POST /api/login's answer: what the user opens and enters, and the attempt whoami reports on, so a switch whose old account stays signed in is told apart from the new sign-in's outcome.
type Option ¶
type Option func(*Handler)
Option configures a Handler at construction time.
func WithAPIKey ¶ added in v0.15.0
WithAPIKey reports that the agent engine inherits KIRO_API_KEY: whoami names it, and login and logout are refused while it does, keeping the vault's stored account for when the key is removed.
func WithTrustedProxies ¶
WithTrustedProxies sets the reverse-proxy networks trusted when resolving the audit-log client IP. Empty trusts nothing, so the socket peer is logged.
type WhoamiResponse ¶
type WhoamiResponse struct {
State WhoamiState `json:"state"`
// Email and the four labels below belong to the signed_in arm.
Email string `json:"email,omitempty"`
Auth string `json:"auth,omitempty"`
AccountType string `json:"accountType,omitempty"`
StartURL string `json:"startUrl,omitempty"`
Region string `json:"region,omitempty"`
// Reason belongs to the unavailable arm: a server-authored phrase.
Reason string `json:"reason,omitempty"`
// LoginState is the attempt's signin.AttemptState, LoginError a failed attempt's user text.
LoginState string `json:"loginState,omitempty"`
LoginError string `json:"loginError,omitempty"`
LoginAttempt uint64 `json:"loginAttempt,omitempty"`
// APIKey is true while KIRO_API_KEY signs the engine in: sign-in and sign-out answer 409, so the UI offers neither.
APIKey bool `json:"apiKey,omitempty"`
}
WhoamiResponse is /api/whoami's typed wire shape. State is the discriminator and each other field belongs to one arm. The Login* fields report the latest sign-in attempt on every arm: a poll waits for its own attempt to leave pending, since a switch keeps the old account signed in until the new one commits.
type WhoamiState ¶
type WhoamiState string
WhoamiState discriminates /api/whoami's three answers; "could not ask" is its own state so the UI offers a retry, not a sign-out.