oauth

package
v3.0.0-...-e9d5d1c Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeHTTPHandler

func MakeHTTPHandler(service Service, responseCode *int) *http.ServeMux

func NewClient

func NewClient(httpClient *http.Client) client

func NewOAuthConfig

func NewOAuthConfig(clientID string, clientSecret string, scopes []string, endpoint oauth2.Endpoint) *oauth2.Config

func NewRepository

func NewRepository(db *sqlx.DB, oauthConfig *oauth2.Config) repository

func NewService

func NewService(oauthConfig *oauth2.Config, connectBaseURL string, repo Repository) service

Types

type Repository

type Repository interface {
	GetOauthToken() (Token, error)
	UpsertOauthToken(token *oauth2.Token, clientID string) error
}

type Service

type Service interface {
	AuthCodeURL(csrfToken string) string
	AuthorizeCallback(csrfToken, code string) error
}

type Token

type Token struct {
	ClientID     string    `db:"client_id"`
	AccessToken  string    `db:"access_token"`
	RefreshToken string    `db:"refresh_token"`
	Scope        string    `db:"scope"`
	TokenType    string    `db:"token_type"`
	ExpiresAt    time.Time `db:"_"`
	ExpiresAtRaw string    `db:"expires_at"`
}

func (Token) Token

func (o Token) Token() *oauth2.Token

Jump to

Keyboard shortcuts

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