auth

package
v0.0.0-...-df3db6e Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2015 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authed

func Authed(wrap AuthedFunction, ath Auther) restful.RouteFunction

Pull the "Authorization" header from the request and check if the token can be parsed. If true, delegate to the wrapped function, otherwise send a unauthorized.

Types

type AuthUser

type AuthUser struct {
	Network       string `json:"network"`
	Uid           string `json:"uid"`
	Name          string `json:"name"`
	BackgroundUrl string `json:"backgroundurl"`
	ThumbnailUrl  string `json:"thumbnail"`
}

An AuthUser is a Uid and a Name. The BackgroundUrl and the ThumbnailUrl is optional an can be empty

type AuthedFunction

type AuthedFunction func(ath *AuthUser, request *restful.Request, response *restful.Response)

Signature for a restful function which needs an authenticated user

type Auther

type Auther interface {
	// Return a JWT token out of a given auth'd user
	Create(network, authCode, redirectUrl string) (string, Token, *AuthUser, error)
	// Read the User out of the JWT token
	Get(token string) (*AuthUser, error)
}

A Auther creates an AuthUser from a network and an access_token for this network.

type AutherService

type AutherService struct {
	Auth Auther
}

The rest service

func (*AutherService) Register

func (t *AutherService) Register(root string, c *restful.Container)

Rest interface description

func (*AutherService) Shutdown

func (t *AutherService) Shutdown() error

Shutdown the Auther

type Token

type Token map[string]string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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