jwtprovider

package
v0.0.0-...-37b3894 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AuthorizationCookie is the name of the cookie that jwtprovider uses.
	AuthorizationCookie = "authorization"
)

Functions

func NewProvider

func NewProvider(invalidRoleHandler http.HandlerFunc, loginHandler func(w http.ResponseWriter, r *http.Request, redirect string), secret string) httpauth.AuthorizationProvider

NewProvider returns a new authentication provider that runs on jwt.

Types

type JWTAuthenticationProvider

type JWTAuthenticationProvider struct {
	InvalidRoleHandler http.HandlerFunc
	LoginHandler       func(w http.ResponseWriter, r *http.Request, redirect string)
	// contains filtered or unexported fields
}

JWTAuthenticationProvider is the default authentication provider

func (*JWTAuthenticationProvider) GetIdentity

GetIdentity returns true if the user is any of the specified roles.

func (*JWTAuthenticationProvider) HandleInvalidRole

func (j *JWTAuthenticationProvider) HandleInvalidRole(w http.ResponseWriter, r *http.Request)

HandleInvalidRole calls the http.HandlerFunc called when a user lacks permission for a certain action.

func (*JWTAuthenticationProvider) HandleLogin

func (j *JWTAuthenticationProvider) HandleLogin(w http.ResponseWriter, r *http.Request, redirect string)

HandleLogin calls the http.HandlerFunc called when a user needs to be redirected to the login page.

func (*JWTAuthenticationProvider) RemoveIdentity

func (j *JWTAuthenticationProvider) RemoveIdentity(w http.ResponseWriter) error

RemoveIdentity removes all roles from the user.

func (*JWTAuthenticationProvider) SetIdentity

SetIdentity sets the role of the current user.

Jump to

Keyboard shortcuts

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