authorization

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2018 License: AGPL-3.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ScopeAll = "all"
)

Scopes

Variables

View Source
var (
	ErrNotAuthorized       = errors.New("not authorized")
	ErrInvalidClient       = errors.New("invalid client")
	ErrInvalidAuth         = errors.New("invalid auth")
	ErrMissingRedirect     = errors.New("missing redirect_uri")
	ErrInvalidResponseType = errors.New("response_type unsupported")
)

Error Values

Functions

This section is empty.

Types

type OAuthHandler added in v0.1.0

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

OAuthHandler provides OAuth2 capabilities.

func NewHandler

func NewHandler(options *Options) (*OAuthHandler, error)

NewHandler creates and initializes a new OAuthHandler

func (*OAuthHandler) Authorized added in v0.1.0

func (h *OAuthHandler) Authorized(r *http.Request) ([]string, error)

Authorized returns the authorized scopes for a request, or an error if the request does not have sufficient authorization.

func (*OAuthHandler) IsAuthenticated added in v0.1.0

func (h *OAuthHandler) IsAuthenticated(r *http.Request) string

IsAuthenticated checks the request for a Bearer token

func (*OAuthHandler) RegisterAPI added in v0.1.0

func (h *OAuthHandler) RegisterAPI(root string) *mux.Router

RegisterAPI returns a router that handles OAuth routes.

type Options

type Options struct {
	TokenTTL time.Duration
	GrantTTL time.Duration
	CacheDir string
	Users    *user.Registry
}

Options encapsulates OAuth Handler options.

Jump to

Keyboard shortcuts

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