-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoptions.go
57 lines (46 loc) · 1.63 KB
/
options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package ldap4gin
import (
"crypto/tls"
"time"
)
// Options depicts parameters used to instantiate Authenticator
type Options struct {
// Debug outputs debugging information, better leave it to false
Debug bool
// TTL depicts how long user profile is cached in session, when it expires, it is reloaded from ldap
TTL time.Duration
/*
Define how we connect to LDAP
*/
//ConnectionString depicts how we dial LDAP server, something like ldap://127.0.0.1:389 or ldaps://ldap.example.org:636
ConnectionString string
// TLS is configuration for encryption to use
TLS *tls.Config
// StartTLS shows, do we need to execute StartTLS or not
StartTLS bool
/*
Define how we authorize as readonly user
against LDAP
*/
// ReadonlyDN is distinguished name used for authorization as readonly user,
// who has access to listing groups of user. For example, "cn=readonly,dc=vodolaz095,dc=ru"
ReadonlyDN string
// ReadonlyPasswd is password for readonly user, who has access to listing groups
ReadonlyPasswd string
/*
Used for extracting users
*/
// UserBaseTpl is template to extract user profiles by UID, for example
// "uid=%s,ou=people,dc=vodolaz095,dc=ru" or
// "email=%s,ou=people,dc=vodolaz095,dc=ru"
UserBaseTpl string
// ExtraFields is array of fields, we also extract from database.
// NOTICE - if you add too many fields, it can hit session size limits!
ExtraFields []string
// ExtractGroups toggles extracting groups of user
ExtractGroups bool
// GroupsOU depicts organization unit for groups, usually "ou=groups,dc=vodolaz095,dc=ru"
GroupsOU string
// LogDebugFunc is called to log debug events
LogDebugFunc LogDebugFunc
}