auth

package
v1.3.286 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultWritePermissions = 0760
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	Servers []*AuthServer

	DefaultUsername  string
	PipeLineUsername string
	CurrentServer    string
	PipeLineServer   string
}

func (*AuthConfig) DeleteServer added in v1.2.105

func (c *AuthConfig) DeleteServer(url string)

DeleteServer deletes the server for the given URL and updates the current server if is the same with the deleted server

func (*AuthConfig) EditUserAuth

func (config *AuthConfig) EditUserAuth(serverLabel string, auth *UserAuth, defaultUserName string, editUser, batchMode bool, fn PrintUserFn) error

EditUserAuth Lets the user input/edit the user auth

func (*AuthConfig) FindUserAuth

func (c *AuthConfig) FindUserAuth(serverURL string, username string) *UserAuth

FindUserAuth finds the auth for the given user name if no username is specified and there is only one auth then return that else nil

func (*AuthConfig) FindUserAuths

func (c *AuthConfig) FindUserAuths(serverURL string) []*UserAuth

func (*AuthConfig) GetOrCreateServer

func (c *AuthConfig) GetOrCreateServer(url string) *AuthServer

func (*AuthConfig) GetOrCreateServerName added in v1.0.16

func (c *AuthConfig) GetOrCreateServerName(url string, name string, kind string) *AuthServer

func (*AuthConfig) GetOrCreateUserAuth

func (c *AuthConfig) GetOrCreateUserAuth(url string, username string) *UserAuth

func (*AuthConfig) GetServer

func (c *AuthConfig) GetServer(url string) *AuthServer

GetServerByName returns the server for the given URL or null if its not found

func (*AuthConfig) GetServerByKind added in v1.1.69

func (c *AuthConfig) GetServerByKind(kind string) *AuthServer

GetServerByKind returns the server for the given kind or null if its not found

func (*AuthConfig) GetServerByName added in v1.0.40

func (c *AuthConfig) GetServerByName(name string) *AuthServer

GetServerByName returns the server for the given name or null if its not found

func (*AuthConfig) GetServerNames added in v1.0.39

func (config *AuthConfig) GetServerNames() []string

func (*AuthConfig) GetServerURLs added in v1.0.40

func (config *AuthConfig) GetServerURLs() []string

func (*AuthConfig) IndexOfServerName added in v1.0.39

func (config *AuthConfig) IndexOfServerName(name string) int

func (*AuthConfig) PickOrCreateServer added in v1.1.15

func (config *AuthConfig) PickOrCreateServer(defaultServerURL string, message string, batchMode bool) (*AuthServer, error)

PickOrCreateServer picks the server to use defaulting to the current server

func (*AuthConfig) PickServer

func (c *AuthConfig) PickServer(message string, batchMode bool) (*AuthServer, error)

func (*AuthConfig) PickServerUserAuth

func (c *AuthConfig) PickServerUserAuth(server *AuthServer, message string, batchMode bool, org string) (*UserAuth, error)

func (*AuthConfig) SetUserAuth

func (c *AuthConfig) SetUserAuth(url string, auth *UserAuth)

type AuthConfigService

type AuthConfigService struct {
	FileName string
	// contains filtered or unexported fields
}

AuthConfigService is a service for handing the config of auth tokens

func (*AuthConfigService) Config

func (s *AuthConfigService) Config() *AuthConfig

func (*AuthConfigService) DeleteServer added in v1.2.105

func (s *AuthConfigService) DeleteServer(url string) error

DeleteServer removes the given server from the configuration

func (*AuthConfigService) HasConfigFile added in v1.0.129

func (s *AuthConfigService) HasConfigFile() (bool, error)

HasConfigFile returns true if we have a config file

func (*AuthConfigService) LoadConfig

func (s *AuthConfigService) LoadConfig() (*AuthConfig, error)

LoadConfig loads the configuration from the users JX config directory

func (*AuthConfigService) SaveConfig

func (s *AuthConfigService) SaveConfig() error

SaveConfig saves the configuration to disk

func (*AuthConfigService) SaveUserAuth

func (s *AuthConfigService) SaveUserAuth(url string, userAuth *UserAuth) error

SaveUserAuth saves the given user auth for the server url

func (*AuthConfigService) SetConfig

func (s *AuthConfigService) SetConfig(c *AuthConfig)

type AuthServer

type AuthServer struct {
	URL   string
	Users []*UserAuth
	Name  string
	Kind  string

	CurrentUser string
}

func (*AuthServer) DeleteUser added in v1.0.40

func (s *AuthServer) DeleteUser(username string) error

func (*AuthServer) Description

func (s *AuthServer) Description() string

func (*AuthServer) GetUsernames added in v1.0.40

func (s *AuthServer) GetUsernames() []string

func (*AuthServer) Label

func (s *AuthServer) Label() string

type PrintUserFn added in v1.1.48

type PrintUserFn func(username string) error

type UserAuth

type UserAuth struct {
	Username    string
	ApiToken    string
	BearerToken string
	Password    string `yaml:"password,omitempty"`
}

func CreateAuthUserFromEnvironment

func CreateAuthUserFromEnvironment(prefix string) UserAuth

CreateAuthUserFromEnvironment creates a user auth from environment variables

func (*UserAuth) IsInvalid

func (a *UserAuth) IsInvalid() bool

IsInvalid returns true if the user auth has a valid token

Jump to

Keyboard shortcuts

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