authldap

package
v0.0.0-...-b0d25e1 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConnectModePlain int = iota
	ConnectModeLDAPS
	ConnectModeStartTLS

	UserBindDN        = "UserBindDN"
	UserSearchFilter  = "UserSearchFilter"
	GroupSearchFilter = "GroupSearchFilter"
	SubjectName       = "SubjectName"
	Principal         = "Principal"

	AuthLDAPUsertEntry = "authLDAPUserEntry"
)
View Source
const (
	Type         = "authldap"
	DefaultName  = "authldap"
	DefaultRealm = "default realm"
)

Variables

View Source
var Log *logrus.Entry = logging.GetLogger("authldap").WithField("pkg", "auth/backend/authldap")

Functions

This section is empty.

Types

type AuthLDAP

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

func New

func New(conf *Config) (*AuthLDAP, error)

func (*AuthLDAP) Authenticate

func (al *AuthLDAP) Authenticate(pctx *auth.AuthContext, creds *auth.Credentials) (*auth.AuthContext, bool)

func (*AuthLDAP) CredentialType

func (al *AuthLDAP) CredentialType() string

func (*AuthLDAP) Name

func (al *AuthLDAP) Name() string

func (*AuthLDAP) Realm

func (al *AuthLDAP) Realm() string

func (*AuthLDAP) RenderTpl

func (al *AuthLDAP) RenderTpl(name string, data interface{}) string

func (*AuthLDAP) Type

func (al *AuthLDAP) Type() string

type Config

type Config struct {
	Name                     string
	Realm                    string
	ServerURL                string `yaml:"serverURL"`
	Timeout                  int
	Insecure                 bool
	UserBindDN               string   `yaml:"userBindDN"`
	UserSearchBase           string   `yaml:"userSearchBase"`
	UserSearchFilter         string   `yaml:"userSearchFilter"`
	UserSearchGetAttributes  []string `yaml:"userSearchGetAttributes"`
	AddPrincipalsFromGroups  bool     `yaml:"addPrincipalsFromGroups"`
	GroupSearchBase          string   `yaml:"groupSearchBase"`
	GroupSearchFilter        string   `yaml:"groupSearchFilter"`
	GroupSearchGetAttributes []string `yaml:"groupSearchGetAttributes"`
	SubjectNameTemplate      string   `yaml:"subjectNameTemplate"`
	PrincipalTemplate        string   `yaml:"principalTemplate"`

	UserNamePrincipal bool `yaml:"userNamePrincipal"`
	Principals        []string
	CriticalOptions   map[string]string `yaml:"criticalOptions"`
	Extensions        map[string]string
}
var Defaults *Config = &Config{
	Name:                     DefaultName,
	Realm:                    DefaultRealm,
	ServerURL:                "ldaps://127.0.0.1:636",
	Timeout:                  5,
	Insecure:                 false,
	UserBindDN:               "cn={{.UserName}},dc=example,dc=com",
	UserSearchBase:           "dc=example,dc=com",
	UserSearchFilter:         "(&(objectClass=user)(sAMAccountName={{.UserName}}))",
	UserSearchGetAttributes:  []string{"cn", "displayName"},
	AddPrincipalsFromGroups:  true,
	GroupSearchBase:          "dc=example,dc=com",
	GroupSearchFilter:        "(&(objectClass=group)(member:1.2.840.113556.1.4.1941:={{.User.DN}}))",
	GroupSearchGetAttributes: []string{"cn"},
	SubjectNameTemplate:      "{{.User.displayName}}",
	PrincipalTemplate:        "{{.Group.cn}}",

	UserNamePrincipal: true,
	Principals:        []string{},
	CriticalOptions:   map[string]string{},
	Extensions:        map[string]string{},
}

type EntryMap

type EntryMap map[string]interface{}

func (EntryMap) DN

func (em EntryMap) DN() string

func (EntryMap) Get

func (em EntryMap) Get(k string) string

Jump to

Keyboard shortcuts

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