Documentation ¶
Overview ¶
Package id is an authentication package that is sessionless, and passwordless.
Index ¶
- Variables
- func AuthInit(key []byte)
- func Authorize(p Provider) http.Handler
- func Callback(p Provider, redirectURL string) http.Handler
- func ExpireCookie(w http.ResponseWriter, r *http.Request)
- func GenToken(user *User) (*http.Cookie, error)
- func HTTPRouterAuthorize(p Provider) httprouter.Handle
- func HTTPRouterCallback(p Provider, redirectURL string) httprouter.Handle
- func Middleware(handlers ...Handler) http.Handler
- func Verified(w http.ResponseWriter, r *http.Request) error
- func Verify(w http.ResponseWriter, r *http.Request) error
- type Handler
- type Provider
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrTokenInvalid means the token wasn't valid based // on the value of its signature. ErrTokenInvalid = errors.New("Invalid token") // ErrCannotParseToken means that the token could not //be parsed. ErrCannotParseToken = errors.New("Cannot parse token") // ErrInvalidSigningMethod means that the method used // to sign the token was not the expected method, or // is an invalid method. ErrInvalidSigningMethod = errors.New("Invalid signing method") // ErrNoSigningKey means that a signing key doesn't // exist. ErrNoSigningKey = errors.New("No signing key") )
Functions ¶
func AuthInit ¶
func AuthInit(key []byte)
AuthInit overrides the randomly generated signing key. Useful for users who want to use the same key across server restarts, so users don't lose their session.
func ExpireCookie ¶
func ExpireCookie(w http.ResponseWriter, r *http.Request)
ExpireCookie sets the expiry on the cookie. It will not send the request.
func HTTPRouterAuthorize ¶
func HTTPRouterAuthorize(p Provider) httprouter.Handle
HTTPRouterAuthorize is the same thing as the regular `Authorize`, but for Julien Schmidt's HttpRouter.
This should be moved into it's own package.
func HTTPRouterCallback ¶
func HTTPRouterCallback(p Provider, redirectURL string) httprouter.Handle
HTTPRouterCallback is the thing as `Callback` but for Julien Schmidt's HttpRouter
func Middleware ¶
Middleware executes all our middleware.
Types ¶
type Handler ¶
type Handler func(w http.ResponseWriter, r *http.Request) error
Handler is the function definition for our middleware.
Click to show internal directories.
Click to hide internal directories.