1
0
mirror of https://github.com/rancher/types.git synced 2025-09-18 16:10:58 +00:00

Introduce a public (unauthenticated) schema

This commit is contained in:
Craig Jellick
2018-02-01 20:19:28 -07:00
committed by Darren Shepherd
parent 4b5ae49dd4
commit 5cc3e0bed2
5 changed files with 104 additions and 31 deletions

View File

@@ -62,26 +62,6 @@ type Principal struct {
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"`
@@ -126,7 +106,7 @@ type GithubConfigTestInput struct {
//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"`
GithubConfig GithubConfig `json:"githubConfig, omitempty"`
Code string `json:"code,omitempty"`
Enabled bool `json:"enabled,omitempty"`
}

View File

@@ -36,7 +36,7 @@ var (
Init(globalTypes).
Init(rkeTypes)
TokenSchema = factory.Schemas(&Version).
TokenSchemas = factory.Schemas(&Version).
Init(tokens)
)
@@ -149,15 +149,8 @@ func machineTypes(schemas *types.Schemas) *types.Schemas {
func tokens(schemas *types.Schemas) *types.Schemas {
return schemas.
MustImport(&Version, v3.LoginInput{}).
MustImport(&Version, v3.LocalCredential{}).
MustImport(&Version, v3.GithubCredential{}).
MustImportAndCustomize(&Version, v3.Token{}, func(schema *types.Schema) {
schema.CollectionActions = map[string]types.Action{
"login": {
Input: "loginInput",
Output: "token",
},
"logout": {},
}
})