c8ylogin

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Timeout in seconds used for all Server requests
	Timeout int = 30000
)

Functions

This section is empty.

Types

type LoginHandler

type LoginHandler struct {
	TFACodeRequired bool
	Authorized      bool
	Interactive     bool
	Err             error
	TFACode         string
	Cookies         []*http.Cookie
	C8Yclient       *c8y.Client
	LoginOptions    *c8y.TenantLoginOptions

	Attempts int
	Writer   io.Writer
	Logger   *logger.Logger
	// contains filtered or unexported fields
}

LoginHandler handler to process all login / authorization tasks for Cumulocity. Two-Factor authentication, TFA setup, OAUTH etc.

func NewLoginHandler

func NewLoginHandler(c *c8y.Client, w io.Writer, onSave func()) *LoginHandler

NewLoginHandler creates a new login handler to process the full Cumulocity login process for different login types, i.e. OAUTH_INTERNAL, BASIC etc.

func (*LoginHandler) Clear

func (lh *LoginHandler) Clear()

Clear clears any existing authorization state stored for the current client

func (*LoginHandler) Run

func (lh *LoginHandler) Run() error

Run initiates the authorization process. It will be trigger the whole login flow and prompt the user for any information that is no available otherwise.

func (*LoginHandler) SetLogger

func (lh *LoginHandler) SetLogger(l *logger.Logger)

SetLogger sets the logger to use to

type LoginState

type LoginState int

LoginState current state of the login flow

const (
	// LoginStateUnknown unknown
	LoginStateUnknown LoginState = iota

	// LoginStateAuth client is authorized
	LoginStateAuth

	// LoginStateNoAuth missing client authorization
	LoginStateNoAuth

	// LoginStateTFASetup user requires TFA setup
	LoginStateTFASetup

	// LoginStateTFAConfirm user requires TFA setup to be confirmed
	LoginStateTFAConfirm

	// LoginStateVerify verify authorization state by sending a request to Cumulocity
	LoginStateVerify

	// LoginStateAbort abort the login flow
	LoginStateAbort

	// LoginStatePromptPassword prompt for the password
	LoginStatePromptPassword
)

func (LoginState) String

func (l LoginState) String() string

Jump to

Keyboard shortcuts

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