oauth2

package
v0.0.0-...-5365f31 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package oauth2 abstracts different OAuth2 providers.

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(clientID, clientSecret, redirectURL 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) Provider

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

Provider returns the given provider.

type Profile

type Profile struct {
	Key      string
	ID       string
	Username string
}

Profile is the OAuth2 user profile.

type Provider

type Provider interface {
	GetUserExtraKey() string
	GetRedirectURL(state string) string
	GetProfile(code string) (*Profile, error)
}

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