oauth2

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package oauth2 contains the domain concept definitions needed to support SuperMQ ui service OAuth2 functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ClientID     string `env:"CLIENT_ID"       envDefault:""`
	ClientSecret string `env:"CLIENT_SECRET"   envDefault:""`
	State        string `env:"STATE"           envDefault:""`
	RedirectURL  string `env:"REDIRECT_URL"    envDefault:""`
}

Config is the configuration for the OAuth2 provider.

type Provider

type Provider interface {
	// Name returns the name of the OAuth2 provider.
	Name() string

	// State returns the current state for the OAuth2 flow.
	State() string

	// RedirectURL returns the URL to redirect the user to after completing the OAuth2 flow.
	RedirectURL() string

	// ErrorURL returns the URL to redirect the user to in case of an error during the OAuth2 flow.
	ErrorURL() string

	// IsEnabled checks if the OAuth2 provider is enabled.
	IsEnabled() bool

	// Exchange converts an authorization code into a token.
	Exchange(ctx context.Context, code string) (oauth2.Token, error)

	// UserInfo retrieves the user's information using the access token.
	UserInfo(accessToken string) (users.User, error)
}

Provider is an interface that provides the OAuth2 flow for a specific provider (e.g. Google, GitHub, etc.)

Directories

Path Synopsis
Package google contains the domain concept definitions needed to support SuperMQ services for Google OAuth2 functionality.
Package google contains the domain concept definitions needed to support SuperMQ services for Google OAuth2 functionality.

Jump to

Keyboard shortcuts

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