auth

package
v1.0.82 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package auth implements multiple schemas for authentication CLI requests. - Supports JWT bearer token, OAuth flows and Personal access token out-of-the-box. - Provides interfaces to implement custom authenticators.

Index

Constants

View Source
const ClientIdEnvVarName = "UIPATH_CLIENT_ID"
View Source
const ClientSecretEnvVarName = "UIPATH_CLIENT_SECRET" //nolint // This is not a secret but just the env variable name
View Source
const IdentityUriEnvVarName = "UIPATH_IDENTITY_URI"
View Source
const LOGGED_IN_PAGE_HTML = `` /* 2413-byte string literal not displayed */
View Source
const PatEnvVarName = "UIPATH_PAT"
View Source
const TokenRoute = "/connect/token"

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

type Authenticator interface {
	Auth(ctx AuthenticatorContext) AuthenticatorResult
}

Authenticator interface for providing auth credentials.

type AuthenticatorContext

type AuthenticatorContext struct {
	Type     string                 `json:"type"`
	Config   map[string]interface{} `json:"config"`
	Debug    bool                   `json:"debug"`
	Insecure bool                   `json:"insecure"`
	Request  AuthenticatorRequest   `json:"request"`
}

AuthenticatorContext provides information required for authenticating requests.

func NewAuthenticatorContext

func NewAuthenticatorContext(
	authType string,
	config map[string]interface{},
	debug bool,
	insecure bool,
	request AuthenticatorRequest) *AuthenticatorContext

type AuthenticatorRequest

type AuthenticatorRequest struct {
	URL    string            `json:"url"`
	Header map[string]string `json:"header"`
}

AuthenticatorRequest describes the request which needs to be authenticated.

func NewAuthenticatorRequest

func NewAuthenticatorRequest(
	url string,
	header map[string]string) *AuthenticatorRequest

type AuthenticatorResult

type AuthenticatorResult struct {
	Error         string                 `json:"error"`
	RequestHeader map[string]string      `json:"requestHeader"`
	Config        map[string]interface{} `json:"config"`
}

The AuthenticatorResult indicates if the authentication was successful and returns the authentication credentials.

func AuthenticatorError

func AuthenticatorError(err error) *AuthenticatorResult

func AuthenticatorSuccess

func AuthenticatorSuccess(requestHeader map[string]string, config map[string]interface{}) *AuthenticatorResult

type BearerAuthenticator

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

The BearerAuthenticator calls the identity token-endpoint to retrieve a JWT bearer token. It requires clientId and clientSecret.

func NewBearerAuthenticator added in v1.0.57

func NewBearerAuthenticator(cache cache.Cache) *BearerAuthenticator

func (BearerAuthenticator) Auth

type BrowserLauncher added in v1.0.8

type BrowserLauncher interface {
	Open(url string) error
}

BrowserLauncher interface for opening browser windows.

type ExecBrowserLauncher added in v1.0.8

type ExecBrowserLauncher struct{}

ExecBrowserLauncher is the default implementation for the browser launcher which tries to open the default browser on the local system.

func NewExecBrowserLauncher added in v1.0.57

func NewExecBrowserLauncher() *ExecBrowserLauncher

func (ExecBrowserLauncher) Open added in v1.0.48

func (l ExecBrowserLauncher) Open(url string) error

type ExternalAuthenticator

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

The ExternalAuthenticator invokes a configurable executable which is providing the authentication credentials.

The ExternalAuthenticator serializes the AuthenticatorContext and passes it on standard input to the external executable. The executable performs the authentication and returns the AuthenticatorResult on standard output.

Example: Authenticator which uses kubernetes to retrieve clientId, clientSecret https://github.com/UiPath/uipathcli-authenticator-k8s

func NewExternalAuthenticator added in v1.0.57

func NewExternalAuthenticator(config ExternalAuthenticatorConfig) *ExternalAuthenticator

func (ExternalAuthenticator) Auth

type ExternalAuthenticatorConfig

type ExternalAuthenticatorConfig struct {
	Name string
	Path string
}

ExternalAuthenticatorConfig keeps the configuration values for the external authenticator.

func NewExternalAuthenticatorConfig

func NewExternalAuthenticatorConfig(
	name string,
	path string) *ExternalAuthenticatorConfig

type OAuthAuthenticator added in v1.0.1

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

The OAuthAuthenticator triggers the oauth authorization code flow with proof key for code exchange (PKCE).

The user can login to the UiPath platform using the browser. In case the user interface is available, the browser is automatically launched and the oauth flow will be initiated. The CLI will open up a port on localhost waiting for the cloud.uipath.com platform to redirect back for handing over the authorization code which will be exchanged for a JWT bearer token using the token-endpoint from identity.

There is no need to store any long-term credentials.

func NewOAuthAuthenticator added in v1.0.57

func NewOAuthAuthenticator(cache cache.Cache, browserLauncher BrowserLauncher) *OAuthAuthenticator

func (OAuthAuthenticator) Auth added in v1.0.1

type PatAuthenticator added in v1.0.2

type PatAuthenticator struct{}

PatAuthenticator provides authorization headers when using personal access tokens.

func NewPatAuthenticator added in v1.0.57

func NewPatAuthenticator() *PatAuthenticator

func (PatAuthenticator) Auth added in v1.0.2

Jump to

Keyboard shortcuts

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