oauth

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2018 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//FacebookProvider is const for 'facebook'
	FacebookProvider = "facebook"
	//GoogleProvider is const for 'google'
	GoogleProvider = "google"
	//GitHubProvider is const for 'github'
	GitHubProvider = "github"
)

Variables

This section is empty.

Functions

func IsProviderEnabled

func IsProviderEnabled(name string) bool

IsProviderEnabled returns true if provider is enabled

Types

type HTTPService

type HTTPService struct{}

HTTPService implements real OAuth operations using Golang's oauth2 package

func (*HTTPService) GetAuthURL

func (p *HTTPService) GetAuthURL(authEndpoint string, provider string, redirect string) string

GetAuthURL returns authentication url for given provider

func (*HTTPService) GetProfile

func (p *HTTPService) GetProfile(authEndpoint string, provider string, code string) (*UserProfile, error)

GetProfile returns user profile based on provider and code

type Service

type Service interface {
	GetAuthURL(authEndpoint string, provider string, redirect string) string
	GetProfile(authEndpoint string, provider string, code string) (*UserProfile, error)
}

Service provides OAuth operations

type UserProfile

type UserProfile struct {
	ID    json.Number
	Name  string
	Login string
	Email string
}

UserProfile represents an OAuth user profile

Jump to

Keyboard shortcuts

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