echoauth

package module
v0.0.0-...-f258aaa Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2016 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const SessionName = "_gothic_session"

SessionName is the key used to access the session store.

Variables

View Source
var (
	ErrUndefinedProvider = errors.New("Undefined provider name")
)

Errors list

Functions

This section is empty.

Types

type Client

type Client struct {
	DefaultProvider string
	Store           SessionStore
}

Client OAuth authorize

func (*Client) Begin

func (cli *Client) Begin(ctx echo.Context) error

Begin auth session

func (*Client) Callback

func (cli *Client) Callback(fnk func(user goth.User, err error, ctx echo.Context) error) echo.HandlerFunc

Callback from oauth server

func (*Client) GetAuthURL

func (cli *Client) GetAuthURL(ctx echo.Context) (string, error)

GetAuthURL starts the authentication process with the requested provided. It will return a URL that should be used to send users to.

It expects to be able to get the name of the provider from the query parameters as either "provider" or ":provider".

I would recommend using the BeginAuthHandler instead of doing all of these steps yourself, but that's entirely up to you.

func (*Client) GetUser

func (cli *Client) GetUser(ctx echo.Context) (goth.User, error)

GetUser object for oauth response

type Session

type Session interface {
	Get(key string) (interface{}, error)
	Set(key string, value interface{}) error
	Delete(key string) error
	Save(ctx echo.Context) error
}

Session interface

type SessionStore

type SessionStore interface {
	Get(ctx echo.Context) (Session, error)
}

SessionStore session accessor

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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