login

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DCOSOIDCAuth0 = "dcos-oidc-auth0"
	DCOSUsers     = "dcos-users"
)

This is a non-exhaustive list of login provider IDs for DC/OS.

View Source
const (
	DCOSUIDPassword     = "dcos-uid-password" // nolint: gosec
	DCOSUIDServiceKey   = "dcos-uid-servicekey"
	DCOSUIDPasswordLDAP = "dcos-uid-password-ldap" // nolint: gosec
	SAMLSpInitiated     = "saml-sp-initiated"
	OIDCAuthCodeFlow    = "oidc-authorization-code-flow"
	OIDCImplicitFlow    = "oidc-implicit-flow"
)

These are the different login provider types that the DC/OS CLI supports.

Variables

View Source
var (
	// ErrAuthDisabled is the error returned when attempting to get authentication providers
	// from a cluster without authentication.
	ErrAuthDisabled = errors.New("authentication disabled")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is able to detect available login providers and login to DC/OS.

func NewClient

func NewClient(baseClient *httpclient.Client, logger *logrus.Logger) *Client

NewClient creates a new login client.

func (*Client) Login

func (c *Client) Login(loginEndpoint string, credentials *Credentials) (string, error)

Login makes a POST requests to the login endpoint with the given credentials.

func (*Client) Providers

func (c *Client) Providers() (Providers, error)

Providers returns the supported login providers for a given DC/OS cluster.

type Credentials

type Credentials struct {
	UID      string `json:"uid,omitempty"`
	Password string `json:"password,omitempty"`
	Token    string `json:"token,omitempty"`
}

Credentials is the payload for login POST requests.

type Flags

type Flags struct {
	// contains filtered or unexported fields
}

Flags are command-line flags for a login flow.

func NewFlags

func NewFlags(fs afero.Fs, envLookup func(key string) (string, bool), logger *logrus.Logger) *Flags

NewFlags creates flags for a login flow.

func (*Flags) Register

func (f *Flags) Register(flags *pflag.FlagSet)

Register registers login flags.

func (*Flags) Resolve

func (f *Flags) Resolve() error

Resolve resolves credentials from --password-env, --password-file and --private-key flags.

func (*Flags) SetProviderID

func (f *Flags) SetProviderID(providerID string)

SetProviderID sets the provider ID.

func (*Flags) Supports

func (f *Flags) Supports(provider *Provider) bool

Supports indicates whether or not a provider is supported based on the specified flags.

type Flow

type Flow struct {
	// contains filtered or unexported fields
}

Flow represents a login flow.

func NewFlow

func NewFlow(opts FlowOpts) *Flow

NewFlow creates a new login flow.

func (*Flow) Start

func (f *Flow) Start(flags *Flags, httpClient *httpclient.Client) (string, error)

Start initiates the login flow for a given set of flags and HTTP client.

type FlowOpts

type FlowOpts struct {
	Errout io.Writer
	Prompt *prompt.Prompt
	Logger *logrus.Logger
	Opener open.Opener
}

FlowOpts are functional options for a Flow.

type JWT

type JWT struct {
	Token string `json:"token"`
}

JWT is the authentication token returned by the DC/OS login API.

type Provider

type Provider struct {
	ID           string         `json:"-"`
	Type         string         `json:"authentication-type"`
	ClientMethod string         `json:"client-method"`
	Config       ProviderConfig `json:"config"`
	Description  string         `json:"description"`
}

Provider is a DC/OS login provider.

func (*Provider) String

func (provider *Provider) String() string

String converts a login provider to a string.

type ProviderConfig

type ProviderConfig struct {
	StartFlowURL string `json:"start_flow_url"`
}

ProviderConfig holds login provider specific configuration.

type Providers

type Providers map[string]*Provider

Providers is a map of providers as returned by the DC/OS API.

func (Providers) Slice

func (p Providers) Slice() []*Provider

Slice returns providers sorted by ID in a slice.

func (*Providers) UnmarshalJSON

func (p *Providers) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals JSON into a Providers type.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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