pkg

package
v0.0.0-...-440d53e Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: BSD-2-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const HTML_LOGIN_FORM = `` /* 1929-byte string literal not displayed */
View Source
const HTML_REDIRECT = `` /* 1048-byte string literal not displayed */

Variables

This section is empty.

Functions

func CreateAuthorizationBearerHeader

func CreateAuthorizationBearerHeader(name string, value string) string

func CreateAuthorizationBearerHeaderSimple

func CreateAuthorizationBearerHeaderSimple(name string) string

func CreateAuthorizationToken

func CreateAuthorizationToken(name string, value string) string

func CreateAuthorizationTokenSimple

func CreateAuthorizationTokenSimple(name string) string

func NewAuthBasicHandler

func NewAuthBasicHandler(subhandler http.HandlerFunc, check Check, realm string) *authHandler

func NewAuthHtmlHandler

func NewAuthHtmlHandler(
	subhandler http.HandlerFunc,
	check Check,
	crypter Crypter,
) *authHtmlHandler

func NewCheckHandler

func NewCheckHandler(c func() error) *checkHandler

func NewDebugHandler

func NewDebugHandler(subhandler http.Handler) *debugHandler

func NewForwardHandler

func NewForwardHandler(target string, executeRequest executeRequest) *forwardHandler

func Pad

func Pad(src []byte) []byte

func ParseAuthorizationBasisHttpRequest

func ParseAuthorizationBasisHttpRequest(req *http.Request) (string, string, error)

func ParseAuthorizationBearerHttpRequest

func ParseAuthorizationBearerHttpRequest(req *http.Request) (string, string, error)

func ParseAuthorizationBearerHttpRequestSimple

func ParseAuthorizationBearerHttpRequestSimple(req *http.Request) (string, error)

func ParseAuthorizationHeader

func ParseAuthorizationHeader(authtype string, header string) (string, string, error)

func ParseAuthorizationHeaderSimple

func ParseAuthorizationHeaderSimple(authtype string, header string) (string, error)

func ParseAuthorizationHttpRequest

func ParseAuthorizationHttpRequest(authtype string, req *http.Request) (string, string, error)

func ParseAuthorizationHttpRequestSimple

func ParseAuthorizationHttpRequestSimple(authtype string, req *http.Request) (string, error)

func ParseAuthorizationToken

func ParseAuthorizationToken(token string) (string, string, error)

func ParseAuthorizationTokenSimple

func ParseAuthorizationTokenSimple(token string) (string, error)

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 Check

type Check func(username string, password string) (bool, error)

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