Documentation ¶
Index ¶
- func New(auth *Auth, options ...Options) error
- type Auth
- func (a *Auth) GrabTokenClaims(r *http.Request) (ClaimsType, error)
- func (a *Auth) Handler(h http.Handler) http.Handler
- func (a *Auth) HandlerFuncWithNext(w http.ResponseWriter, r *http.Request, next http.HandlerFunc)
- func (a *Auth) IssueNewTokens(w http.ResponseWriter, claims *ClaimsType) error
- func (a *Auth) NullifyTokens(w http.ResponseWriter, r *http.Request) error
- func (a *Auth) SetCheckTokenIdFunction(checker TokenIdChecker)
- func (a *Auth) SetErrorHandler(handler http.Handler)
- func (a *Auth) SetRevokeTokenFunction(revoker TokenRevoker)
- func (a *Auth) SetUnauthorizedHandler(handler http.Handler)
- type ClaimsType
- type Options
- type TokenIdChecker
- type TokenRevoker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 ¶
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
note @adam-hanna: what if there are no credentials in the request?
func (*Auth) SetCheckTokenIdFunction ¶
func (a *Auth) SetCheckTokenIdFunction(checker TokenIdChecker)
func (*Auth) SetErrorHandler ¶
add methods to allow the changing of default functions
func (*Auth) SetRevokeTokenFunction ¶
func (a *Auth) SetRevokeTokenFunction(revoker TokenRevoker)
func (*Auth) SetUnauthorizedHandler ¶
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 TokenRevoker ¶
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 |
Click to show internal directories.
Click to hide internal directories.