auth

package
v1.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthRequest added in v0.8.0

type AuthRequest interface {
	GetPassword() string
	GetUserName() string
}

type Authorizer

type Authorizer interface {
	Authorize(ctx context.Context, msg AuthRequest) (bool, error)
}

type DashboardAuthorizer added in v0.8.0

type DashboardAuthorizer struct {
	URL    string
	Client *http.Client
}

DashboardAuthorizer authorize with cosmo-dashboard login API

func NewDashboardAuthorizer added in v0.8.0

func NewDashboardAuthorizer(url string, ca []byte) *DashboardAuthorizer

func (*DashboardAuthorizer) Authorize added in v0.8.0

func (a *DashboardAuthorizer) Authorize(ctx context.Context, msg AuthRequest) (bool, error)

type LdapAuthorizer added in v0.9.0

type LdapAuthorizer struct {
	// for connection
	URL                string // URI to your LDAP server/Domain Controller. ldap[s]://host_or_ip[:port]
	StartTLS           bool   // Enables StartTLS functionality
	TlsConfig          *tls.Config
	BindDN             string // [for Bind mode] ex: uid=%s,ou=users,dc=example,dc=com. "%s" is replaced by the user name.
	SearchBindDN       string // [for Search mode] The domain name to bind. ex: cn=admin,dc=example,dc=com
	SearchBindPassword string // [for Search mode] The password to bind.
	SearchBaseDN       string // [for Search mode] Base DN used for all LDAP queries. ex: dc=example,dc=com
	SearchFilter       string // [for Search mode] ex: "(sAMAccountname=%s)"  "%s" is replaced by the user name.
}

LdapAuthorizer authorize with cosmo user's password secret

func (*LdapAuthorizer) Authorize added in v0.9.0

func (a *LdapAuthorizer) Authorize(ctx context.Context, msg AuthRequest) (bool, error)

type MockAuthorizer added in v0.9.0

type MockAuthorizer struct {
	UserPassMap map[string]string // key: user, value: password
}

func NewMockAuthorizer added in v0.9.0

func NewMockAuthorizer(userPassMap map[string]string) *MockAuthorizer

func (*MockAuthorizer) Authorize added in v0.9.0

func (a *MockAuthorizer) Authorize(ctx context.Context, msg AuthRequest) (bool, error)

type PasswordSecretAuthorizer added in v0.5.0

type PasswordSecretAuthorizer struct {
	client.Client
}

PasswordSecretAuthorizer authorize with cosmo user's password secret

func NewPasswordSecretAuthorizer added in v0.5.0

func NewPasswordSecretAuthorizer(c client.Client) *PasswordSecretAuthorizer

func (*PasswordSecretAuthorizer) Authorize added in v0.5.0

func (a *PasswordSecretAuthorizer) Authorize(ctx context.Context, msg AuthRequest) (bool, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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