auth

package
v1.0.106 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 19 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

func NewBearerAuthenticator(cache cache.Cache) *BearerAuthenticator

func (BearerAuthenticator) Auth

type BrowserLauncher

type BrowserLauncher interface {
	Open(url string) error
}

BrowserLauncher interface for opening browser windows.

type ExecBrowserLauncher

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

func NewExecBrowserLauncher() *ExecBrowserLauncher

func (ExecBrowserLauncher) Open

func (l ExecBrowserLauncher) Open(url string) error

type OAuthAuthenticator

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

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

func (OAuthAuthenticator) Auth

type PatAuthenticator

type PatAuthenticator struct{}

PatAuthenticator provides authorization headers when using personal access tokens.

func NewPatAuthenticator

func NewPatAuthenticator() *PatAuthenticator

func (PatAuthenticator) Auth

Jump to

Keyboard shortcuts

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