Documentation
¶
Overview ¶
Package ldapAuth a ldap authentication plugin. nolint
Index ¶
- Variables
- func Connect(config LdapServerConfig) (*ldap.Conn, error)
- func LdapCheckAllowedUsers(conn *ldap.Conn, config *Config, entry *ldap.Entry, username string) bool
- func LdapCheckUser(conn *ldap.Conn, config *Config, server LdapServerConfig, ...) (bool, *ldap.Entry, error)
- func LdapCheckUserAuthorized(conn *ldap.Conn, config *Config, entry *ldap.Entry, username string) (bool, error)
- func LdapCheckUserGroups(conn *ldap.Conn, config *Config, entry *ldap.Entry, username string) (bool, error)
- func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error)
- func ParseSearchFilter(config *Config) (string, error)
- func RequireAuth(w http.ResponseWriter, req *http.Request, config *Config, err error)
- func SearchMode(conn *ldap.Conn, config *Config) (*ldap.SearchResult, error)
- func ServeAuthenicated(la *LdapAuth, session *sessions.Session, rw http.ResponseWriter, ...)
- func SetLogger(level string)
- type Config
- type LdapAuth
- type LdapServerConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // LoggerDEBUG level. LoggerDEBUG = log.New(ioutil.Discard, "DEBUG: ldapAuth: ", log.Ldate|log.Ltime|log.Lshortfile) // LoggerINFO level. LoggerINFO = log.New(ioutil.Discard, "INFO: ldapAuth: ", log.Ldate|log.Ltime|log.Lshortfile) // LoggerWARNING level. LoggerWARNING = log.New(ioutil.Discard, "WARNING: ldapAuth: ", log.Ldate|log.Ltime|log.Lshortfile) // LoggerERROR level. LoggerERROR = log.New(ioutil.Discard, "ERROR: ldapAuth: ", log.Ldate|log.Ltime|log.Lshortfile) )
nolint
Functions ¶
func Connect ¶ added in v0.0.6
func Connect(config LdapServerConfig) (*ldap.Conn, error)
Connect return a LDAP Connection.
func LdapCheckAllowedUsers ¶ added in v0.1.0
func LdapCheckAllowedUsers(conn *ldap.Conn, config *Config, entry *ldap.Entry, username string) bool
LdapCheckAllowedUsers check if user is explicitly allowed in AllowedUsers list
func LdapCheckUser ¶ added in v0.0.7
func LdapCheckUser(conn *ldap.Conn, config *Config, server LdapServerConfig, username, password string) (bool, *ldap.Entry, error)
LdapCheckUser check if user and password are correct.
func LdapCheckUserAuthorized ¶ added in v0.1.0
func LdapCheckUserAuthorized(conn *ldap.Conn, config *Config, entry *ldap.Entry, username string) (bool, error)
LdapCheckUserAuthorized check if user is authorized post-authentication
func LdapCheckUserGroups ¶ added in v0.0.14
func LdapCheckUserGroups(conn *ldap.Conn, config *Config, entry *ldap.Entry, username string) (bool, error)
LdapCheckUserGroups check if the is user is a member of any of the AllowedGroups list
func ParseSearchFilter ¶ added in v0.0.7
ParseSearchFilter remove spaces and trailing from searchFilter.
func RequireAuth ¶ added in v0.0.6
RequireAuth set Auth request.
func SearchMode ¶ added in v0.0.7
SearchMode make search to LDAP and return results.
func ServeAuthenicated ¶ added in v0.1.6
Types ¶
type Config ¶
type Config struct { Enabled bool `json:"enabled,omitempty" yaml:"enabled,omitempty"` LogLevel string `json:"logLevel,omitempty" yaml:"logLevel,omitempty"` ServerList []LdapServerConfig `json:"serverList,omitempty" yaml:"serverList,omitempty"` CacheTimeout uint32 `json:"cacheTimeout,omitempty" yaml:"cacheTimeout,omitempty"` CacheCookieName string `json:"cacheCookieName,omitempty" yaml:"cacheCookieName,omitempty"` CacheCookiePath string `json:"cacheCookiePath,omitempty" yaml:"cacheCookiePath,omitempty"` CacheCookieSecure bool `json:"cacheCookieSecure,omitempty" yaml:"cacheCookieSecure,omitempty"` CacheKey string `json:"cacheKey,omitempty" yaml:"cacheKey,omitempty"` CacheKeyLabel string `json:"cacheKeyLabel,omitempty" yaml:"cacheKeyLabel,omitempty"` Attribute string `json:"attribute,omitempty" yaml:"attribute,omitempty"` SearchFilter string `json:"searchFilter,omitempty" yaml:"searchFilter,omitempty"` BaseDN string `json:"baseDn,omitempty" yaml:"baseDn,omitempty"` BindDN string `json:"bindDn,omitempty" yaml:"bindDn,omitempty"` BindPassword string `json:"bindPassword,omitempty" yaml:"bindPassword,omitempty"` BindPasswordLabel string `json:"bindPasswordLabel,omitempty" yaml:"bindPasswordLabel,omitempty"` ForwardUsername bool `json:"forwardUsername,omitempty" yaml:"forwardUsername,omitempty"` ForwardUsernameHeader string `json:"forwardUsernameHeader,omitempty" yaml:"forwardUsernameHeader,omitempty"` ForwardAuthorization bool `json:"forwardAuthorization,omitempty" yaml:"forwardAuthorization,omitempty"` ForwardExtraLdapHeaders bool `json:"forwardExtraLdapHeaders,omitempty" yaml:"forwardExtraLdapHeaders,omitempty"` WWWAuthenticateHeader bool `json:"wwwAuthenticateHeader,omitempty" yaml:"wwwAuthenticateHeader,omitempty"` WWWAuthenticateHeaderRealm string `json:"wwwAuthenticateHeaderRealm,omitempty" yaml:"wwwAuthenticateHeaderRealm,omitempty"` EnableNestedGroupFilter bool `json:"enableNestedGroupsFilter,omitempty" yaml:"enableNestedGroupsFilter,omitempty"` AllowedGroups []string `json:"allowedGroups,omitempty" yaml:"allowedGroups,omitempty"` AllowedUsers []string `json:"allowedUsers,omitempty" yaml:"allowedUsers,omitempty"` Username string // params below are deprecated use 'ServerList' instead URL string `json:"url,omitempty" yaml:"url,omitempty"` Port uint16 `json:"port,omitempty" yaml:"port,omitempty"` StartTLS bool `json:"startTls,omitempty" yaml:"startTls,omitempty"` InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty" yaml:"insecureSkipVerify,omitempty"` MinVersionTLS string `json:"minVersionTls,omitempty" yaml:"minVersionTls,omitempty"` MaxVersionTLS string `json:"maxVersionTls,omitempty" yaml:"maxVersionTls,omitempty"` CertificateAuthority string `json:"certificateAuthority,omitempty" yaml:"certificateAuthority,omitempty"` }
Config the plugin configuration.
func CreateConfig ¶
func CreateConfig() *Config
CreateConfig creates the default plugin configuration.
type LdapAuth ¶
type LdapAuth struct {
// contains filtered or unexported fields
}
LdapAuth Struct plugin.
type LdapServerConfig ¶ added in v0.1.9
type LdapServerConfig struct { URL string `json:"url,omitempty" yaml:"url,omitempty"` Port uint16 `json:"port,omitempty" yaml:"port,omitempty"` Weight uint16 `json:"weight,omitempty" yaml:"weight,omitempty"` StartTLS bool `json:"startTls,omitempty" yaml:"startTls,omitempty"` InsecureSkipVerify bool `json:"insecureSkipVerify,omitempty" yaml:"insecureSkipVerify,omitempty"` MinVersionTLS string `json:"minVersionTls,omitempty" yaml:"minVersionTls,omitempty"` MaxVersionTLS string `json:"maxVersionTls,omitempty" yaml:"maxVersionTls,omitempty"` CertificateAuthority string `json:"certificateAuthority,omitempty" yaml:"certificateAuthority,omitempty"` }
Click to show internal directories.
Click to hide internal directories.