contextconfig

package
v0.21.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetTokenClaims added in v0.21.3

func GetTokenClaims(rawtoken string) (*claims, error)

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 pxc 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.

type Identity

type Identity struct {
	Subject string `json:"subject,omitempty" yaml:"subject,omitempty"`
	Name    string `json:"name,omitempty" yaml:"name,omitempty"`
	Email   string `json:"email,omitempty" yaml:"email,omitempty"`
}

Identity contains token unqiue ID information

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL