-
Notifications
You must be signed in to change notification settings - Fork 323
/
structs.go
71 lines (64 loc) · 2.3 KB
/
structs.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
59
60
61
62
63
64
65
66
67
68
69
70
71
package structs
// User is inherited.
type User struct {
Name string `json:"name"`
Email string `json:"email"`
CreatedOn int64 `json:"createdon"`
LastUpdate int64 `json:"lastupdate"`
ID int `json:"id",mapstructure:"id"`
// jwt.StandardClaims
}
// GoogleUser is a retrieved and authentiacted user from Google.
type GoogleUser struct {
User
Sub string `json:"sub"`
GivenName string `json:"given_name"`
FamilyName string `json:"family_name"`
Profile string `json:"profile"`
Picture string `json:"picture"`
EmailVerified bool `json:"email_verified"`
Gender string `json:"gender"`
HostDomain string `json:"hd"`
// jwt.StandardClaims
}
// GithubUser is a retrieved and authentiacted user from Github.
type GithubUser struct {
User
Picture string `json:"avatar_url"`
// jwt.StandardClaims
}
// GCredentials google credentials
// loaded from yaml config
type GCredentials struct {
ClientID string `mapstructure:"client_id"`
ClientSecret string `mapstructure:"client_secret"`
RedirectURLs []string `mapstructure:"callback_urls"`
PreferredDomain string `mapstructre:"preferredDomain"`
}
// GenericOauth provides endoint for access
type GenericOauth struct {
ClientID string `mapstructure:"client_id"`
ClientSecret string `mapstructure:"client_secret"`
AuthURL string `mapstructure:"auth_url"`
TokenURL string `mapstructure:"token_url"`
RedirectURL string `mapstructure:"callback_url "`
Scopes []string `mapstructure:"scopes"`
UserInfoURL string `mapstructure:"user_info_url"`
Provider string `mapstructure:"provider"`
}
// Team has members and provides acess to sites
type Team struct {
Name string `json:"name",mapstructure:"name"`
Members []string `json:"members",mapstructure:"members"` // just the emails
Sites []string `json:"sites",mapstructure:"sites"` // just the domains
CreatedOn int64 `json:"createdon",mapstructure:"createdon"`
LastUpdate int64 `json:"lastupdate",mapstructure:"lastupdate"`
ID int `json:"id",mapstructure:"id"`
}
// Site is the basic unit of auth
type Site struct {
Domain string `json:"domain"`
CreatedOn int64 `json:"createdon"`
LastUpdate int64 `json:"lastupdate"`
ID int `json:"id",mapstructure:"id"`
}