-
Notifications
You must be signed in to change notification settings - Fork 52
/
module.go
53 lines (45 loc) · 1.03 KB
/
module.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
package fake
import (
"flamingo.me/dingo"
"flamingo.me/flamingo/v3/core/auth"
"flamingo.me/flamingo/v3/framework/config"
)
// Module provides Fake Auth support
type Module struct{}
// Interface compliance compile type checks
var (
_ dingo.Module = (*Module)(nil)
_ dingo.Depender = (*Module)(nil)
_ config.CueConfigModule = (*Module)(nil)
)
// Configure dependency injection
func (*Module) Configure(injector *dingo.Injector) {
injector.BindMap(new(auth.RequestIdentifierFactory), "fake").ToInstance(identityProviderFactory)
}
// CueConfig schema
func (*Module) CueConfig() string {
return `
core: auth: {
fake :: {
UserConfig :: {
password?: string
}
typ: "fake"
broker: string
loginTemplate?: string
userConfig: {
[string]: UserConfig
}
validatePassword: bool | *true
usernameFieldId: string | *"username"
passwordFieldId: string | *"password"
}
}
`
}
// Depends marks dependency to auth.WebModule
func (*Module) Depends() []dingo.Module {
return []dingo.Module{
new(auth.WebModule),
}
}