1
0
mirror of https://github.com/rancher/types.git synced 2025-07-31 20:55:00 +00:00

add fields for kubeconfig saml tokens

This commit is contained in:
kinarashah 2020-07-16 13:03:01 -07:00
parent ae84b42a47
commit cf6aad45fb
5 changed files with 27 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package v3
import (
"github.com/rancher/norman/condition"
"github.com/rancher/norman/types"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
@ -143,6 +144,15 @@ type AuthConfig struct {
AllowedPrincipalIDs []string `json:"allowedPrincipalIds,omitempty" norman:"type=array[reference[principal]]"`
}
type SamlToken struct {
types.Namespaced
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Token string `json:"token" norman:"writeOnly,noupdate"`
ExpiresAt string `json:"expiresAt"`
}
type LocalConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

View File

@ -434,6 +434,7 @@ func authnTypes(schemas *types.Schemas) *types.Schemas {
AddMapperForType(&Version, v3.Group{}, m.DisplayName{}).
MustImport(&Version, v3.Group{}).
MustImport(&Version, v3.GroupMember{}).
MustImport(&Version, v3.SamlToken{}).
AddMapperForType(&Version, v3.Principal{}, m.DisplayName{}).
MustImportAndCustomize(&Version, v3.Principal{}, func(schema *types.Schema) {
schema.CollectionMethods = []string{http.MethodGet}

View File

@ -11,6 +11,14 @@ type AuthProvider struct {
Type string `json:"type"`
}
type AuthToken struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Token string `json:"token"`
ExpiresAt string `json:"expiresAt"`
}
type GenericLogin struct {
TTLMillis int64 `json:"ttl,omitempty"`
Description string `json:"description,omitempty" norman:"type=string,required"`
@ -118,6 +126,9 @@ type OKTAProvider struct {
type SamlLoginInput struct {
FinalRedirectURL string `json:"finalRedirectUrl"`
RequestID string `json:"requestId"`
PublicKey string `json:"publicKey"`
ResponseType string `json:"responseType"`
}
type SamlLoginOutput struct {

View File

@ -27,6 +27,10 @@ func authProvidersTypes(schemas *types.Schemas) *types.Schemas {
schema.CollectionMethods = []string{}
schema.ResourceMethods = []string{}
}).
MustImportAndCustomize(&PublicVersion, v3public.AuthToken{}, func(schema *types.Schema) {
schema.CollectionMethods = []string{http.MethodGet, http.MethodDelete}
schema.ResourceMethods = []string{http.MethodGet, http.MethodDelete}
}).
MustImportAndCustomize(&PublicVersion, v3public.AuthProvider{}, func(schema *types.Schema) {
schema.CollectionMethods = []string{http.MethodGet}
}).

View File

@ -16,4 +16,5 @@ type Manager interface {
SetPrincipalOnCurrentUserByUserID(userID string, principal v3.Principal) (*v3.User, error)
CreateNewUserClusterRoleBinding(userName string, userUID apitypes.UID) error
GetUserByPrincipalID(principalName string) (*v3.User, error)
GetKubeconfigToken(clusterName, tokenName, description, kind, userName string) (*v3.Token, error)
}