auth

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider interface {
	GetToken(context.Context) (*Response, error)
}

Provider defines an auth provider

type ProviderModifierFn

type ProviderModifierFn func(*UpboundRegistry)

ProviderModifierFn modifies the provider.

func WithBasicAuth

func WithBasicAuth(username, password string) ProviderModifierFn

WithBasicAuth sets the username and password for the auth provider.

func WithEndpoint

func WithEndpoint(endpoint *url.URL) ProviderModifierFn

WithEndpoint sets endpoint for the auth provider.

func WithOrgID

func WithOrgID(orgID string) ProviderModifierFn

WithOrgID sets orgID for the auth provider.

func WithProductID

func WithProductID(productID string) ProviderModifierFn

WithProductID sets productID for the auth provider.

type Response

type Response struct {
	AccessToken string `json:"access_token"`
	Scope       string `json:"scope"`
	ExpiresIn   int    `json:"expires_in"`
	IssuedAt    string `json:"issued_at"`
}

Response is the response that we get from a successful authentication request

type UpboundRegistry

type UpboundRegistry struct {
	// contains filtered or unexported fields
}

UpboundRegistry provides authentication using the Upbound Registry

func NewProvider

func NewProvider(modifiers ...ProviderModifierFn) *UpboundRegistry

NewProvider constructs a new upboundRegistry provider

func (*UpboundRegistry) GetToken

func (u *UpboundRegistry) GetToken(ctx context.Context) (*Response, error)

GetToken returns a JWT corresponding to the supplied username/password

Jump to

Keyboard shortcuts

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