Documentation
¶
Overview ¶
Copyright © 2019 Portworx
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func GetTokenClaims(rawtoken string) (*claims, error)
- type ClientContext
- type ClientTLSInfo
- type ContextConfig
- type ContextManager
- func (cm *ContextManager) Add(clientContext *ClientContext) error
- func (cm *ContextManager) GetAll() *ContextConfig
- func (cm *ContextManager) GetContext(contextName string) (*ClientContext, error)
- func (cm *ContextManager) GetCurrent() (*ClientContext, error)
- func (cm *ContextManager) GetNamedContext(name string) (*ClientContext, error)
- func (cm *ContextManager) Remove(nameToDelete string) error
- func (cm *ContextManager) SetCurrent(name string) error
- func (cm *ContextManager) UpdateCurrentContext(contextName string) error
- type Identity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTokenClaims ¶ added in v0.21.3
GetTokenClaims returns the claims for the raw JWT token.
Types ¶
type ClientContext ¶
type ClientContext struct { Name string `json:"context" yaml:"context"` Token string `json:"token" yaml:"token"` Identity Identity `json:"identity,omitempty" yaml:"identity,omitempty"` Error string `json:"error,omitempty" yaml:"error,omitempty"` TlsData ClientTLSInfo `json:"tlsdata,omitempty" yaml:"tlsdata,omitempty"` Endpoint string `json:"endpoint" yaml:"endpoint"` Secure bool `json:"secure" yaml:"secure"` Kubeconfig string `json:"kubeconfig" yaml:"kubeconfig"` }
ClientContext provides information about the client context
func AddTokenValidity ¶ added in v0.21.3
func AddTokenValidity(clientContext ClientContext) ClientContext
AddTokenValidity checks and marks if a token is invalid.
type ClientTLSInfo ¶
type ClientTLSInfo struct {
Cacert string `json:"cacert" yaml:"cacert"`
}
ClientTLSInfo provide client TLS configuration information
type ContextConfig ¶
type ContextConfig struct { Current string `json:"current" yaml:"current"` Configurations []ClientContext `json:"configurations" yaml:"configurations"` }
ContextConfig provides information about the px context information
func AddClaimsInfo ¶ added in v0.21.3
func AddClaimsInfo(contextCfg *ContextConfig) *ContextConfig
AddClaimsInfo adds additional claims information to a contextconfig
func MarkInvalidTokens ¶ added in v0.21.3
func MarkInvalidTokens(contextCfg *ContextConfig) *ContextConfig
MarkInvalidTokens will mark all invalid tokens for a given context config.
type ContextManager ¶ added in v0.21.3
type ContextManager struct {
// contains filtered or unexported fields
}
ContextManager is a reference to a ContextConfig and the path associated with it
func New ¶ added in v0.21.3
func New(configFile string) *ContextManager
New returns an empty, unloaded context manager
func NewContextManager ¶ added in v0.21.3
func NewContextManager(configFile string) (*ContextManager, error)
GetContextManager loads an in memory reference of the Context Configuration file from disk. This reference is the primary object to use when managing the user's context configuration.
func (*ContextManager) Add ¶ added in v0.21.3
func (cm *ContextManager) Add(clientContext *ClientContext) error
Add inserts a given clientContext into cm.cfg.Configurations, and saves the context.
func (*ContextManager) GetAll ¶ added in v0.21.3
func (cm *ContextManager) GetAll() *ContextConfig
GetAll simply returns all configurations
func (*ContextManager) GetContext ¶ added in v0.21.3
func (cm *ContextManager) GetContext(contextName string) (*ClientContext, error)
GetContext loads the context by name (if provided), or the current context set.
func (*ContextManager) GetCurrent ¶ added in v0.21.3
func (cm *ContextManager) GetCurrent() (*ClientContext, error)
func (*ContextManager) GetNamedContext ¶ added in v0.21.3
func (cm *ContextManager) GetNamedContext(name string) (*ClientContext, error)
func (*ContextManager) Remove ¶ added in v0.21.3
func (cm *ContextManager) Remove(nameToDelete string) error
Remove deletes a context from the configurations list
func (*ContextManager) SetCurrent ¶ added in v0.21.3
func (cm *ContextManager) SetCurrent(name string) error
func (*ContextManager) UpdateCurrentContext ¶ added in v0.21.3
func (cm *ContextManager) UpdateCurrentContext(contextName string) error
UpdateCurrentContext loads the context file and sets a new currentcontext name.