-
Notifications
You must be signed in to change notification settings - Fork 12
/
auth.go
58 lines (49 loc) · 1.26 KB
/
auth.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
58
package config
// AuthConfig ...
type AuthConfig struct {
Key string `yaml:"key"`
Basic BasicAuthConfig `yaml:"basic"`
Github GithubAuthConfig `yaml:"github"`
Google GoogleAuthConfig `yaml:"google"`
AdminName string
AdminEmails []string
}
// DefaultAuthConfig ...
func DefaultAuthConfig() AuthConfig {
return AuthConfig{
Basic: DefaultBasicBasicAuthConfig(),
Github: DefaultGithubAuthConfig(),
Google: DefaultGoogleAuthConfig(),
}
}
// BasicAuthConfig ...
type BasicAuthConfig struct {
Username string `yaml:"username"`
Password string `yaml:"password"`
}
// DefaultBasicBasicAuthConfig ...
func DefaultBasicBasicAuthConfig() BasicAuthConfig {
return BasicAuthConfig{
Username: `taoblog`,
Password: `taoblog`,
}
}
// GithubAuthConfig ...
type GithubAuthConfig struct {
ClientID string `yaml:"client_id"`
ClientSecret string `yaml:"client_secret"`
UserID int64 `yaml:"user_id"`
}
// DefaultGithubAuthConfig ...
func DefaultGithubAuthConfig() GithubAuthConfig {
return GithubAuthConfig{}
}
// GoogleAuthConfig ...
type GoogleAuthConfig struct {
ClientID string `yaml:"client_id"`
UserID string `yaml:"user_id"`
}
// DefaultGoogleAuthConfig ...
func DefaultGoogleAuthConfig() GoogleAuthConfig {
return GoogleAuthConfig{}
}