mirror of
https://github.com/glauth/glauth.git
synced 2026-10-25 05:30:47 +00:00
2eb2215ae4
This commit actually covers a few items. In future commits, I will keep features distinct. This is only happening this time around due to how long it took to merge this branch. Covered: - Database plugins (at this time: SQLite, MySQL, Postgres) - Backends acting as middleware: added the [[Backends]] configuration directive while retaining backward compatibility with [Backend] - Schema introspection (root DSE query with base scope) - When proxying, insert queried attribute back in upstream response, if absent, so that the LDAP library does not filter out all entries - When chaining backends, any backend can be used to inject OTP value in password, before reaching a non-OTP-aware backend (currently guarded by a True statement in case we find an issue (I did thoroughly test but you never know)) - Handling of special "1.1" attributes filter meaning "I do not want attributes" (RFC 4511, 4.5.1.8) - Support for "want types only" queries, even when proxying
35 lines
754 B
Go
35 lines
754 B
Go
package handler
|
|
|
|
import (
|
|
"github.com/glauth/glauth/pkg/config"
|
|
"github.com/nmcclain/ldap"
|
|
)
|
|
|
|
type HelperMaker interface {
|
|
FindUser(userName string) (bool, config.User, error)
|
|
}
|
|
|
|
// Handler is the common interface for all datastores
|
|
type Handler interface {
|
|
// read support
|
|
ldap.Binder
|
|
ldap.Searcher
|
|
ldap.Closer
|
|
|
|
// write support
|
|
ldap.Adder
|
|
ldap.Modifier // Note: modifying eg the uid or cn might change the dn because the hierarchy is determined by the backend
|
|
ldap.Deleter
|
|
|
|
// helper
|
|
HelperMaker
|
|
}
|
|
|
|
// TODO When I grow up, I want to handle pointers same as I would in C
|
|
// and not need a counter because I would not allocate statically
|
|
// but use idiomatic slicing instead
|
|
type HandlerWrapper struct {
|
|
Handlers []Handler
|
|
Count *int
|
|
}
|