ldap

package
v0.0.0-...-8150c2d Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2019 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Overview

Copyright (C) 2016 H2O.ai, Inc. <http://h2o.ai/>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2016 H2O.ai, Inc. <http://h2o.ai/>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Copyright (C) 2016 H2O.ai, Inc. <http://h2o.ai/>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicLdapAuth

type BasicLdapAuth struct {
	Realm string

	// Headers used by authenticator. Set to ProxyHeaders to use with
	// proxy server. When nil, NormalHeaders are used.
	Headers *auth.Headers

	Conn *Ldap
}

func NewBasicLdapAuth

func NewBasicLdapAuth(realm string, conn *Ldap) *BasicLdapAuth

func (*BasicLdapAuth) CheckAuth

func (a *BasicLdapAuth) CheckAuth(r *http.Request) string

CheckAuth verifies the user is authenticated by either finding them in the LDAP config map or binding the LDAP

func (*BasicLdapAuth) NewContext

func (a *BasicLdapAuth) NewContext(ctx context.Context, r *http.Request) context.Context

func (*BasicLdapAuth) RequireAuth

func (a *BasicLdapAuth) RequireAuth(w http.ResponseWriter, r *http.Request)

Ask for BasicAuth headers

func (*BasicLdapAuth) Wrap

type Ldap

type Ldap struct {
	Address  string
	BindDN   string
	BindPass string `toml:"bindPassword"`

	UserBaseDn      string
	UserIdAttribute string
	UserObjectClass string

	ForceBind bool

	// Users who are logged in
	Users *LdapUser
	// contains filtered or unexported fields
}

func FromConfig

func FromConfig(fileName string) (*Ldap, error)

func NewLdap

func NewLdap(
	address, bindDn, bindPass string,
	userBaseDn, userIdAttribute, userObjectClass string,
	forceBind bool,
	idleTime, maxTime time.Duration) *Ldap

func (*Ldap) CheckBind

func (l *Ldap) CheckBind(user, password string) error

type LdapUser

type LdapUser struct {
	IdlTime time.Duration
	MaxTime time.Duration
	// contains filtered or unexported fields
}

func NewLdapUser

func NewLdapUser(idleTime, maxTime time.Duration) *LdapUser

func (*LdapUser) Delete

func (u *LdapUser) Delete(auth string)

Delete removes a user from the LdapUsers map and stop/flushes the timer

func (*LdapUser) Exists

func (u *LdapUser) Exists(auth string) bool

Exists verifies if a user is in the Users map

func (*LdapUser) NewUser

func (u *LdapUser) NewUser(auth, user, password string, conn *Ldap) string

NewUser creates a new LdapUser with it's own "self-destruct" timer

Jump to

Keyboard shortcuts

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