Basic LDAP search works
This commit is contained in:
@@ -1,12 +1,25 @@
|
||||
package backend
|
||||
|
||||
import "time"
|
||||
import (
|
||||
"errors"
|
||||
"go.uber.org/zap"
|
||||
"time"
|
||||
)
|
||||
|
||||
type UserType string
|
||||
|
||||
var (
|
||||
UtPerson UserType = "person"
|
||||
UtHost UserType = "host"
|
||||
UtService UserType = "service"
|
||||
)
|
||||
|
||||
// Session holds info about the logged-in user that won't change
|
||||
type Session struct {
|
||||
SessionID string
|
||||
Expiration time.Time
|
||||
UserID string
|
||||
UserType UserType
|
||||
LdapDN string
|
||||
}
|
||||
|
||||
@@ -15,6 +28,8 @@ type SessionCache struct {
|
||||
Valid bool
|
||||
Groups []string
|
||||
DisplayName string
|
||||
GivenName string
|
||||
SurName string
|
||||
Email string
|
||||
}
|
||||
|
||||
@@ -26,3 +41,34 @@ type Backend interface {
|
||||
DoMaintenance()
|
||||
Ping() error
|
||||
}
|
||||
|
||||
type NullBackend struct{}
|
||||
|
||||
func (n *NullBackend) PutSession(session Session, cache SessionCache) error {
|
||||
//TODO implement me
|
||||
zap.L().Info("Put session", zap.Any("session", session), zap.Any("cache", cache))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (n *NullBackend) GetSession(id string) (Session, *SessionCache, error) {
|
||||
//TODO implement me
|
||||
return Session{}, nil, errors.New("no such session")
|
||||
}
|
||||
|
||||
func (n *NullBackend) EndSession(id string) {
|
||||
//TODO implement me
|
||||
}
|
||||
|
||||
func (n *NullBackend) NewSessionID() (string, error) {
|
||||
//TODO implement me
|
||||
return "foo", nil
|
||||
}
|
||||
|
||||
func (n *NullBackend) DoMaintenance() {
|
||||
//TODO implement me
|
||||
}
|
||||
|
||||
func (n *NullBackend) Ping() error {
|
||||
//TODO implement me
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user