auth

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAuthError

func NewAuthError(message string, err error) error

NewAuthError creates a new authentication error

Types

type APIKeyAuth

type APIKeyAuth struct {
	APIKey string
}

APIKeyAuth implements API Key authentication (Opsgenie GenieKey)

func NewAPIKeyAuth

func NewAPIKeyAuth(apiKey string) (*APIKeyAuth, error)

NewAPIKeyAuth creates a new API key authentication provider

func (*APIKeyAuth) Apply

func (a *APIKeyAuth) Apply(req *http.Request) error

Apply adds GenieKey authentication header to the request

func (*APIKeyAuth) Mask

func (a *APIKeyAuth) Mask() string

Mask returns a masked version of credentials for logging

func (*APIKeyAuth) Type

func (a *APIKeyAuth) Type() string

Type returns the authentication type

type AuthError

type AuthError struct {
	Message string
	Err     error
}

Common error types

func (*AuthError) Error

func (e *AuthError) Error() string

func (*AuthError) Unwrap

func (e *AuthError) Unwrap() error

type BasicAuth

type BasicAuth struct {
	Username string
	APIToken string
}

BasicAuth implements Basic Authentication (username + API token)

func NewBasicAuth

func NewBasicAuth(username, apiToken string) (*BasicAuth, error)

NewBasicAuth creates a new basic authentication provider

func (*BasicAuth) Apply

func (b *BasicAuth) Apply(req *http.Request) error

Apply adds Basic Authentication header to the request

func (*BasicAuth) Mask

func (b *BasicAuth) Mask() string

Mask returns a masked version of credentials for logging

func (*BasicAuth) Type

func (b *BasicAuth) Type() string

Type returns the authentication type

type OAuthAuth

type OAuthAuth struct {
	AccessToken string
	CloudID     string
}

OAuthAuth implements OAuth 2.0 Bearer token authentication This is a BYO (Bring Your Own) token implementation - users must provide their own access tokens

func NewOAuthAuth

func NewOAuthAuth(accessToken, cloudID string) (*OAuthAuth, error)

NewOAuthAuth creates a new OAuth authentication provider with a pre-existing access token Users must obtain the access token through their own OAuth flow or from Atlassian admin

func (*OAuthAuth) Apply

func (o *OAuthAuth) Apply(req *http.Request) error

Apply adds OAuth Bearer token header to the request

func (*OAuthAuth) Mask

func (o *OAuthAuth) Mask() string

Mask returns a masked version of credentials for logging

func (*OAuthAuth) Type

func (o *OAuthAuth) Type() string

Type returns the authentication type

type PATAuth

type PATAuth struct {
	Token string
}

PATAuth implements Personal Access Token authentication

func NewPATAuth

func NewPATAuth(token string) (*PATAuth, error)

NewPATAuth creates a new PAT authentication provider

func (*PATAuth) Apply

func (p *PATAuth) Apply(req *http.Request) error

Apply adds Bearer token header to the request

func (*PATAuth) Mask

func (p *PATAuth) Mask() string

Mask returns a masked version of credentials for logging

func (*PATAuth) Type

func (p *PATAuth) Type() string

Type returns the authentication type

type Provider

type Provider interface {
	// Apply adds authentication to an HTTP request
	Apply(req *http.Request) error

	// Type returns the authentication type
	Type() string

	// Mask returns a masked version of credentials for logging
	Mask() string
}

Provider is the interface for authentication providers

Jump to

Keyboard shortcuts

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