suites

package
v4.38.8 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

README

Authelia Suites

A suite is a kind of virtual environment for Authelia. Please read the related documentation here to get more details.

Documentation

Index

Constants

View Source
const (
	SHA1   = "SHA1"
	SHA256 = "SHA256"
	SHA512 = "SHA512"
)

Variables

View Source
var (
	BaseDomain     = "example.com:8080"
	Example2DotCom = "example2.com:8080"
	Example3DotCom = "example3.com:8080"
)

BaseDomain the base domain.

View Source
var AdminBaseURL = fmt.Sprintf("https://admin.%s", BaseDomain)

AdminBaseURL the base URL of the admin domain.

View Source
var AutheliaBaseURL = "https://authelia.example.com:9091"

AutheliaBaseURL the base URL of Authelia service.

View Source
var DenyBaseURL = fmt.Sprintf("https://deny.%s", BaseDomain)

DenyBaseURL the base URL of the dev domain.

View Source
var DevBaseURL = fmt.Sprintf("https://dev.%s", BaseDomain)

DevBaseURL the base URL of the dev domain.

View Source
var DuoBaseURL = "https://duo.example.com"

DuoBaseURL the base URL of the Duo configuration API.

View Source
var HomeBaseURL = fmt.Sprintf("https://home.%s", BaseDomain)

HomeBaseURL the base URL of the home domain.

View Source
var LoginBaseURL = LoginBaseURLFmt(BaseDomain)

LoginBaseURL the base URL of the login portal.

View Source
var MX1MailBaseURL = fmt.Sprintf("https://mx1.mail.%s", BaseDomain)

MX1MailBaseURL the base URL of the mx1.mail domain.

View Source
var MX2MailBaseURL = fmt.Sprintf("https://mx2.mail.%s", BaseDomain)

MX2MailBaseURL the base URL of the mx2.mail domain.

View Source
var MailBaseURL = fmt.Sprintf("https://mail.%s", BaseDomain)

MailBaseURL the base URL of the mail domain.

View Source
var OIDCBaseURL = fmt.Sprintf("https://oidc.%s", BaseDomain)

OIDCBaseURL the base URL of the oidc domain.

View Source
var PublicBaseURL = fmt.Sprintf("https://public.%s", BaseDomain)

PublicBaseURL the base URL of the public domain.

View Source
var SecureBaseURL = fmt.Sprintf("https://secure.%s", BaseDomain)

SecureBaseURL the base URL of the secure domain.

View Source
var SingleFactorBaseURL = SingleFactorBaseURLFmt(BaseDomain)

SingleFactorBaseURL the base URL of the singlefactor domain.

Functions

func ConfigureDuo

func ConfigureDuo(t *testing.T, allowDeny DuoPolicy)

ConfigureDuo configure duo api to allow or block auth requests.

func ConfigureDuoPreAuth added in v4.33.0

func ConfigureDuoPreAuth(t *testing.T, response duo.PreAuthResponse)

ConfigureDuoPreAuth configure duo api to respond with available devices or enrollment Url.

func GetBrowserPath added in v4.38.0

func GetBrowserPath() (path string, err error)

GetBrowserPath retrieves the appropriate chromium browser path.

func GetLoginBaseURL

func GetLoginBaseURL(baseDomain string) string

GetLoginBaseURL returns the URL of the login portal and the path prefix if specified.

func GetLoginBaseURLWithFallbackPrefix added in v4.38.0

func GetLoginBaseURLWithFallbackPrefix(baseDomain, fallback string) string

GetLoginBaseURLWithFallbackPrefix overloads GetLoginBaseURL and includes '/' as a prefix if the prefix is empty.

func GetPathPrefix added in v4.38.0

func GetPathPrefix() string

GetPathPrefix returns the prefix/url_base of the login portal.

func LoginBaseURLFmt added in v4.38.0

func LoginBaseURLFmt(baseDomain string) string

LoginBaseURLFmt the base URL of the login portal for specified baseDomain.

func NewHTTPClient

func NewHTTPClient() *http.Client

NewHTTPClient create a new client skipping TLS verification and not redirecting.

func SingleFactorBaseURLFmt added in v4.38.0

func SingleFactorBaseURLFmt(baseDomain string) string

SingleFactorBaseURLFmt the base URL of the singlefactor with custom domain.

func StringToKeys added in v4.38.0

func StringToKeys(value string) []input.Key

func ValidateBrowserPath added in v4.38.0

func ValidateBrowserPath(path string) (browserPath string, err error)

ValidateBrowserPath validates the appropriate chromium browser path.

Types

type BaseSuite added in v4.38.0

type BaseSuite struct {
	suite.Suite

	Name string
}

func (*BaseSuite) SetupEnvironment added in v4.38.0

func (s *BaseSuite) SetupEnvironment()

func (*BaseSuite) SetupLogging added in v4.38.0

func (s *BaseSuite) SetupLogging()

func (*BaseSuite) SetupSuite added in v4.38.0

func (s *BaseSuite) SetupSuite()

type CommandSuite

type CommandSuite struct {
	*BaseSuite

	*DockerEnvironment
}

CommandSuite is a command line interface suite.

type DockerEnvironment

type DockerEnvironment struct {
	// contains filtered or unexported fields
}

DockerEnvironment represent a docker environment.

func NewDockerEnvironment

func NewDockerEnvironment(files []string) *DockerEnvironment

NewDockerEnvironment create a new docker environment.

func (*DockerEnvironment) Down

func (de *DockerEnvironment) Down() error

Down destroy a docker environment.

func (*DockerEnvironment) Exec

func (de *DockerEnvironment) Exec(service string, command []string) (string, error)

Exec execute a command within a given service of the environment.

func (*DockerEnvironment) Logs

func (de *DockerEnvironment) Logs(service string, flags []string) (string, error)

Logs get logs of a given service of the environment.

func (*DockerEnvironment) PrintLogs added in v4.38.0

func (de *DockerEnvironment) PrintLogs(services ...string) (err error)

PrintLogs for the given service names.

func (*DockerEnvironment) Pull

func (de *DockerEnvironment) Pull(images ...string) error

Pull pull all images of needed in the environment.

func (*DockerEnvironment) Restart

func (de *DockerEnvironment) Restart(service string) error

Restart restarts a service.

func (*DockerEnvironment) Start

func (de *DockerEnvironment) Start(service string) error

Start a docker service.

func (*DockerEnvironment) Stop

func (de *DockerEnvironment) Stop(service string) error

Stop a docker service.

func (*DockerEnvironment) Up

func (de *DockerEnvironment) Up() error

Up spawn a docker environment.

type DuoPolicy

type DuoPolicy int32

DuoPolicy a type of policy.

const (
	// Deny deny policy.
	Deny DuoPolicy = iota
	// Allow allow policy.
	Allow DuoPolicy = iota
)

type EmailMessage added in v4.38.0

type EmailMessage struct {
	ID         int       `json:"id"`
	Sender     string    `json:"sender"`
	Recipients []string  `json:"recipients"`
	Subject    string    `json:"subject"`
	Size       string    `json:"size"`
	CreatedAt  time.Time `json:"created_at"`
}

func (*EmailMessage) GetContent added in v4.38.0

func (m *EmailMessage) GetContent() (content []byte, err error)

func (*EmailMessage) GetContentReader added in v4.38.0

func (m *EmailMessage) GetContentReader() (reader io.ReadCloser, err error)

type K3D added in v4.37.4

type K3D struct{}

K3D used for running kind commands.

func (K3D) ClusterExists added in v4.37.4

func (k K3D) ClusterExists() (bool, error)

ClusterExists check whether a cluster exists.

func (K3D) CreateCluster added in v4.37.4

func (k K3D) CreateCluster() error

CreateCluster create a new Kubernetes cluster.

func (K3D) DeleteCluster added in v4.37.4

func (k K3D) DeleteCluster() error

DeleteCluster delete a Kubernetes cluster.

func (K3D) LoadImage added in v4.37.4

func (k K3D) LoadImage(imageName string) error

LoadImage load an image in the Kubernetes container.

type Kubectl

type Kubectl struct{}

Kubectl used for running kubectl commands.

func (Kubectl) GetDashboardToken added in v4.37.4

func (k Kubectl) GetDashboardToken() error

GetDashboardToken generates bearer token for Kube Dashboard.

func (Kubectl) WaitPodsReady

func (k Kubectl) WaitPodsReady(namespace string, timeout time.Duration) error

WaitPodsReady wait for all pods to be ready.

type OptionsTOTP added in v4.38.0

type OptionsTOTP struct {
	Secret            string
	ValidationOptions totp.ValidateOpts
}

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry represent a registry of suite by name.

var GlobalRegistry *Registry

GlobalRegistry a global registry used by Authelia tooling.

func NewSuitesRegistry

func NewSuitesRegistry() *Registry

NewSuitesRegistry create a suites registry.

func (*Registry) Get

func (sr *Registry) Get(name string) Suite

Get return a suite by name.

func (*Registry) Register

func (sr *Registry) Register(name string, suite Suite)

Register register a suite by name.

func (*Registry) Suites

func (sr *Registry) Suites() []string

Suites list available suites.

type RodSession added in v4.33.0

type RodSession struct {
	Launcher  *launcher.Launcher
	WebDriver *rod.Browser

	RodSuiteCredentialsProvider
}

RodSession binding a chrome session with devtool protocol.

func NewRodSession added in v4.38.0

func NewRodSession(options ...RodSessionOpt) (session *RodSession, err error)

func StartRod added in v4.33.0

func StartRod() (*RodSession, error)

StartRod create a rod/chromedp session.

func (*RodSession) CheckElementExistsLocatedByID added in v4.38.0

func (rs *RodSession) CheckElementExistsLocatedByID(t *testing.T, page *rod.Page, cssSelector string) bool

CheckElementExistsLocatedByID checks the existence of an element located by an id.

func (*RodSession) Stop added in v4.33.0

func (rs *RodSession) Stop() error

Stop stop the rod/chromedp session.

func (*RodSession) WaitElementLocatedByClassName added in v4.33.0

func (rs *RodSession) WaitElementLocatedByClassName(t *testing.T, page *rod.Page, className string) *rod.Element

WaitElementLocatedByClassName wait an element is located by class name.

func (*RodSession) WaitElementLocatedByID added in v4.35.0

func (rs *RodSession) WaitElementLocatedByID(t *testing.T, page *rod.Page, cssSelector string) *rod.Element

WaitElementLocatedByID waits for an element located by an id.

func (*RodSession) WaitElementsLocatedByID added in v4.35.0

func (rs *RodSession) WaitElementsLocatedByID(t *testing.T, page *rod.Page, cssSelector string) rod.Elements

WaitElementsLocatedByID waits for an elements located by an id.

type RodSessionCredentials added in v4.38.0

type RodSessionCredentials struct {
	TOTP *OptionsTOTP
}

type RodSessionOpt added in v4.38.0

type RodSessionOpt func(opts *RodSessionOpts) (err error)

func RodSessionWithCredentials added in v4.38.0

func RodSessionWithCredentials(provider RodSuiteCredentialsProvider) RodSessionOpt

func RodSessionWithProxy added in v4.38.0

func RodSessionWithProxy(proxy string) RodSessionOpt

type RodSessionOpts added in v4.38.0

type RodSessionOpts struct {
	// contains filtered or unexported fields
}

type RodSuite added in v4.33.0

RodSuite is a go-rod suite.

func NewRodSuite added in v4.38.0

func NewRodSuite(name string) *RodSuite

func (*RodSuite) GetCookieNames added in v4.38.0

func (s *RodSuite) GetCookieNames() (names []string)

type RodSuiteCredentialOneTimePassword added in v4.38.0

type RodSuiteCredentialOneTimePassword struct {
	Secret            string
	ValidationOptions totp.ValidateOpts
	// contains filtered or unexported fields
}

func (*RodSuiteCredentialOneTimePassword) Generate added in v4.38.0

func (otp *RodSuiteCredentialOneTimePassword) Generate(at time.Time) (passcode string, err error)

func (*RodSuiteCredentialOneTimePassword) Valid added in v4.38.0

type RodSuiteCredentialWebAuthn added in v4.38.0

type RodSuiteCredentialWebAuthn struct {
	AuthenticatorID proto.WebAuthnAuthenticatorID
	Credentials     []*proto.WebAuthnCredential
}

type RodSuiteCredentials added in v4.38.0

type RodSuiteCredentials struct {
	// contains filtered or unexported fields
}

func NewRodSuiteCredentials added in v4.38.0

func NewRodSuiteCredentials() *RodSuiteCredentials

func (*RodSuiteCredentials) DeleteOneTimePassword added in v4.38.0

func (rsc *RodSuiteCredentials) DeleteOneTimePassword(username string)

func (*RodSuiteCredentials) DeleteWebAuthnAuthenticator added in v4.38.0

func (rsc *RodSuiteCredentials) DeleteWebAuthnAuthenticator()

func (*RodSuiteCredentials) DeleteWebAuthnAuthenticatorCredentials added in v4.38.0

func (rsc *RodSuiteCredentials) DeleteWebAuthnAuthenticatorCredentials()

func (*RodSuiteCredentials) GetOneTimePassword added in v4.38.0

func (rsc *RodSuiteCredentials) GetOneTimePassword(username string) RodSuiteCredentialOneTimePassword

func (*RodSuiteCredentials) GetWebAuthnAuthenticator added in v4.38.0

func (rsc *RodSuiteCredentials) GetWebAuthnAuthenticator() (authenticatorID proto.WebAuthnAuthenticatorID, credentials []*proto.WebAuthnCredential)

func (*RodSuiteCredentials) GetWebAuthnAuthenticatorID added in v4.38.0

func (rsc *RodSuiteCredentials) GetWebAuthnAuthenticatorID() (authenticatorID proto.WebAuthnAuthenticatorID)

func (*RodSuiteCredentials) GetWebAuthnCredentials added in v4.38.0

func (rsc *RodSuiteCredentials) GetWebAuthnCredentials() (credentials []*proto.WebAuthnCredential)

func (*RodSuiteCredentials) SetOneTimePassword added in v4.38.0

func (rsc *RodSuiteCredentials) SetOneTimePassword(username string, credential RodSuiteCredentialOneTimePassword)

func (*RodSuiteCredentials) SetWebAuthnAuthenticatorCredentials added in v4.38.0

func (rsc *RodSuiteCredentials) SetWebAuthnAuthenticatorCredentials(credentials ...*proto.WebAuthnCredential)

func (*RodSuiteCredentials) SetWebAuthnAuthenticatorID added in v4.38.0

func (rsc *RodSuiteCredentials) SetWebAuthnAuthenticatorID(authenticatorID proto.WebAuthnAuthenticatorID)

func (*RodSuiteCredentials) UpdateWebAuthnAuthenticator added in v4.38.0

func (rsc *RodSuiteCredentials) UpdateWebAuthnAuthenticator(funcUpdate func(authenticatorID proto.WebAuthnAuthenticatorID, credentials []*proto.WebAuthnCredential) (proto.WebAuthnAuthenticatorID, []*proto.WebAuthnCredential))

type RodSuiteCredentialsProvider added in v4.38.0

type RodSuiteCredentialsProvider interface {
	GetOneTimePassword(username string) RodSuiteCredentialOneTimePassword
	SetOneTimePassword(username string, credential RodSuiteCredentialOneTimePassword)
	DeleteOneTimePassword(username string)

	GetWebAuthnAuthenticatorID() (authenticatorID proto.WebAuthnAuthenticatorID)
	GetWebAuthnCredentials() (credentials []*proto.WebAuthnCredential)
	SetWebAuthnAuthenticatorID(authenticatorID proto.WebAuthnAuthenticatorID)
	SetWebAuthnAuthenticatorCredentials(credentials ...*proto.WebAuthnCredential)
	DeleteWebAuthnAuthenticatorCredentials()
	GetWebAuthnAuthenticator() (authenticatorID proto.WebAuthnAuthenticatorID, credentials []*proto.WebAuthnCredential)
	UpdateWebAuthnAuthenticator(funcUpdate func(authenticatorID proto.WebAuthnAuthenticatorID, credentials []*proto.WebAuthnCredential) (proto.WebAuthnAuthenticatorID, []*proto.WebAuthnCredential))
	DeleteWebAuthnAuthenticator()
}

type Suite

type Suite struct {
	SetUp        func(tmpPath string) error
	SetUpTimeout time.Duration

	// Callback called when an error occur during setup phase.
	OnSetupTimeout func() error

	// Callback called when at least one test fail.
	OnError func() error

	TestTimeout time.Duration

	TearDown        func(tmpPath string) error
	TearDownTimeout time.Duration

	// A textual description of the suite purpose.
	Description string
}

Suite the definition of a suite.

Jump to

Keyboard shortcuts

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