Help us shape the future of Go! Take the 2026 Go Developer Survey

facts

package
v0.32.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2026 License: Apache-2.0, Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package facts defines normalized authentication, user, and host data shared by inventory resolution and policy evaluation, without transport metadata.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authentication

type Authentication struct {
	ID        string    `json:"id"`
	ExpiresAt time.Time `json:"expiresAt"`
}

Authentication contains inventory's verified identity and session bound. It deliberately contains no bearer credentials or provider-specific claims.

func (Authentication) Validate

func (a Authentication) Validate() error

Validate checks the verified identity and its absolute lifetime bound.

type HostResource

type HostResource struct {
	Names  []string          `json:"names"`
	Labels map[string]string `json:"labels"`
	// Nil means ungrounded; a non-nil slice restricts accounts to its members.
	// An empty slice permits no accounts. JSON decoding rejects omission.
	Accounts []string `json:"accounts"`
}

func (*HostResource) UnmarshalJSON added in v0.31.0

func (h *HostResource) UnmarshalJSON(data []byte) error

UnmarshalJSON requires an explicit account restriction and decodes it before exposing host facts. Keep strict decoding for policy requests, whose outer decoder cannot enforce unknown-field checks inside a custom unmarshaler.

func (HostResource) Validate

func (h HostResource) Validate() error

Validate checks host fields whose omission could broaden authorization.

type User

type User struct {
	ID           string   `json:"id"`
	UserName     string   `json:"userName"`
	Active       *bool    `json:"active"`
	Groups       []string `json:"groups"`
	UserType     string   `json:"userType,omitempty"`
	Department   string   `json:"department,omitempty"`
	Organization string   `json:"organization,omitempty"`
}

User contains the directory attributes used by policy. External directory protocols are translated into these facts at the inventory boundary.

func (*User) Validate

func (u *User) Validate(authenticatedID string) error

Validate checks identity binding and required user fields. Inactivity is a structural denial evaluated by policy, not a malformed fact.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL