authuser

package
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0, MIT, Apache-2.0, + 1 more Imports: 7 Imported by: 0

Documentation

Overview

Package authuser (authorize user) maintains the interface for the complete authorization flow, leveraging the job's configuration as well as context provided by the custom executor to ensure a fully authorized user is identified for the local job.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentUser

func CurrentUser() (*user.User, error)

CurrentUser returns the current user.

func SetIntIDs added in v0.8.0

func SetIntIDs(uid, gid string, u *UserContext) error

SetIntIDs converts the supplied uid & gid to integers and updates the UserContext.

Types

type Authorized

type Authorized interface {
	// CIUser returns a completely authorized user context.
	CIUser() UserContext
	// BuildState populates and return the StatefulEnv.
	BuildState() envparser.StatefulEnv
	// PrepareNotification returns details on the validated user for prepare_exec messaging.
	PrepareNotification() string
	// JobContext returns a subset of verified job claims for further access. Note this is
	// only present when authorization has not been disabled.
	JobContext() jobtoken.EstablishedContext
}

Authorized implements an interface allowing read-only access to the established user context. All information is identified during a job's configuration stage and remains consistent throughout the life of the job.

type UserContext

type UserContext struct {
	Username string
	HomeDir  string
	UID      int
	GID      int
	// Groups all supplementary unix groups assigned to the user.
	Groups []uint32
	// BaseDir directory for CI job and command interactions.
	BaseDir string
	// BuildsDir is the working directory created on the local file system.
	BuildsDir string
	// CacheDir is the working directory created on the local file system.
	CacheDir string
	// ScriptDir is the directory for script storage and command execution.
	ScriptDir string
	// DataDirOverride proposed override for configured data_dir.
	DataDirOverride string
}

UserContext contains validated user details for the current CI job.

func ProcessFromState added in v0.8.0

func ProcessFromState(usr *user.User, s envparser.StatefulEnv) (u UserContext, err error)

ProcessFromState update basic UserContext using the supplied user object in conjunction with Stateful environment variables identified.

type Validators added in v0.6.0

type Validators struct {
	RunAs validation.RunAsValidator
	Job   jobtoken.Validator
}

func EstablishValidators added in v0.6.0

func EstablishValidators(
	stage string,
	opt configure.Options,
	env envparser.ExecutorEnv,
) (Validators, error)

EstablishValidators create a series of Validators based upon configuration and identifiable job context.

Directories

Path Synopsis
Package datadir maintains procedures for establishing core directory structures the meet CI job requirements.
Package datadir maintains procedures for establishing core directory structures the meet CI job requirements.
Package validation maintains Jacamar's interactions with an admin defined validation script.
Package validation maintains Jacamar's interactions with an admin defined validation script.

Jump to

Keyboard shortcuts

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