Documentation ¶
Index ¶
- Constants
- type Spec
- type UserLoginState
- func (u *UserLoginState) CheckAndSetDefaults() error
- func (u *UserLoginState) GetMetadata() types.Metadata
- func (u *UserLoginState) GetOriginalRoles() []string
- func (u *UserLoginState) GetOriginalTraits() map[string][]string
- func (u *UserLoginState) GetRoles() []string
- func (u *UserLoginState) GetTraits() map[string][]string
- func (u *UserLoginState) GetUserType() types.UserType
- func (u *UserLoginState) IsBot() bool
- func (u *UserLoginState) IsOriginalRolesAndTraitsSet() bool
Constants ¶
const ( // OriginalRolesAndTraitsSet is an annotation that will indicate that the original roles and traits have been // set for this objects. For existing user login states, this will not be set, indicating that we can't // use these fields reliably. // DELETE IN 17 (mdwn) OriginalRolesAndTraitsSet = types.TeleportInternalLabelPrefix + "original-set" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Spec ¶
type Spec struct { // OriginalRoles is the list of the original roles from the user login state. OriginalRoles []string `json:"original_roles" yaml:"original_roles"` // OriginalTraits is the list of the original traits from the user login state. OriginalTraits trait.Traits `json:"original_traits" yaml:"original_traits"` // Roles is the list of roles attached to the user login state. Roles []string `json:"roles" yaml:"roles"` // Traits are the traits attached to the user login state. Traits trait.Traits `json:"traits" yaml:"traits"` // UserType is the type of user that this state represents. UserType types.UserType `json:"user_type" yaml:"user_type"` }
Spec is the specification for the user login state.
type UserLoginState ¶
type UserLoginState struct { // ResourceHeader is the common resource header for all resources. header.ResourceHeader // Spec is the specification for the user login state. Spec Spec `json:"spec" yaml:"spec"` }
UserLoginState is the ephemeral user login state. This will hold data to differentiate from the User object. This will allow us to store derived roles and traits from access lists, login rules, and other mechanisms to more easily incorporate these bits of data into user created certificates. It will also allow us to leave the user object itself unmodified despite this ephemeral data, which is frequently needed despite the dynamic nature of user access.
func New ¶
func New(metadata header.Metadata, spec Spec) (*UserLoginState, error)
New creates a new user login state.
func (*UserLoginState) CheckAndSetDefaults ¶
func (u *UserLoginState) CheckAndSetDefaults() error
CheckAndSetDefaults validates fields and populates empty fields with default values.
func (*UserLoginState) GetMetadata ¶
func (u *UserLoginState) GetMetadata() types.Metadata
GetMetadata returns metadata. This is specifically for conforming to the Resource interface, and should be removed when possible.
func (*UserLoginState) GetOriginalRoles ¶
func (u *UserLoginState) GetOriginalRoles() []string
GetOriginalRoles returns the original roles that the user login state was derived from.
func (*UserLoginState) GetOriginalTraits ¶
func (u *UserLoginState) GetOriginalTraits() map[string][]string
GetOriginalTraits returns the original traits that the user login state was derived from.
func (*UserLoginState) GetRoles ¶
func (u *UserLoginState) GetRoles() []string
GetRoles returns the roles attached to the user login state.
func (*UserLoginState) GetTraits ¶
func (u *UserLoginState) GetTraits() map[string][]string
GetTraits returns the traits attached to the user login state.
func (*UserLoginState) GetUserType ¶
func (u *UserLoginState) GetUserType() types.UserType
GetUserType returns the user type for the user login state.
func (*UserLoginState) IsBot ¶
func (u *UserLoginState) IsBot() bool
IsBot returns true if the user is a bot.
func (*UserLoginState) IsOriginalRolesAndTraitsSet ¶
func (u *UserLoginState) IsOriginalRolesAndTraitsSet() bool
IsOriginalRolesAndTraitsSet will return true if the original roles and traits annotation is present.