auth551

package module
v0.0.0-...-1a29e3c Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2016 License: MIT Imports: 9 Imported by: 2

README

auth551

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFacebook

func LoadFacebook(config ConfigOAuth2) *authFacebook

func LoadGoogle

func LoadGoogle(config ConfigOAuth2) *authGoogle

func LoadTwitter

func LoadTwitter(config ConfigOAuth1) *authTwitter

func NewUserModel

func NewUserModel() interface{}

func NewUserModelPointer

func NewUserModelPointer() interface{}

func NewUserTokenModel

func NewUserTokenModel() interface{}

func NewUserTokenModelPointer

func NewUserTokenModelPointer() interface{}

Types

type AccessToken

type AccessToken struct {
	AccessToken  string
	TokenSecret  string
	TokenType    string
	RefreshToken string
	Expiry       time.Time
}

--[ Access Token Model ]--------

type AccountInformation

type AccountInformation struct {
	Id      string
	Name    string
	Email   string
	Picture string
}

--[ Access Token Model ]--------

type Auth

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

func Load

func Load(config *Config) *Auth

func (*Auth) Auth

func (a *Auth) Auth(vendor AuthVendor) AuthInstance

func (*Auth) AuthCodeUrl

func (a *Auth) AuthCodeUrl(vendor AuthVendor) (url, token, secret string)

func (*Auth) CookieKeyName

func (a *Auth) CookieKeyName() string

func (*Auth) MasterKey

func (a *Auth) MasterKey() string

func (*Auth) UserInfoExchange

func (a *Auth) UserInfoExchange(vendor AuthVendor, code, token, secret string) (*AccessToken, *AccountInformation, error)

type AuthInstance

type AuthInstance interface {
	AuthCodeUrl() (url, token, secret string)
	TokenExchange(code, token, secret string) (*AccessToken, error)
	UserInfo(*AccessToken) (*AccountInformation, error)
}

type AuthVendor

type AuthVendor int
const (
	VENDOR_GOOGLE AuthVendor = iota
	VENDOR_TWITTER
	VENDOR_FACEBOOK
)

func AuthVendorCode

func AuthVendorCode(vendor string) (AuthVendor, error)

func (AuthVendor) String

func (av AuthVendor) String() string

type Config

type Config struct {
	MasterKey     string       `json:"master_key"`
	CookieKeyName string       `json:"cookie_key_name"`
	Google        ConfigOAuth2 `json:"google"`
	Twitter       ConfigOAuth1 `json:"twitter"`
	Facebook      ConfigOAuth2 `json:"facebook"`
}

type ConfigOAuth1

type ConfigOAuth1 struct {
	Vendor            string `json:"vendor"`
	ConsumerKey       string `json:"consumer_key"`
	ConsumerSecret    string `json:"consumer_secret"`
	RedirectUrl       string `json:"redirect_url"`
	AuthorizeTokenUrl string `json:"authorize_token_url"`
	RequestTokenUrl   string `json:"request_token_url"`
	AccessTokenUrl    string `json:"access_token_url"`
}

type ConfigOAuth2

type ConfigOAuth2 struct {
	Vendor       string   `json:"vendor"`
	ClientId     string   `json:"client_id"`
	ClientSecret string   `json:"client_secret"`
	RedirectUrl  string   `json:"redirect_url"`
	Scope        []string `json:"scope"`
	AuthUrl      string   `json:"auth_url"`
	TokenUrl     string   `json:"token_url"`
}

type TweetInstance

type TweetInstance interface {
	Tweet(accessToken *AccessToken, tweet *TweetModel) error
}

type TweetModel

type TweetModel struct {
	Status             string
	Lat                float64
	Long               float64
	DisplayCoordinates bool
}

type UserModel

type UserModel struct {
	Id             int64 `db_table:"users"`
	CreatedAt      time.Time
	UpdatedAt      time.Time
	Locked         bool
	Enabled        bool
	Name           string
	Email          string
	EmailCanonical string
	PasswordSalt   string
	Password       string
	Thumbnail      string
	Serial         string
	DeletedAt      time.Time `db_delete:"true"`
}

--[ User Model ]--------

func (*UserModel) GetId

func (m *UserModel) GetId() int64

func (*UserModel) Scan

func (m *UserModel) Scan(rows *sql.Rows) error

func (*UserModel) SetId

func (m *UserModel) SetId(id int64)

func (*UserModel) SqlValues

func (m *UserModel) SqlValues(sqlType model551.SqlType) []interface{}

type UserTokenModel

type UserTokenModel struct {
	Id           int64 `db_table:"user_tokens"`
	CreatedAt    time.Time
	UpdatedAt    time.Time
	UserId       int64
	Vendor       string
	AccessToken  string
	TokenSecret  string
	Expiry       time.Time
	RefreshToken string
	TokenType    string
	AccountId    string
	Name         string
	Thumbnail    string
	DeletedAt    time.Time `db_delete:"true"`
}

--[ User Token Model ]--------

func (*UserTokenModel) GetId

func (m *UserTokenModel) GetId() int64

func (*UserTokenModel) Scan

func (m *UserTokenModel) Scan(rows *sql.Rows) error

func (*UserTokenModel) SetId

func (m *UserTokenModel) SetId(id int64)

func (*UserTokenModel) SqlValues

func (m *UserTokenModel) SqlValues(sqlType model551.SqlType) []interface{}

Jump to

Keyboard shortcuts

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