auth

package
v1.0.111 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2018 License: Apache-2.0 Imports: 7 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
	CurrentServer   string
}

func (*AuthConfig) EditUserAuth

func (config *AuthConfig) EditUserAuth(serverLabel string, auth *UserAuth, defaultUserName string, editUser, batchMode bool) 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

func (*AuthConfig) GetServerByName added in v1.0.40

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

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) PickServer

func (c *AuthConfig) PickServer(message string) (*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) 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 loads the configuration from the users JX config directory

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