-
Notifications
You must be signed in to change notification settings - Fork 284
/
models.go
59 lines (51 loc) · 2.12 KB
/
models.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
package jwx
import jwt "github.com/dgrijalva/jwt-go"
// DecodedAccessTokenHeader is the decoded header from the access token
type DecodedAccessTokenHeader struct {
Alg string `json:"alg"`
Typ string `json:"typ"`
Kid string `json:"kid"`
}
// Claims served by keycloak inside the accessToken
type Claims struct {
jwt.StandardClaims
Typ string `json:"typ,omitempty"`
Azp string `json:"azp,omitempty"`
AuthTime int `json:"auth_time,omitempty"`
SessionState string `json:"session_state,omitempty"`
Acr string `json:"acr,omitempty"`
AllowedOrigins []string `json:"allowed-origins,omitempty"`
RealmAccess RealmAccess `json:"realm_access,omitempty"`
ResourceAccess ResourceAccess `json:"resource_access,omitempty"`
Scope string `json:"scope,omitempty"`
EmailVerified bool `json:"email_verified,omitempty"`
Address Address `json:"address,omitempty"`
Name string `json:"name,omitempty"`
PreferredUsername string `json:"preferred_username,omitempty"`
GivenName string `json:"given_name,omitempty"`
FamilyName string `json:"family_name,omitempty"`
Email string `json:"email,omitempty"`
ClientID string `json:"clientId,omitempty"`
ClientHost string `json:"clientHost,omitempty"`
ClientIP string `json:"clientAddress,omitempty"`
}
// Address TODO what fields does any address have?
type Address struct {
}
// RealmAccess holds roles of the user
type RealmAccess struct {
Roles []string `json:"roles,omitempty"`
}
// ResourceAccess holds TODO: What does it hold?
type ResourceAccess struct {
RealmManagement RealmManagement `json:"realm-management,omitempty"`
Account Account `json:"account,omitempty"`
}
// RealmManagement holds TODO: What does it hold?
type RealmManagement struct {
Roles []string `json:"roles,omitempty"`
}
// Account holds TODO: What does it hold?
type Account struct {
Roles []string `json:"roles,omitempty"`
}