jwt

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2016 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(auth *Auth, options ...Options) error

New constructs a new Auth instance with supplied options.

Types

type Auth

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

Auth is a middleware that provides jwt based authentication.

func (*Auth) GrabTokenClaims

func (a *Auth) GrabTokenClaims(r *http.Request) (ClaimsType, error)

note: we always grab from the authToken

func (*Auth) Handler

func (a *Auth) Handler(h http.Handler) http.Handler

Handler implements the http.HandlerFunc for integration with the standard net/http lib.

func (*Auth) HandlerFuncWithNext

func (a *Auth) HandlerFuncWithNext(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)

HandlerFuncWithNext is a special implementation for Negroni, but could be used elsewhere.

func (*Auth) IssueNewTokens

func (a *Auth) IssueNewTokens(w http.ResponseWriter, claims *ClaimsType) error

and also modify create refresh and auth token functions!

func (*Auth) NullifyTokens added in v0.0.21

func (a *Auth) NullifyTokens(w http.ResponseWriter, r *http.Request) error

note @adam-hanna: what if there are no credentials in the request?

func (*Auth) SetCheckTokenIdFunction

func (a *Auth) SetCheckTokenIdFunction(checker TokenIdChecker)

func (*Auth) SetErrorHandler

func (a *Auth) SetErrorHandler(handler http.Handler)

add methods to allow the changing of default functions

func (*Auth) SetRevokeTokenFunction

func (a *Auth) SetRevokeTokenFunction(revoker TokenRevoker)

func (*Auth) SetUnauthorizedHandler

func (a *Auth) SetUnauthorizedHandler(handler http.Handler)

type ClaimsType

type ClaimsType struct {
	// Standard claims are the standard jwt claims from the ietf standard
	// https://tools.ietf.org/html/rfc7519
	jwtGo.StandardClaims
	Csrf         string
	CustomClaims map[string]interface{}
}

type Options

type Options struct {
	SigningMethodString   string
	PrivateKeyLocation    string
	PublicKeyLocation     string
	HMACKey               []byte
	VerifyOnlyServer      bool
	BearerTokens          bool
	RefreshTokenValidTime time.Duration
	AuthTokenValidTime    time.Duration
	Debug                 bool
	IsDevEnv              bool
}

Options is a struct for specifying configuration options

type TokenIdChecker

type TokenIdChecker func(tokenId string) bool

type TokenRevoker

type TokenRevoker func(tokenId string) error

Directories

Path Synopsis
Godeps
_workspace/src/github.com/adam-hanna/randomstrings
thanks to @elithrar for the code to create the secret token! source: https://elithrar.github.io/article/generating-secure-random-numbers-crypto-rand/
thanks to @elithrar for the code to create the secret token! source: https://elithrar.github.io/article/generating-secure-random-numbers-crypto-rand/
_workspace/src/github.com/dgrijalva/jwt-go
Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html
Package jwt is a Go implementation of JSON Web Tokens: http://self-issued.info/docs/draft-jones-json-web-token.html

Jump to

Keyboard shortcuts

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