auth

package
v0.0.0-...-f05d2e9 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2015 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BearerAuthRequired

type BearerAuthRequired struct{}

BearerAuthRequired indicates that you must provide a Bearer token in the Authorization header.

func (BearerAuthRequired) Code

func (e BearerAuthRequired) Code() string

Code returns "auth_required"

func (BearerAuthRequired) Message

func (e BearerAuthRequired) Message() string

Message returns a human-readable description of the error.

type Controller

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

func New

func New(secret []byte) (*Controller, error)

func (*Controller) CreateUser

func (c *Controller) CreateUser(ctx context.Context, w http.ResponseWriter, r *http.Request)

func (*Controller) GetUser

func (c *Controller) GetUser(ctx context.Context, w http.ResponseWriter, r *http.Request)

func (*Controller) WrapC

func (c *Controller) WrapC(inner goji.Handler) goji.Handler

WrapC wraps a handler and only passes requests with valid Bearer authorization.

type User

type User struct {
	ID string
}

User represents the user that authenticates.

func FromContext

func FromContext(ctx context.Context) (User, bool)

FromContext extracts the User from the context, if present.

func (*User) Vars

func (u *User) Vars() map[pattern.Variable]string

Jump to

Keyboard shortcuts

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