oauth

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

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

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 MockOAuthService

type MockOAuthService struct{}

MockOAuthService implements a mocked OAuthService

func (*MockOAuthService) GetAuthURL

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

GetAuthURL returns authentication url for given provider

func (*MockOAuthService) GetProfile

func (p *MockOAuthService) 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    string
	Name  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