auth

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package auth provides commands for authentication and session management.

Index

Constants

View Source
const ClientCredentialsCmdName = api.ClientCredentialsCmdName
View Source
const CmdName = api.AuthCmdName
View Source
const ErrNonInteractiveEnvironmentEmptyToken = "a static API token is required in non-interactive environments"
View Source
const OIDCCmdName = api.OIDCCmdName

Variables

This section is empty.

Functions

func LoginKongVars

func LoginKongVars() kong.Vars

LoginKongVars returns all variables which are used in the login command

Types

type API

type API struct {
	URL          string `help:"URL of the Nine API." default:"https://nineapis.ch" env:"NCTL_API_URL" hidden:""`
	Token        string `` /* 136-byte string literal not displayed */
	ClientID     string `help:"Use an API client ID to login. Requires the --organization to also be set." env:"NCTL_API_CLIENT_ID"`
	ClientSecret string `help:"Use an API client secret to login. Requires the --organization to also be set." env:"NCTL_API_CLIENT_SECRET"`
	TokenURL     string `help:"Override the default client token URL." hidden:"" default:"${token_url}" env:"NCTL_API_TOKEN_URL"`
}

func (*API) Oauth2Token

func (a *API) Oauth2Token(ctx context.Context) (*oauth2.Token, error)

func (*API) UserInfo

func (a *API) UserInfo(ctx context.Context) (*api.UserInfo, error)

type ClientCredentialsCmd

type ClientCredentialsCmd struct {
	API `embed:""`
}

func (*ClientCredentialsCmd) Run

type ClusterCmd

type ClusterCmd struct {
	format.Writer `hidden:""`
	Name          string `arg:"" help:"Name of the cluster to authenticate with. Also accepts 'name/project' format."`
	ExecPlugin    bool   `help:"Automatically run exec plugin after writing the kubeconfig."`
}

func (*ClusterCmd) Run

func (a *ClusterCmd) Run(ctx context.Context, client *api.Client) error

type Cmd

type Cmd struct {
	Login             LoginCmd             `cmd:"" help:"Login to nineapis.ch."`
	Logout            LogoutCmd            `cmd:"" help:"Logout from nineapis.ch."`
	Cluster           ClusterCmd           `cmd:"" help:"Authenticate with Kubernetes Cluster."`
	OIDC              OIDCCmd              `cmd:"" help:"Perform interactive OIDC login." hidden:""`
	ClientCredentials ClientCredentialsCmd `cmd:"" help:"Perform APIServiceAccount client-credentials login." hidden:""`
	SetProject        SetProjectCmd        `cmd:"" help:"Set the default project to be used."`
	SetOrg            SetOrgCmd            `cmd:"" help:"Set the organization to be used."`
	Whoami            WhoAmICmd            `cmd:"" help:"Show who you are logged in as, your active organization and all your available organizations."`
	PrintAccessToken  PrintAccessTokenCmd  `cmd:"" help:"Print short-lived access token to authenticate against the API to stdout and exit."`
}

type LoginCmd

type LoginCmd struct {
	format.Writer               `hidden:""`
	API                         API    `embed:"" prefix:"api-"`
	Organization                string `help:"Name of your organization to use when providing an API client ID/secret." env:"NCTL_ORGANIZATION"`
	IssuerURL                   string `help:"OIDC issuer URL of the API." default:"${issuer_url}" hidden:""`
	ClientID                    string `help:"OIDC client ID of the API." default:"${client_id}" hidden:""`
	ForceInteractiveEnvOverride bool   `` /* 193-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*LoginCmd) Run

func (cmd *LoginCmd) Run(ctx context.Context) error

type LogoutCmd

type LogoutCmd struct {
	format.Writer `hidden:""`
	APIURL        string `help:"URL of the Nine API." default:"https://nineapis.ch" env:"NCTL_API_URL" name:"api-url"`
	IssuerURL     string `help:"OIDC issuer URL of the API." default:"https://auth.nine.ch/auth/realms/pub"`
	ClientID      string `help:"OIDC client ID of the API." default:"nineapis.ch-f178254"`
	// contains filtered or unexported fields
}

func (*LogoutCmd) Run

func (l *LogoutCmd) Run(ctx context.Context) error

type OIDCCmd

type OIDCCmd struct {
	IssuerURL string
	ClientID  string
	UsePKCE   bool
}

func (*OIDCCmd) Run

func (o *OIDCCmd) Run(ctx context.Context) error

type PrintAccessTokenCmd

type PrintAccessTokenCmd struct {
	format.Writer
}

func (*PrintAccessTokenCmd) Run

func (cmd *PrintAccessTokenCmd) Run(ctx context.Context, client *api.Client) error

type SetOrgCmd

type SetOrgCmd struct {
	format.Writer `hidden:""`
	Organization  string `arg:"" help:"Name of the organization to login to." default:""`
	APIURL        string `help:"URL of the Nine API." default:"https://nineapis.ch" env:"NCTL_API_URL" name:"api-url"`
	IssuerURL     string `help:"OIDC issuer URL of the API." default:"https://auth.nine.ch/auth/realms/pub"`
	ClientID      string `help:"OIDC client ID of the API." default:"nineapis.ch-f178254"`
}

func (*SetOrgCmd) Run

func (cmd *SetOrgCmd) Run(ctx context.Context, client *api.Client) error

type SetProjectCmd

type SetProjectCmd struct {
	format.Writer `hidden:""`
	Name          string `arg:"" help:"Name of the default project to be used." completion-predictor:"client:project_name"`
	Force         bool   `` /* 198-byte string literal not displayed */
}

func (*SetProjectCmd) Run

func (s *SetProjectCmd) Run(ctx context.Context, client *api.Client) error

type WhoAmICmd

type WhoAmICmd struct {
	format.Writer `hidden:""`
	APIURL        string `help:"URL of the Nine API." default:"https://nineapis.ch" env:"NCTL_API_URL" name:"api-url"`
	IssuerURL     string `help:"OIDC issuer URL of the API." default:"https://auth.nine.ch/auth/realms/pub"`
	ClientID      string `help:"OIDC client ID of the API." default:"nineapis.ch-f178254"`
	Format        string `help:"Configures output format. ${enum}" name:"output" short:"o" enum:"text,yaml,json" default:"text"`
}

func (*WhoAmICmd) Run

func (cmd *WhoAmICmd) Run(ctx context.Context, client *api.Client) error

Jump to

Keyboard shortcuts

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