Documentation
¶
Index ¶
- Constants
- Variables
- func GetErrorResponseWriter(w http.ResponseWriter) *errorResponseWriter
- type AnalysisCache
- type CheckRequest
- type CheckResponse
- type FeedbackTheme
- type HostHandler
- func (hh *HostHandler) AddOrUpdateTranslation(name string, translation *kdexv1alpha1.KDexTranslationSpec)
- func (hh *HostHandler) AddOrUpdateUtilityPage(ph page.PageHandler)
- func (hh *HostHandler) BuildMenuEntries(ctx context.Context, entry *render.PageEntry, l *language.Tag, ...)
- func (hh *HostHandler) CheckHandler(w http.ResponseWriter, r *http.Request)
- func (hh *HostHandler) Checksum() string
- func (hh *HostHandler) DesignMiddleware(next http.Handler) http.Handler
- func (hh *HostHandler) FootScriptToHTML(handler page.PageHandler) string
- func (hh *HostHandler) GeneratePageCacheKey(ph page.PageHandler, l language.Tag) string
- func (hh *HostHandler) GetCacheManager() cache.CacheManager
- func (hh *HostHandler) GetOpenAPIBuilder() *ko.Builder
- func (hh *HostHandler) GetStatus() HostStatus
- func (hh *HostHandler) GetUtilityPageHandler(name kdexv1alpha1.KDexUtilityPageType) page.PageHandler
- func (hh *HostHandler) HeadScriptToHTML(handler page.PageHandler) string
- func (hh *HostHandler) InspectHandler(w http.ResponseWriter, r *http.Request)
- func (hh *HostHandler) IsAuthEnabled() bool
- func (hh *HostHandler) L10nRender(handler page.PageHandler, pageMap map[string]any, l language.Tag, ...) (string, error)
- func (hh *HostHandler) L10nRenderText(ph page.PageHandler, lang language.Tag, translations *Translations) (string, error)
- func (hh *HostHandler) L10nRenders(handler page.PageHandler, pageMaps map[language.Tag]map[string]any, ...) map[string]string
- func (hh *HostHandler) LoginGet(w http.ResponseWriter, r *http.Request)
- func (hh *HostHandler) LoginPost(w http.ResponseWriter, r *http.Request)
- func (hh *HostHandler) LogoutPost(w http.ResponseWriter, r *http.Request)
- func (hh *HostHandler) MetaToString(handler page.PageHandler, l language.Tag) string
- func (hh *HostHandler) NavigationGet(w http.ResponseWriter, r *http.Request)
- func (hh *HostHandler) OpenAPIGet(w http.ResponseWriter, r *http.Request)
- func (hh *HostHandler) RebuildMux()
- func (hh *HostHandler) RemovePage(name string)
- func (hh *HostHandler) RemoveTranslation(name string)
- func (hh *HostHandler) RemoveUtilityPage(name string)
- func (hh *HostHandler) RouteCollisions() []RouteCollision
- func (hh *HostHandler) SchemaGet(w http.ResponseWriter, r *http.Request)
- func (hh *HostHandler) SchemaListGet(w http.ResponseWriter, r *http.Request)
- func (hh *HostHandler) SecuritySchemes() *openapi.SecuritySchemes
- func (hh *HostHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (hh *HostHandler) SetHost(ctx context.Context, host *kdexv1alpha1.KDexHostSpec, ...)
- func (hh *HostHandler) SetPageDenialMode(m PageDenialMode) *HostHandler
- func (hh *HostHandler) SetProxyTimeouts(t ProxyTimeouts) *HostHandler
- func (hh *HostHandler) SetTranslationOrder(order []string)
- func (hh *HostHandler) ThemeAssetsToString() string
- func (hh *HostHandler) TransferGet(w http.ResponseWriter, r *http.Request)
- func (hh *HostHandler) TranslationGet(w http.ResponseWriter, r *http.Request)
- type HostStatus
- type KDexFunctionHandler
- type MintRequest
- type MintResponse
- type MintTokenRequest
- type MintTokenResult
- type OAuth2Resource
- type PageDenialMode
- type ProtectedResourceMetadata
- type ProxyTimeouts
- type RevokeRequest
- type RevokeResponse
- type RouteCollision
- type SkippedTranslationValue
- type TransferTarget
- type Translations
- type VerifyRequest
- type WhoamiResult
Constants ¶
const AnnotationInvalidatesGrantsOnWrite = "kdex.dev/invalidates-grants-on-write"
AnnotationInvalidatesGrantsOnWrite marks a KDexFunction whose successful writes mutate membership/role state; host-manager bumps the shared grant generation on such a response so browser sessions re-resolve (#203).
const FunctionRouteOwnerPrefix = "KDexFunction/"
FunctionRouteOwnerPrefix prefixes a KDexFunction's name when it is a RouteCollision's WinnerName or LoserName, telling it apart from a page.
Variables ¶
var PageDenialModes = []PageDenialMode{PageDenialDiscover, PageDenialForbid}
PageDenialModes is every value --page-denial-mode accepts.
Functions ¶
func GetErrorResponseWriter ¶
func GetErrorResponseWriter(w http.ResponseWriter) *errorResponseWriter
GetErrorResponseWriter finds the errorResponseWriter behind w, following Unwrap through writers layered on top of it (e.g. rewriteResponseWriter).
Types ¶
type AnalysisCache ¶
type AnalysisCache struct {
// contains filtered or unexported fields
}
AnalysisCache stores the results of the InferenceEngine for a short period so that the redirected user can view the report.
func NewAnalysisCache ¶
func NewAnalysisCache() *AnalysisCache
func (*AnalysisCache) Get ¶
func (ac *AnalysisCache) Get(id string) (*sniffer.AnalysisResult, bool)
func (*AnalysisCache) Store ¶
func (ac *AnalysisCache) Store(result *sniffer.AnalysisResult) string
type CheckRequest ¶ added in v0.2.9
type CheckRequest struct {
Checks []string `json:"checks"`
}
type CheckResponse ¶ added in v0.2.9
type CheckResponse struct {
Passed []string `json:"passed"`
}
type FeedbackTheme ¶
type FeedbackTheme struct {
// CLI Colors (ANSI)
CLIHeader string
CLISuccess string
CLIWarning string
CLIDim string
CLILineNum string
CLIReset string
// HTML Colors (CSS)
BgPage string
BgSidebar string
BgCard string
BgCode string
Border string
TextPrimary string
TextSecondary string
TextAccent string
TextLint string
TextCode string
MethodGet string
MethodPost string
MethodPut string
MethodDelete string
BtnSuccess string
BtnHover string
}
type HostHandler ¶
type HostHandler struct {
Mux *http.ServeMux
Name string
Namespace string
Pages *page.PageStore
Translations Translations
// contains filtered or unexported fields
}
func NewHostHandler ¶
func NewHostHandler(c client.Client, name string, namespace string, log logr.Logger, cacheManager cache.CacheManager) *HostHandler
func (*HostHandler) AddOrUpdateTranslation ¶
func (hh *HostHandler) AddOrUpdateTranslation(name string, translation *kdexv1alpha1.KDexTranslationSpec)
func (*HostHandler) AddOrUpdateUtilityPage ¶
func (hh *HostHandler) AddOrUpdateUtilityPage(ph page.PageHandler)
func (*HostHandler) BuildMenuEntries ¶
func (hh *HostHandler) BuildMenuEntries( ctx context.Context, entry *render.PageEntry, l *language.Tag, isDefaultLanguage bool, parent *page.PageHandler, )
func (*HostHandler) CheckHandler ¶ added in v0.2.9
func (hh *HostHandler) CheckHandler(w http.ResponseWriter, r *http.Request)
func (*HostHandler) Checksum ¶ added in v0.2.7
func (hh *HostHandler) Checksum() string
func (*HostHandler) DesignMiddleware ¶
func (hh *HostHandler) DesignMiddleware(next http.Handler) http.Handler
func (*HostHandler) FootScriptToHTML ¶
func (hh *HostHandler) FootScriptToHTML(handler page.PageHandler) string
func (*HostHandler) GeneratePageCacheKey ¶ added in v0.2.7
func (hh *HostHandler) GeneratePageCacheKey(ph page.PageHandler, l language.Tag) string
func (*HostHandler) GetCacheManager ¶
func (hh *HostHandler) GetCacheManager() cache.CacheManager
func (*HostHandler) GetOpenAPIBuilder ¶
func (hh *HostHandler) GetOpenAPIBuilder() *ko.Builder
func (*HostHandler) GetStatus ¶
func (hh *HostHandler) GetStatus() HostStatus
func (*HostHandler) GetUtilityPageHandler ¶
func (hh *HostHandler) GetUtilityPageHandler(name kdexv1alpha1.KDexUtilityPageType) page.PageHandler
func (*HostHandler) HeadScriptToHTML ¶
func (hh *HostHandler) HeadScriptToHTML(handler page.PageHandler) string
func (*HostHandler) InspectHandler ¶
func (hh *HostHandler) InspectHandler(w http.ResponseWriter, r *http.Request)
InspectHandler serves the feedback UI
func (*HostHandler) IsAuthEnabled ¶ added in v0.2.10
func (hh *HostHandler) IsAuthEnabled() bool
func (*HostHandler) L10nRender ¶
func (hh *HostHandler) L10nRender( handler page.PageHandler, pageMap map[string]any, l language.Tag, extraTemplateData map[string]any, translations *Translations, ) (string, error)
func (*HostHandler) L10nRenderText ¶ added in v0.9.0
func (hh *HostHandler) L10nRenderText( ph page.PageHandler, lang language.Tag, translations *Translations, ) (string, error)
L10nRenderText renders a text-mime KDexPage's body (ph.Page.Body) through the same [[ ]]-delimited Go-template + l10n translation pipeline L10nRender uses -- same FuncMap, same MessagePrinter, built by the shared l10nRenderer -- but executes ONLY the body as the top-level template, with none of L10nRender's archetype/header/footer/navigation chrome assembled around it. TemplateData() still runs (it renders the untouched chrome fields to empty strings), which is what keeps this a thin wrapper around the same pipeline rather than a parallel one.
Unlike L10nRender, this uses render.Renderer.RenderOneText (text/template) rather than RenderOne (html/template): text-mime bodies (text/plain, json, yaml, markdown, xml) are not HTML, so an interpolated [[ l10n "key" ]] value must come through verbatim -- html/template's auto-escaping would corrupt any &, <, >, or " in a translation or template value.
func (*HostHandler) L10nRenders ¶
func (hh *HostHandler) L10nRenders( handler page.PageHandler, pageMaps map[language.Tag]map[string]any, translations *Translations, ) map[string]string
func (*HostHandler) LoginGet ¶
func (hh *HostHandler) LoginGet(w http.ResponseWriter, r *http.Request)
func (*HostHandler) LoginPost ¶
func (hh *HostHandler) LoginPost(w http.ResponseWriter, r *http.Request)
func (*HostHandler) LogoutPost ¶
func (hh *HostHandler) LogoutPost(w http.ResponseWriter, r *http.Request)
func (*HostHandler) MetaToString ¶
func (hh *HostHandler) MetaToString(handler page.PageHandler, l language.Tag) string
func (*HostHandler) NavigationGet ¶
func (hh *HostHandler) NavigationGet(w http.ResponseWriter, r *http.Request)
func (*HostHandler) OpenAPIGet ¶
func (hh *HostHandler) OpenAPIGet(w http.ResponseWriter, r *http.Request)
func (*HostHandler) RebuildMux ¶
func (hh *HostHandler) RebuildMux()
func (*HostHandler) RemovePage ¶ added in v0.2.19
func (hh *HostHandler) RemovePage(name string)
func (*HostHandler) RemoveTranslation ¶
func (hh *HostHandler) RemoveTranslation(name string)
func (*HostHandler) RemoveUtilityPage ¶
func (hh *HostHandler) RemoveUtilityPage(name string)
func (*HostHandler) RouteCollisions ¶ added in v0.9.0
func (hh *HostHandler) RouteCollisions() []RouteCollision
RouteCollisions returns the route collisions (page-vs-page, and refused KDexFunction routes) detected by the most recent RebuildMux. Empty when none were found. Callers (e.g. the KDexInternalHost reconciler) use this to surface a Degraded status condition -- registration itself never silently serves or drops a colliding route without recording it here.
func (*HostHandler) SchemaGet ¶
func (hh *HostHandler) SchemaGet(w http.ResponseWriter, r *http.Request)
func (*HostHandler) SchemaListGet ¶ added in v0.2.30
func (hh *HostHandler) SchemaListGet(w http.ResponseWriter, r *http.Request)
func (*HostHandler) SecuritySchemes ¶
func (hh *HostHandler) SecuritySchemes() *openapi.SecuritySchemes
func (*HostHandler) ServeHTTP ¶
func (hh *HostHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*HostHandler) SetHost ¶
func (hh *HostHandler) SetHost( ctx context.Context, host *kdexv1alpha1.KDexHostSpec, status *kdexv1alpha1.KDexObjectStatus, packageReferences []kdexv1alpha1.PackageReference, themeAssets []kdexv1alpha1.Asset, scripts []kdexv1alpha1.ScriptDef, importmap string, paths map[string]ko.PathInfo, functions []kdexv1alpha1.KDexFunction, authExchanger *auth.Exchanger, authConfig *auth.Config, scheme string, snif *sniffer.RequestSniffer, reconcileTime time.Time, )
TODO: add individual cache configurations
func (*HostHandler) SetPageDenialMode ¶ added in v0.8.0
func (hh *HostHandler) SetPageDenialMode(m PageDenialMode) *HostHandler
SetPageDenialMode replaces the HostHandler's page-denial rendering mode. An empty or unrecognised value resolves to PageDenialDiscover.
This coercion is a SAFETY NET, not the validation. It resolves to the LESS strict mode, so an operator typo reaching here would silently buy the opposite of what was asked for -- which is why cmd/main.go refuses to start on anything that is not exactly "discover" or "forbid", and why a coercion that does happen is logged at V(0): reaching it means something bypassed that check.
func (*HostHandler) SetProxyTimeouts ¶ added in v0.2.78
func (hh *HostHandler) SetProxyTimeouts(t ProxyTimeouts) *HostHandler
SetProxyTimeouts replaces the HostHandler's proxy transport timeouts. Method-chain return makes it composable with NewHostHandler. Zero-valued fields fall back to defaults inside newProxyTransport.
func (*HostHandler) SetTranslationOrder ¶ added in v0.19.0
func (hh *HostHandler) SetTranslationOrder(order []string)
SetTranslationOrder records the catalog write order nexus publishes in KDexInternalHost.spec.internalTranslationRefs (lowest precedence first). It does not rebuild: it is set immediately before SetHost, which rebuilds.
func (*HostHandler) ThemeAssetsToString ¶
func (hh *HostHandler) ThemeAssetsToString() string
func (*HostHandler) TransferGet ¶ added in v0.4.20
func (hh *HostHandler) TransferGet(w http.ResponseWriter, r *http.Request)
TransferGet redeems a /-/transfer/<handle> capability: resolve the handle, spend one budget unit, inject the stored identity, and re-dispatch the bound target through the mux (which runs the proxy identity gate + per-op security against the injected entitlements). All non-redeemable cases return an identical 410 to preserve anti-enumeration.
func (*HostHandler) TranslationGet ¶
func (hh *HostHandler) TranslationGet(w http.ResponseWriter, r *http.Request)
type HostStatus ¶
type HostStatus string
const ( HostStatusInitializing HostStatus = "Initializing" HostStatusReady HostStatus = "Ready" HostStatusDegraded HostStatus = "Degraded" HostStatusProgressing HostStatus = "Progressing" )
type KDexFunctionHandler ¶
type KDexFunctionHandler struct {
Function *kdexv1alpha1.KDexFunction
Handler http.Handler
// contains filtered or unexported fields
}
func (*KDexFunctionHandler) ServeHTTP ¶
func (h *KDexFunctionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type MintRequest ¶ added in v0.2.9
type MintRequest struct {
// Action is the action of the tokens to mint (metadata-based revocation).
Action string `json:"act"`
// Audience is the audience of the tokens to mint (metadata-based revocation).
Audience string `json:"aud"`
// Scope is the scope of the tokens to mint (metadata-based revocation).
Scope string `json:"scp"`
// Sub is the subject of the tokens to mint (metadata-based revocation).
Sub string `json:"sub"`
// TTL is the token lifetime, a Go duration. Absent: 24h, capped at the
// host's maxTTL. Unparseable, non-positive or above maxTTL: refused (400).
TTL string `json:"ttl"`
}
type MintResponse ¶ added in v0.2.9
type MintResponse struct {
Token string `json:"token"`
}
type MintTokenRequest ¶ added in v0.4.0
type MintTokenRequest struct {
Entitlements []string `json:"entitlements"`
TTLSeconds int `json:"ttl_seconds,omitempty"`
Uses int `json:"uses,omitempty"`
Delivery string `json:"delivery,omitempty"`
Target *TransferTarget `json:"target,omitempty"`
}
MintTokenRequest is the argument shape of the mint_token MCP tool.
type MintTokenResult ¶ added in v0.4.0
type MintTokenResult struct {
Token string `json:"token,omitempty"`
URL string `json:"url,omitempty"`
ExpiresAt int64 `json:"expires_at"`
Entitlements []string `json:"entitlements"`
UsesRemaining int `json:"uses_remaining"`
}
MintTokenResult is the mint_token success payload.
type OAuth2Resource ¶ added in v0.3.0
OAuth2Resource describes a KDexFunction basePath that an operation has opted into protecting with the built-in "oauth2" security scheme.
type PageDenialMode ¶ added in v0.8.0
type PageDenialMode string
PageDenialMode selects how the page gate renders FORBIDDEN to a browser. It governs the HTML rendering ONLY -- a non-HTML caller gets 403 in every mode, because the knob is about presentation, not about the contract.
const ( // PageDenialDiscover sends a browser to the first page it can reach, // carrying ?denied=<path>. Preserves the behaviour that predates the // denial contract. Default. PageDenialDiscover PageDenialMode = "discover" // PageDenialForbid renders the 403 error page instead. PageDenialForbid PageDenialMode = "forbid" )
func (PageDenialMode) IsValid ¶ added in v0.8.0
func (m PageDenialMode) IsValid() bool
IsValid reports whether m is a recognised mode. Callers that ACCEPT a mode from an operator must check this and refuse to start otherwise: SetPageDenialMode's coercion resolves an unrecognised value to the LESS strict mode, so a typo would otherwise buy the opposite of what was asked for with no diagnostic anywhere.
type ProtectedResourceMetadata ¶ added in v0.3.0
type ProtectedResourceMetadata struct {
Resource string `json:"resource"`
AuthorizationServers []string `json:"authorization_servers"`
ScopesSupported []string `json:"scopes_supported,omitempty"`
BearerMethodsSupported []string `json:"bearer_methods_supported,omitempty"`
}
ProtectedResourceMetadata is the RFC 9728 OAuth 2.0 Protected Resource Metadata document.
type ProxyTimeouts ¶ added in v0.2.78
type ProxyTimeouts struct {
// DialTimeout caps the connection-establishment phase (TCP + TLS).
DialTimeout time.Duration
// ResponseHeaderTimeout caps the wait between sending the request and
// receiving the first response byte from the backend. This is the knob
// that matters for scale-from-zero Knative cold starts.
ResponseHeaderTimeout time.Duration
// IdleConnTimeout caps how long an unused keep-alive connection lingers
// in the transport's pool before being closed.
IdleConnTimeout time.Duration
}
ProxyTimeouts holds the http.Transport timeout knobs used when proxying to KDexFunction backends. Zero-value fields fall back to defaults at transport-construction time (see newProxyTransport in proxy.go), so callers can leave any subset unset.
type RevokeRequest ¶ added in v0.2.30
type RevokeRequest struct {
// Action is the action of the tokens to revoke (metadata-based revocation).
Action string `json:"act"`
// Audience is the audience of the tokens to revoke (metadata-based revocation).
Audience string `json:"aud"`
// Sub is the subject of the tokens to revoke (metadata-based revocation).
Sub string `json:"sub"`
// TTL lengthens a metadata revocation beyond its lifetime, max(10y,
// maxTTL); it can never shorten one. An unusable value is ignored.
TTL string `json:"ttl"`
// Token is the full signed token to revoke.
Token string `json:"token"`
}
RevokeRequest is the request body for the token revocation endpoint.
type RevokeResponse ¶ added in v0.2.30
type RevokeResponse struct {
// Status is the result of the revocation request.
Status string `json:"status"`
}
RevokeResponse is the response body for the token revocation endpoint.
type RouteCollision ¶ added in v0.9.0
type RouteCollision struct {
// Pattern is the ServeMux pattern whose registration was refused: the
// "METHOD /path" pattern both pages wanted, or the function's pattern.
Pattern string
// ConflictingPattern is the already-registered pattern a refused
// function pattern conflicts with, when the build tracked it. Empty for a
// page-vs-page collision (the pattern is Pattern itself) and when the
// conflicting route is untracked (a built-in system route), in which case
// WinnerName is empty too.
ConflictingPattern string
// WinnerName / WinnerBasePath identify the page (or function) that keeps
// the route.
WinnerName string
WinnerBasePath string
// LoserName / LoserBasePath identify the page (or function) whose
// registration for Pattern was refused.
LoserName string
LoserBasePath string
}
RouteCollision records a page registration refused during the most recent RebuildMux because a DIFFERENT, earlier-claimed page already owns the literal "METHOD /path" ServeMux pattern it wanted.
This is the enumerated-per-language-prefix collision class: replacing the old "/{l10n}" wildcard with one literal route per supported language means a page whose basePath equals "/<lang>" (or "/<lang>/...") produces the SAME pattern as another, independently-authored page's own language- prefixed route. E.g. with "en" (default) and "fr" supported, the home page (basePath "/") registers "GET /fr/{$}" as its French route, and a page at basePath "/fr" registers its bare route at "GET /fr" but its legacy slash redirect at that same "GET /fr/{$}" pattern, which collides.
The winner is whichever page registration-time ordering (basePath-sorted, see rebuildMuxSnapshot) processes first; the loser's route is refused outright rather than silently served or silently dropped -- see RouteCollisions.
A KDexFunction route is refused the same way (see registerFunctionRoutes): functions register after every page, so a function pattern that ServeMux reports as conflicting with an already-registered route loses. ServeMux conflicts are not exact-pattern equality (e.g. "/x/v1/" conflicts with "GET /x/{path...}"), so such a collision also carries ConflictingPattern. Function owners are named FunctionRouteOwnerPrefix + the function's name.
type SkippedTranslationValue ¶ added in v0.19.0
SkippedTranslationValue is a translation value NewTranslations left out of the catalog because it does not compile (e.g. "Price: ${").
type TransferTarget ¶ added in v0.4.20
TransferTarget is the single concrete operation a delivery:"url" capability authorizes. Download-only in this release: Method must be GET.
type Translations ¶
type Translations struct {
// contains filtered or unexported fields
}
func NewTranslations ¶
func NewTranslations(defaultLanguage string, translations map[string]kdexv1alpha1.KDexTranslationSpec, order []string) (*Translations, error)
NewTranslations builds the host's message catalog. catalog.Builder.SetString is last-write-wins, so translations are written in translationWriteOrder: when two translations define the same language and key, the one later in order wins. nexus supplies order (KDexInternalHost.spec.internalTranslationRefs) lowest precedence first: default, self-attached, then host-declared.
A value the catalog cannot compile is left out and reported in Skipped(); the only error is a failure to register the default language.
func (*Translations) Catalog ¶
func (t *Translations) Catalog() *catalog.Builder
func (*Translations) Keys ¶
func (t *Translations) Keys() []string
func (*Translations) Languages ¶
func (t *Translations) Languages() []language.Tag
func (*Translations) Skipped ¶ added in v0.19.0
func (t *Translations) Skipped() []SkippedTranslationValue
Skipped returns the values left out of the catalog because they do not compile; each key falls back as if that value were absent.
type VerifyRequest ¶ added in v0.2.9
type VerifyRequest struct {
Token string `json:"token"`
}
type WhoamiResult ¶ added in v0.5.1
type WhoamiResult struct {
Identity string `json:"identity"`
Name string `json:"name,omitempty"`
GivenName string `json:"given_name,omitempty"`
FamilyName string `json:"family_name,omitempty"`
PreferredUsername string `json:"preferred_username,omitempty"`
Entitlements []string `json:"entitlements"`
// EntitlementsWithheld reports that the credential currently presented
// carries FEWER entitlements than the user effectively holds, so some of
// the entitlements listed here cannot be exercised with it. Set whenever
// the two differ — including for a deliberately attenuated capability
// token, where it is expected rather than a misconfiguration.
EntitlementsWithheld bool `json:"entitlements_withheld,omitempty"`
// Hint is a short actionable explanation, present only when something is
// actionable.
Hint string `json:"hint,omitempty"`
}
WhoamiResult is the whoami success payload.
It describes what the USER can do. whoami is a reporting tool and hands out no authority by answering, so it reports effective entitlements rather than whatever the credential in hand happens to carry — see applyEffectiveEntitlements.
Identity and Entitlements are MANDATORY: whatever the scope, a caller must always learn who the server thinks they are and what they may do — that is the entire purpose of the tool. Identity falls back to the subject, which every credential carries, and an empty entitlement set serializes as `[]` rather than being dropped so a client can iterate without a nil check.
The profile fields ARE omitempty, and that is the privacy contract: they are scope-controlled claim families (see Signer.confineByScope), so absent means "this credential was not granted it" — which is information an empty string would not convey.
Source Files
¶
- accept.go
- apitoken.go
- binding.go
- capabilities.go
- check.go
- consent.go
- entitlement_catalog.go
- ew.go
- feedback.go
- funcs.go
- handlers.go
- host.go
- kdexroles.go
- login.go
- mint_token.go
- navigation.go
- oauth2_resources.go
- openapi.go
- page.go
- protected_resource.go
- proxy.go
- register.go
- register_limiter.go
- resource_names.go
- rewrite.go
- schema.go
- textpage.go
- transfer.go
- translations.go
- types.go
- whoami.go