authinfo

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAuthInfoInvalidXML = errors.New("invalid XML")
)

Functions

This section is empty.

Types

type AuthInfo

type AuthInfo interface {

	// CreateGitlabClient returns a new Gitlab Client based on the
	// authentication information provided by the user.  The options
	// parameter is the same "options" parameter that is passed into
	// the gitlab.New*Client() methods which can be used to tailor the
	// client for the user's purpose.
	CreateGitlabClient(options ...gitlab.ClientOptionFunc) (*gitlab.Client, error)
}

Interface implemented by types that return information used for authentication.

func Load

func Load(fname string) (AuthInfo, error)

LoadAuthInfo loads the authentication information from the file returning the correct type of AuthInfo concrete type.

type BasicAuthInfo

type BasicAuthInfo struct {
	Username string `xml:"username"`
	Password string `xml:"password"`
}

BasicAuthInfo holds username and password used for HTTP basic authentication.

func NewBasicAuthInfo

func NewBasicAuthInfo(username, password string) BasicAuthInfo

NewBasicAuthInfo creates a new set of authentication information for HTTP basic authentication.

func NewBasicAuthInfoFromXML

func NewBasicAuthInfoFromXML(r io.Reader) (BasicAuthInfo, error)

NewBasicAuthInfoFromXML creates a new set of authentication information for HTTP basic authentication from the XML accessible through the io.Reader. The format of the XML is as follows:

<AuthInfo>
    <username></username>
    <password></password>
</AuthInfo>

func (*BasicAuthInfo) CreateGitlabClient

func (authInfo *BasicAuthInfo) CreateGitlabClient(options ...gitlab.ClientOptionFunc) (*gitlab.Client, error)

CreateGitlabClient returns a new Gitlab Client that uses HTTP basic authentication. The options parameter is the same "options" parameter that is passed into the gitlab.New*Client() methods which can be used to tailor the client for the user's purpose.

type OAuthToken

type OAuthToken struct {
	Token string `xml:"oauth-token"`
}

OAuthToken holds an OAuth access token.

func NewOAuthToken

func NewOAuthToken(token string) OAuthToken

NewOAuthToken creates a new set of authentication information for OAuth authentication.

func NewOAuthTokenFromXML

func NewOAuthTokenFromXML(r io.Reader) (OAuthToken, error)

NewOAuthTokenFromXML creates a new set of authentication information for OAuth authentication from the XML accessible through the io.Reader. The format of the XML is as follows:

<AuthInfo>
    <oauth-token></oauth-token>
</AuthInfo>

func (*OAuthToken) CreateGitlabClient

func (token *OAuthToken) CreateGitlabClient(options ...gitlab.ClientOptionFunc) (*gitlab.Client, error)

CreateGitlabClient returns a new Gitlab Client that uses OAuth authentication. The options parameter is the same "options" parameter that is passed into the gitlab.New*Client() methods which can be used to tailor the client for the user's purpose.

type PrivateToken

type PrivateToken struct {
	Token string `xml:"private-token"`
}

PrivateToken holds a private or personal access token.

func NewPrivateToken

func NewPrivateToken(token string) PrivateToken

NewPrivateToken creates a new set of authentication information for private token or personal token authentication.

func NewPrivateTokenFromXML

func NewPrivateTokenFromXML(r io.Reader) (PrivateToken, error)

NewPrivateTokenFromXML creates a new set of authentication information for private token or personal token authentication from the XML accessible through the io.Reader. The format of the XML is as follows:

<AuthInfo>
    <private-token></private-token>
<AuthInfo>

func (*PrivateToken) CreateGitlabClient

func (token *PrivateToken) CreateGitlabClient(options ...gitlab.ClientOptionFunc) (*gitlab.Client, error)

CreateGitlabClient returns a new Gitlab Client that uses private token or personal token authentication. The options parameter is the same "options" parameter that is passed into the gitlab.New*Client() methods which can be used to tailor the client for the user's purpose.

Jump to

Keyboard shortcuts

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