Help us shape the future of Go! Take the 2026 Go Developer Survey

credentials

package
v0.55.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: Apache-2.0 Imports: 2 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CredentialsProvider

type CredentialsProvider interface {
	// SetHeaders sets the necessary headers on the request.
	SetHeaders(r *http.Request) error
}

CredentialsProvider is an interface for providing credentials to the client. Implementations of this interface should set the necessary headers on the request.

func NewCredentialsProvider

func NewCredentialsProvider(visitor func(r *http.Request) error) CredentialsProvider

type OAuthCredentialsProvider

type OAuthCredentialsProvider interface {
	CredentialsProvider
	// Token returns the OAuth token generated by the provider.
	Token() (*oauth2.Token, error)
}

OAuthCredentialsProvider is a specialized CredentialsProvider uses and provides an OAuth token.

func NewOAuthCredentialsProvider

func NewOAuthCredentialsProvider(visitor func(r *http.Request) error, tokenProvider func() (*oauth2.Token, error)) OAuthCredentialsProvider

type OAuthToken

type OAuthToken struct {
	// The access token issued by the authorization server. This is the token that will be used to authenticate requests.
	AccessToken string `json:"access_token"  auth:",sensitive"`
	// Time in seconds until the token expires.
	ExpiresIn int `json:"expires_in"`
	// The scope of the token. This is a space-separated list of strings that represent the permissions granted by the token.
	Scope string `json:"scope"`
	// The type of token that was issued.
	TokenType string `json:"token_type"`
}

OAuthToken represents an OAuth token as defined by the OAuth 2.0 Authorization Framework. https://datatracker.ietf.org/doc/html/rfc6749

Jump to

Keyboard shortcuts

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