auth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2014 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auther

type Auther interface {
	Check(*http.Request, map[string]string) *Result
}

Auther deals with authentication and authorization

type NullAuther

type NullAuther struct{}

NullAuther implements Auther but doesn't even care!

func NewNullAuther

func NewNullAuther() *NullAuther

NewNullAuther creates a new *NullAuther yey

func (*NullAuther) Check

func (na *NullAuther) Check(r *http.Request, vars map[string]string) *Result

Check always allows reads and writes

type Result

type Result struct {
	UserID   string
	Resource string
	CanRead  bool
	CanWrite bool
	Errors   []error
}

Result is what an Auther returns mkay

func NewResult

func NewResult(r *http.Request, vars map[string]string) *Result

NewResult initializes a *Result from an *http.Request and vars map

type TokenAuther

type TokenAuther struct {
	AuthToken string
}

TokenAuther implements Auther with tokens!

func NewTokenAuther

func NewTokenAuther(authToken string) *TokenAuther

NewTokenAuther makes a new *TokenAuther wow!

func (*TokenAuther) Check

func (ta *TokenAuther) Check(r *http.Request, vars map[string]string) *Result

Check checks the token mkay

type TravisAuther

type TravisAuther struct {
	TravisAPI  string
	PrivateKey *rsa.PrivateKey
	RequireRSA bool
}

TravisAuther implements travis-specific authorization checks

func NewTravisAuther

func NewTravisAuther(travisAPI string, privateKey *rsa.PrivateKey, requireRSA bool) *TravisAuther

NewTravisAuther creates a new *TravisAuther wowsa

func (*TravisAuther) Check

func (ta *TravisAuther) Check(r *http.Request, vars map[string]string) *Result

Check uses an authorization token to determine if reads are allowed and a possibly encrypted timestamp to determine if writes are allowed

Jump to

Keyboard shortcuts

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