forked from rancher/types
-
Notifications
You must be signed in to change notification settings - Fork 0
/
authn_types.go
132 lines (109 loc) · 4.84 KB
/
authn_types.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
package v3
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type Token struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Token string `json:"token" norman:"writeOnly,noupdate"`
UserPrincipal Principal `json:"userPrincipal" norman:"type=reference[Principal]"`
GroupPrincipals []Principal `json:"groupPrincipals" norman:"type=array[reference[Principal]]"`
ProviderInfo map[string]string `json:"providerInfo,omitempty"`
UserID string `json:"userId" norman:"type=reference[User]"`
AuthProvider string `json:"authProvider"`
TTLMillis int `json:"ttl"`
LastUpdateTime string `json:"lastUpdateTime"`
IsDerived bool `json:"isDerived"`
Description string `json:"description"`
}
type User struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
DisplayName string `json:"displayName,omitempty"`
Description string `json:"description"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty" norman:"writeOnly,noupdate"`
MustChangePassword bool `json:"mustChangePassword,omitempty"`
PrincipalIDs []string `json:"principalIds,omitempty" norman:"type=array[reference[Principal]]"`
Me bool `json:"me,omitempty"`
}
type Group struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
DisplayName string `json:"displayName,omitempty"`
}
type GroupMember struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
GroupName string `json:"groupName,omitempty" norman:"type=reference[group]"`
PrincipalID string `json:"principalId,omitempty" norman:"type=reference[Principal]"`
}
type Principal struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
DisplayName string `json:"displayName,omitempty"`
LoginName string `json:"loginName,omitempty"`
ProfilePicture string `json:"profilePicture,omitempty"`
ProfileURL string `json:"profileURL,omitempty"`
Kind string `json:"kind,omitempty"`
Me bool `json:"me,omitempty"`
MemberOf bool `json:"memberOf,omitempty"`
ExtraInfo map[string]string `json:"extraInfo,omitempty"`
}
//LoginInput structure defines all properties that can be sent by client to create a token
type LoginInput struct {
TTLMillis int `json:"ttl,omitempty"`
Description string `json:"description,omitempty"`
ResponseType string `json:"responseType,omitempty"` //json or cookie
LocalCredential LocalCredential `json:"localCredential, omitempty"`
GithubCredential GithubCredential `json:"githubCredential, omitempty"`
}
//LocalCredential stores the local auth creds
type LocalCredential struct {
Username string `json:"username"`
Password string `json:"password"`
}
//GithubCredential stores the github auth creds
type GithubCredential struct {
Code string `json:"code"`
}
type ChangePasswordInput struct {
CurrentPassword string `json:"currentPassword" norman:"type=string,required"`
NewPassword string `json:"newPassword" norman:"type=string,required"`
}
type SetPasswordInput struct {
NewPassword string `json:"newPassword" norman:"type=string,required"`
}
//AuthConfig structure contains the AuthConfig definition
type AuthConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Type string `json:"type"`
}
//GithubConfig structure contains the github config definition
type GithubConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
AuthConfig `json:",inline"`
Hostname string `json:"hostname,omitempty"`
Scheme string `json:"scheme,omitempty"`
ClientID string `json:"clientId,omitempty"`
ClientSecret string `json:"clientSecret,omitempty"`
Enabled bool `json:"enabled,omitempty"`
}
//LocalConfig structure contains the local config definition
type LocalConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
}
//GithubConfigTestInput structure defines all properties that can be sent by client to configure github
type GithubConfigTestInput struct {
GithubConfig GithubConfig `json:"githubConfig, omitempty"`
Enabled bool `json:"enabled,omitempty"`
}
//GithubConfigApplyInput structure defines all properties that can be sent by client to configure github
type GithubConfigApplyInput struct {
GithubConfig GithubConfig `json:"githubConfig, omitempty"`
GithubCredential GithubCredential `json:"githubCredential, omitempty"`
Enabled bool `json:"enabled,omitempty"`
}