Documentation ¶
Index ¶
- Constants
- Variables
- func BarcodeHTMLfile(barcode, secret string) (*os.File, error)
- func Signin(f *factory.Factory) error
- type Auth
- func (a *Auth) Authentication(ctx context.Context, opts openapi.LoginRequest) (*openapi.LoginResponse, *MinMax, error)
- func (a *Auth) Authorization(ctx context.Context, token string) (*openapi.LoginResponse, error)
- func (a *Auth) InitializeOTP(ctx context.Context, password *string, token string) (*openapi.AuthenticationOtpInitializePost200Response, error)
- func (a *Auth) ProviderNames(ctx context.Context) ([]openapi.IdentityProvidersNamesGet200ResponseDataInner, error)
- func (a *Auth) PushOTP(ctx context.Context, answer, token string) (*openapi.LoginResponse, error)
- type Authenticate
- type Local
- type MinMax
- type OpenIDConnect
Constants ¶
const ( LocalProvider string = "Credentials" OidcProvider string = "Oidc" LdapProvider string = "Ldap" LdapCertificateProvider string = "LdapCertificate" RadiusProvider string = "Radius" SamlProvider string = "Saml" )
const OpenIDConnectHTML = `` /* 4825-byte string literal not displayed */
OpenIDConnectHTML is the signin complete view. same layout as the client uses.
Variables ¶
var ( ErrMissingCodePara = errors.New("missing code in parameter") ErrInvalidRequest = errors.New("error response") )
var ErrCantPromptOTP = errors.New("authentication requires one-time-password, but a TTY prompt is not allowed, can't continue")
var ErrInvalidOneTimePassword = errors.New("Invalid one-time password")
var ErrPlatformNotSupported = errors.New("Provider with OpenID Connect is not supported on your system")
var ErrPreConditionFailed = errors.New("OTP required")
var ErrSignInNotSupported = errors.New("No TTY present, and missing required environment variables to authenticate")
var KeyringWarningMessage = "" /* 130-byte string literal not displayed */
Functions ¶
func Signin ¶
Signin support interactive signin if a valid TTY is present, otherwise it requires environment variables to authenticate, this is only supported by 'local' auth provider If OTP is required, a prompt will appear and await user input Signin is done in several steps - Compute correct peer api version to use, based on login response body, which gives us a range of supported peer api to use - If there are more than 1 auth provider supported, prompt user to select (requires TTY | error shown if no TTY) - Store bearer token in os keyring, (refresh token if the provider supports it too) - Store the primary Controller version in config file - Save config file to $SDPCTL_CONFIG_DIR
Types ¶
type Auth ¶
func (*Auth) Authentication ¶
func (a *Auth) Authentication(ctx context.Context, opts openapi.LoginRequest) (*openapi.LoginResponse, *MinMax, error)
Authentication HTTP POST /authentication
func (*Auth) Authorization ¶
Authorization HTTP GET /authorization
func (*Auth) InitializeOTP ¶
func (a *Auth) InitializeOTP(ctx context.Context, password *string, token string) (*openapi.AuthenticationOtpInitializePost200Response, error)
InitializeOTP HTTP POST /authentication/otp/initialize
func (*Auth) ProviderNames ¶
func (a *Auth) ProviderNames(ctx context.Context) ([]openapi.IdentityProvidersNamesGet200ResponseDataInner, error)
ProviderNames HTTP GET /identity-providers/names
type Authenticate ¶
type Authenticate interface {
// contains filtered or unexported methods
}
type MinMax ¶
type MinMax struct {
Min, Max int32
}
func GetMinMaxAPIVersion ¶
GetMinMaxAPIVersion sends a invalid authentication request to use the error response body to determine min, max supported version for the current api
Example response body ¶
{ "id": "not acceptable", "maxSupportedVersion": 17, "message": "Invalid 'Accept' header. Current version: application/vnd.appgate.peer-v17+json, Received: application/vnd.appgate.peer-v5+json", "minSupportedVersion": 13 }
type OpenIDConnect ¶
type OpenIDConnect struct { Factory *factory.Factory Client *openapi.APIClient // contains filtered or unexported fields }
func NewOpenIDConnect ¶
func NewOpenIDConnect(f *factory.Factory, client *openapi.APIClient) *OpenIDConnect
func (*OpenIDConnect) Close ¶
func (o *OpenIDConnect) Close()