auth

package
v0.34.2 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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