auth

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

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

Error represents an error that occurs during the authentication.

type Session

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

Session represents a single LDAP authenticated connection.

func (*Session) Object

func (session *Session) Object() ldap.Object

Object returns the LDAP object associated with the given session.

type SessionOption

type SessionOption func(conn *Session)

SessionOption customize a authnConn before its registration on authConns.

func WithRefreshable

func WithRefreshable() SessionOption

WithRefreshable allows the given conn to have its expiration date increased after each operation.

type Sessions

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

Sessions register all LDAP authenticated connections that are allowed to perform operations.

func NewSessions

func NewSessions(ctx context.Context, ttl time.Duration) *Sessions

NewSessions returns a new AuthnConns instance.

func (*Sessions) Delete

func (sessions *Sessions) Delete(id int)

Delete removes the given connection ID from the list of authenticated connections.

func (Sessions) GC

func (sessions Sessions) GC()

GC removes all expired connections from the list of authenticated.

func (*Sessions) NewSession

func (sessions *Sessions) NewSession(id int, obj ldap.Object, opts ...SessionOption) error

NewSession adds the given LDAP object the list of authenticated connections.

func (*Sessions) Session

func (sessions *Sessions) Session(id int) *Session

Session returns the LDAP object if it is authenticated. Otherwise, if the connection ID doesn't exist or as expired, it returns nil. Furthermore, if the connection is expired, it is automatically removed from the connections list.

Jump to

Keyboard shortcuts

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