auth

package
v0.0.0-...-f23cdb6 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LocalProvider           string = "Credentials"
	OidcProvider            string = "Oidc"
	LdapProvider            string = "Ldap"
	LdapCertificateProvider string = "LdapCertificate"
	RadiusProvider          string = "Radius"
	SamlProvider            string = "Saml"
)
View Source
const OpenIDConnectHTML = `` /* 4825-byte string literal not displayed */

OpenIDConnectHTML is the signin complete view. same layout as the client uses.

Variables

View Source
var (
	ErrMissingCodePara = errors.New("missing code in parameter")
	ErrInvalidRequest  = errors.New("error response")
)
View Source
var ErrCantPromptOTP = errors.New("authentication requires one-time-password, but a TTY prompt is not allowed, can't continue")
View Source
var ErrInvalidOneTimePassword = errors.New("Invalid one-time password")
View Source
var ErrPlatformNotSupported = errors.New("Provider with OpenID Connect is not supported on your system")
View Source
var ErrPreConditionFailed = errors.New("OTP required")
View Source
var ErrSignInNotSupported = errors.New("No TTY present, and missing required environment variables to authenticate")
View Source
var KeyringWarningMessage = "" /* 130-byte string literal not displayed */

Functions

func BarcodeHTMLfile

func BarcodeHTMLfile(barcode, secret string) (*os.File, error)

func Signin

func Signin(f *factory.Factory) error

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

type Auth struct {
	APIClient *openapi.APIClient
}

func NewAuth

func NewAuth(APIClient *openapi.APIClient) *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

func (a *Auth) Authorization(ctx context.Context, token string) (*openapi.LoginResponse, error)

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

ProviderNames HTTP GET /identity-providers/names

func (*Auth) PushOTP

func (a *Auth) PushOTP(ctx context.Context, answer, token string) (*openapi.LoginResponse, error)

PushOTP HTTP POST /authentication/otp

type Authenticate

type Authenticate interface {
	// contains filtered or unexported methods
}

type Local

type Local struct {
	Factory *factory.Factory
}

func NewLocal

func NewLocal(f *factory.Factory) *Local

type MinMax

type MinMax struct {
	Min, Max int32
}

func GetMinMaxAPIVersion

func GetMinMaxAPIVersion(f *factory.Factory) (*MinMax, error)

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()

Jump to

Keyboard shortcuts

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