oauth2

package
v1.0.46 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 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 Manager

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

Manager handles OAuth2 providers.

func NewManager

func NewManager(ctx context.Context, clientID, clientSecret, redirectURL, oidcDiscoveryEndpoint string) *Manager

NewManager returns a new Manager.

func (*Manager) AddProvider

func (m *Manager) AddProvider(name string, provider Provider)

AddProvider add a new OAuth2 provider.

func (*Manager) FindProvider

func (m *Manager) FindProvider(name string) (Provider, error)

FindProvider returns the given provider.

type Profile

type Profile struct {
	Key      string
	ID       string
	Username string
}

Profile is the OAuth2 user profile.

func (Profile) String

func (p Profile) String() string

type Provider

type Provider interface {
	GetUserExtraKey() string
	GetRedirectURL(state string) string
	GetProfile(ctx context.Context, code string) (*Profile, error)
	PopulateUserCreationWithProfileID(user *model.UserCreationRequest, profile *Profile)
	PopulateUserWithProfileID(user *model.User, profile *Profile)
	UnsetUserProfileID(user *model.User)
}

Provider is an interface for OAuth2 providers.

Jump to

Keyboard shortcuts

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