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 ¶
const ClientIdEnvVarName = "UIPATH_CLIENT_ID"
const ClientSecretEnvVarName = "UIPATH_CLIENT_SECRET" //nolint // This is not a secret but just the env variable name
const LOGGED_IN_PAGE_HTML = `` /* 2413-byte string literal not displayed */
const PatEnvVarName = "UIPATH_PAT"
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"` IdentityUri url.URL `json:"identityUri"` 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{}, identityUri url.URL, 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 ¶
func (a BearerAuthenticator) Auth(ctx AuthenticatorContext) AuthenticatorResult
type BrowserLauncher ¶ added in v1.0.8
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 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
func (a OAuthAuthenticator) Auth(ctx AuthenticatorContext) AuthenticatorResult
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
func (a PatAuthenticator) Auth(ctx AuthenticatorContext) AuthenticatorResult
Source Files ¶
- authenticator.go
- authenticator_context.go
- authenticator_request.go
- authenticator_result.go
- bearer_authenticator.go
- bearer_authenticator_config.go
- browser_launcher.go
- exec_browser_launcher.go
- identity_client.go
- oauth_authenticator.go
- oauth_authenticator_config.go
- oauth_authenticator_html.go
- pat_authenticator.go
- secret_generator.go
- token_request.go
- token_response.go