Documentation
¶
Index ¶
- Variables
- func GetSDKAuthOptionFromProfile(profile *profiles.ProfileStore) (sdk.Option, error)
- func GetTokenWithClientCreds(ctx context.Context, endpoint string, clientId string, clientSecret string, ...) (*oauth2.Token, error)
- func GetTokenWithProfile(ctx context.Context, profile *profiles.ProfileStore) (*oauth2.Token, error)
- func Login(platformEndpoint, tokenURL, authURL, publicClientID string) (*oauth2.Token, error)
- func LoginWithPKCE(host, publicClientID string, tlsNoVerify bool) (*oauth2.Token, string, error)
- func RevokeAccessToken(endpoint, publicClientID, refreshToken string, tlsNoVerify bool) error
- func ValidateProfileAuthCredentials(ctx context.Context, profile *profiles.ProfileStore) error
- type ClientCredentials
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrAccessTokenExpired = errors.New("access token expired")
View Source
var ErrAccessTokenNotFound = errors.New("no access token found")
View Source
var ErrClientCredentialsNotFound = errors.New("client credentials not found")
View Source
var ErrInvalidAuthType = errors.New("invalid auth type")
View Source
var ErrProfileCredentialsNotFound = errors.New("profile missing credentials")
View Source
var ErrUnauthenticated = errors.New("not logged in")
Functions ¶
func GetSDKAuthOptionFromProfile ¶
func GetSDKAuthOptionFromProfile(profile *profiles.ProfileStore) (sdk.Option, error)
func GetTokenWithClientCreds ¶
func GetTokenWithClientCreds(ctx context.Context, endpoint string, clientId string, clientSecret string, tlsNoVerify bool) (*oauth2.Token, error)
Uses the OAuth2 client credentials flow to obtain a token.
func GetTokenWithProfile ¶
func Login ¶
Facilitates an auth code PKCE flow to obtain OIDC tokens. Spawns a local server to handle the callback and opens a browser window in each respective OS.
func LoginWithPKCE ¶
Logs in using the auth code PKCE flow driven by the platform well-known idP OIDC configuration.
func RevokeAccessToken ¶
Revokes the access token
func ValidateProfileAuthCredentials ¶
func ValidateProfileAuthCredentials(ctx context.Context, profile *profiles.ProfileStore) error
Types ¶
type ClientCredentials ¶
type ClientCredentials struct { ClientId string `json:"clientId"` ClientSecret string `json:"clientSecret"` }
func GetClientCreds ¶
func GetClientCreds(endpoint string, file string, credsJSON []byte) (ClientCredentials, error)
func GetClientCredsFromFile ¶
func GetClientCredsFromFile(filepath string) (ClientCredentials, error)
Retrieves credentials by reading specified file
func GetClientCredsFromJSON ¶
func GetClientCredsFromJSON(credsJSON []byte) (ClientCredentials, error)
Parse the JSON and return the client ID and secret
Click to show internal directories.
Click to hide internal directories.