auth

package
v1.3.17 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2018 License: Apache-2.0 Imports: 9 Imported by: 51

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
	CurrentServer   string
}

func (*AuthConfig) DeleteServer

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

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

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

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

func (*AuthConfig) GetServerByName

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

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

func (*AuthConfig) GetServerNames

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

func (*AuthConfig) GetServerURLs

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

func (*AuthConfig) IndexOfServerName

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

func (*AuthConfig) PickOrCreateServer

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) (*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

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

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

func (*AuthServer) Description

func (s *AuthServer) Description() string

func (*AuthServer) GetUsernames

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

func (*AuthServer) Label

func (s *AuthServer) Label() string

type PrintUserFn

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 vairables

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