oauth

package
v0.0.0-...-f3ad2b4 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2015 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStringFromMap

func GetStringFromMap(rawData interface{}, field string) (string, bool)

Types

type AuthAdaptorOauth

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

func NewAdaptor

func NewAdaptor() *AuthAdaptorOauth

func (AuthAdaptorOauth) Authenticate

func (a AuthAdaptorOauth) Authenticate(_ string, data map[string]interface{}) (string, apperror.Error)

func (*AuthAdaptorOauth) Backend

func (item *AuthAdaptorOauth) Backend() db.Backend

func (AuthAdaptorOauth) Name

func (a AuthAdaptorOauth) Name() string

func (*AuthAdaptorOauth) RegisterService

func (a *AuthAdaptorOauth) RegisterService(service Service)

func (*AuthAdaptorOauth) RegisterUser

func (a *AuthAdaptorOauth) RegisterUser(user kit.User, data map[string]interface{}) (kit.AuthItem, apperror.Error)

func (*AuthAdaptorOauth) SetBackend

func (item *AuthAdaptorOauth) SetBackend(b db.Backend)

type AuthItemOauth

type AuthItemOauth struct {
	db.StrIdModel
	Service        string `db:"required;max:100;"`
	UserId         string `db:"required;max:150;"`
	ExternalUserId string `db:"required;max:100;"`
	Token          string `db:"required;max:500;"`
}

func (*AuthItemOauth) Collection

func (item *AuthItemOauth) Collection() string

func (*AuthItemOauth) GetUser

func (item *AuthItemOauth) GetUser() kit.User

func (*AuthItemOauth) GetUserId

func (item *AuthItemOauth) GetUserId() interface{}

func (*AuthItemOauth) SetUser

func (item *AuthItemOauth) SetUser(u kit.User)

func (*AuthItemOauth) SetUserId

func (item *AuthItemOauth) SetUserId(id interface{}) error

type BaseService

type BaseService struct {
	AuthUrl     string
	RedirectUrl string
	TokenUrl    string
	EndpointUrl string

	ClientId     string
	ClientSecret string
}

func (*BaseService) GetAuthUrl

func (s *BaseService) GetAuthUrl() string

func (*BaseService) GetClientId

func (s *BaseService) GetClientId() string

func (*BaseService) GetClientSecrect

func (s *BaseService) GetClientSecrect() string

func (*BaseService) GetEndpointUrl

func (s *BaseService) GetEndpointUrl() string

func (*BaseService) GetRedirectUrl

func (s *BaseService) GetRedirectUrl() string

func (*BaseService) GetTokenUrl

func (s *BaseService) GetTokenUrl() string

type Client

type Client interface {
	Do(method, path string, data map[string]string) (int, map[string]interface{}, apperror.Error)
}

type Facebook

type Facebook struct {
	BaseService
}

func NewFacebook

func NewFacebook(clientId, clientSecret string) *Facebook

func (*Facebook) Exchange

func (s *Facebook) Exchange(token string) (string, apperror.Error)

func (*Facebook) GetClient

func (s *Facebook) GetClient(token string) Client

func (*Facebook) GetExchangeUrl

func (s *Facebook) GetExchangeUrl(token string) string

func (*Facebook) GetUserData

func (s *Facebook) GetUserData(token string) (*UserData, apperror.Error)

func (*Facebook) Name

func (s *Facebook) Name() string

type Service

type Service interface {
	Name() string

	GetClientId() string
	GetClientSecrect() string
	GetAuthUrl() string
	GetRedirectUrl() string
	GetTokenUrl() string
	GetExchangeUrl(token string) string
	GetEndpointUrl() string

	Exchange(token string) (string, apperror.Error)
	GetClient(token string) Client
	GetUserData(token string) (*UserData, apperror.Error)
}

type TokenClient

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

func NewTokenClient

func NewTokenClient(service Service, token string) *TokenClient

func (*TokenClient) Do

func (c *TokenClient) Do(method, path string, data map[string]string) (int, map[string]interface{}, apperror.Error)

type UserData

type UserData struct {
	Email    string
	Username string
	Id       string
	Data     map[string]interface{}
}

Jump to

Keyboard shortcuts

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