auth

package
v0.0.0-...-64d012e Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: BSD-2-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pad

func Pad(src []byte) []byte

func Unpad

func Unpad(src []byte) ([]byte, error)

Types

type CacheTTL

type CacheTTL time.Duration

func (CacheTTL) Duration

func (c CacheTTL) Duration() time.Duration

func (CacheTTL) IsEmpty

func (c CacheTTL) IsEmpty() bool

type Crypter

type Crypter interface {
	Encrypt(text string) (string, error)
	Decrypt(text string) (string, error)
}

func NewCrypter

func NewCrypter(key []byte) Crypter

The key argument should be the AES key, either 16 or 32 bytes to select AES-128 or AES-256.

type GroupName

type GroupName string

func (GroupName) String

func (g GroupName) String() string

type LdapAuth

type LdapAuth struct {
	LdapAuthenticator LdapAuthenticator
	RequiredGroups    []GroupName
}

func (*LdapAuth) Verify

func (l *LdapAuth) Verify(username UserName, password Password) (bool, error)

type LdapAuthenticator

type LdapAuthenticator interface {
	Authenticate(UserName, Password) (bool, map[string]string, error)
	GetGroupsOfUser(UserName) ([]string, error)
}

func NewLdapAuthenticator

func NewLdapAuthenticator(
	ldapBaseDn LdapBaseDn,
	ldapHost LdapHost,
	ldapServerName LdapServerName,
	ldapPort LdapPort,
	ldapUseSSL LdapUseSSL,
	ldapSkipTls LdapSkipTls,
	ldapBindDN LdapBindDN,
	ldapBindPassword LdapBindPassword,
	ldapUserDn LdapUserDn,
	ldapUserFilter LdapUserFilter,
	ldapUserField LdapUserField,
	ldapGroupDn LdapGroupDn,
	ldapGroupFilter LdapGroupFilter,
	ldapGroupField LdapGroupField,
) LdapAuthenticator

type LdapBaseDn

type LdapBaseDn string

func (LdapBaseDn) String

func (l LdapBaseDn) String() string

type LdapBindDN

type LdapBindDN string

func (LdapBindDN) String

func (l LdapBindDN) String() string

type LdapBindPassword

type LdapBindPassword string

func (LdapBindPassword) String

func (l LdapBindPassword) String() string

type LdapGroupDn

type LdapGroupDn string

func (LdapGroupDn) String

func (l LdapGroupDn) String() string

type LdapGroupField

type LdapGroupField string

func (LdapGroupField) String

func (l LdapGroupField) String() string

type LdapGroupFilter

type LdapGroupFilter string

func (LdapGroupFilter) String

func (l LdapGroupFilter) String() string

type LdapHost

type LdapHost string

func (LdapHost) String

func (l LdapHost) String() string

type LdapPort

type LdapPort int

func (LdapPort) Int

func (l LdapPort) Int() int

type LdapServerName

type LdapServerName string

func (LdapServerName) String

func (l LdapServerName) String() string

type LdapSkipTls

type LdapSkipTls bool

func (LdapSkipTls) Bool

func (l LdapSkipTls) Bool() bool

type LdapUseSSL

type LdapUseSSL bool

func (LdapUseSSL) Bool

func (l LdapUseSSL) Bool() bool

type LdapUserDn

type LdapUserDn string

func (LdapUserDn) String

func (l LdapUserDn) String() string

type LdapUserField

type LdapUserField string

func (LdapUserField) String

func (l LdapUserField) String() string

type LdapUserFilter

type LdapUserFilter string

func (LdapUserFilter) String

func (l LdapUserFilter) String() string

type Password

type Password string

func (Password) String

func (p Password) String() string

type UserFile

type UserFile string

func (UserFile) String

func (u UserFile) String() string

type UserName

type UserName string

func (UserName) String

func (u UserName) String() string

type Verifier

type Verifier interface {
	Verify(UserName, Password) (bool, error)
}

func NewCacheAuth

func NewCacheAuth(
	verifier Verifier,
	ttl CacheTTL,
) Verifier

func NewCrowdAuth

func NewCrowdAuth(crowdAuthenticate crowdAuthenticate) Verifier

func NewFileAuth

func NewFileAuth(userFile UserFile) Verifier

Jump to

Keyboard shortcuts

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