-
Notifications
You must be signed in to change notification settings - Fork 2
/
options.go
38 lines (32 loc) · 818 Bytes
/
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
package databaseauth
type option func(*Module)
func (m *Module) Configure(opts ...option) {
for _, opt := range opts {
opt(m)
}
}
// WithUserStore sets the backing user store. Required.
func WithUserStore(u UserStore) option {
return func(m *Module) {
m.userStore = u
}
}
// WithRedirectPath sets the path to redirect to after login.
// If set to blank, successful logins will not result in a redirect.
func WithRedirectPath(path string) option {
return func(m *Module) {
m.postAuthRedirectPath = path
}
}
// WithLoginPath sets the path to listen for login requests. Optional.
func WithLoginPath(path string) option {
return func(m *Module) {
m.loginPath = path
}
}
// WithoutLoginPath disables the login handler
func WithoutLoginPath() option {
return func(m *Module) {
m.loginPath = ""
}
}