github.com/jenkins-x/jx/v2@v2.1.155/pkg/auth/types.go (about) 1 package auth 2 3 import ( 4 "github.com/jenkins-x/jx/v2/pkg/secreturl" 5 "github.com/jenkins-x/jx/v2/pkg/vault" 6 "k8s.io/client-go/kubernetes" 7 v1 "k8s.io/client-go/kubernetes/typed/core/v1" 8 ) 9 10 type AuthServer struct { 11 URL string `json:"url"` 12 Users []*UserAuth `json:"users"` 13 Name string `json:"name"` 14 Kind string `json:"kind"` 15 16 CurrentUser string `json:"currentuser"` 17 } 18 19 type UserAuth struct { 20 Username string `json:"username"` 21 ApiToken string `json:"apitoken"` 22 BearerToken string `json:"bearertoken"` 23 Password string `json:"password,omitempty"` 24 25 // GithubAppOwner if using GitHub Apps this represents the owner organisation/user which owns this token. 26 // we need to maintain a different token per owner 27 GithubAppOwner string `json:"appOwner,omitempty"` 28 } 29 30 type AuthConfig struct { 31 Servers []*AuthServer `json:"servers"` 32 33 DefaultUsername string `json:"defaultusername"` 34 CurrentServer string `json:"currentserver"` 35 PipeLineUsername string `json:"pipelineusername"` 36 PipeLineServer string `json:"pipelineserver"` 37 } 38 39 // AuthConfigService implements the generic features of the ConfigService because we don't have superclasses 40 type AuthConfigService struct { 41 config *AuthConfig 42 handler ConfigHandler 43 } 44 45 // FileAuthConfigHandler is a config handlerthat loads/saves the auth config from/to the local filesystem 46 type FileAuthConfigHandler struct { 47 fileName string 48 serverKind string 49 } 50 51 // VaultAuthConfigHandler is a config handler that loads/saves the auth configs from/to Vault 52 type VaultAuthConfigHandler struct { 53 vaultClient vault.Client 54 secretName string 55 } 56 57 // MemoryAuthConfigHandler loads/saves the auth config from/into memory 58 type MemoryAuthConfigHandler struct { 59 config AuthConfig 60 } 61 62 // ConfigMapVaultConfigHandler loads/save the config in a config map and the secrets in vault 63 type ConfigMapVaultConfigHandler struct { 64 secretName string 65 configMapClient v1.ConfigMapInterface 66 secretURLClient secreturl.Client 67 } 68 69 // KubeAuthConfigHandler loads/save the auth config from/into a kubernetes secret 70 type KubeAuthConfigHandler struct { 71 client kubernetes.Interface 72 namespace string 73 kind string 74 serviceKind string 75 }