Update README

This commit is contained in:
Peter Kieltyka 2017-10-10 06:38:31 -04:00
parent e6503c425b
commit 9f0ed7472c

View file

@ -23,12 +23,11 @@ plain-text payload for all unverified tokens and passes the good ones through. Y
also copy the Authenticator and customize it to handle invalid tokens to better fit also copy the Authenticator and customize it to handle invalid tokens to better fit
your flow (ie. with a JSON error response body). your flow (ie. with a JSON error response body).
The `Verifier` will search for a JWT token in a http request, in the order: By default, the `Verifier` will search for a JWT token in a http request, in the order:
1. 'jwt' URI query parameter 1. 'jwt' URI query parameter
2. 'Authorization: BEARER T' request header 2. 'Authorization: BEARER T' request header
3. Cookie 'jwt' value 3. 'jwt' Cookie value
4. (optional), use `jwtauth.Verify("state")` for additional query/cookie parameter aliases
The first JWT string that is found as a query parameter, authorization header The first JWT string that is found as a query parameter, authorization header
or cookie header is then decoded by the `jwt-go` library and a *jwt.Token or cookie header is then decoded by the `jwt-go` library and a *jwt.Token
@ -40,6 +39,11 @@ be the generic `jwtauth.Authenticator` middleware or your own custom handler
which checks the request context jwt token and error to prepare a custom which checks the request context jwt token and error to prepare a custom
http response. http response.
Note: jwtauth supports custom verification sequences for finding a token
from a request by using the `Verify` middleware instantiator directly. The default
`Verifier` is instantiated by calling `Verify(ja, TokenFromQuery, TokenFromHeader, TokenFromCookie)`.
# Usage # Usage
See the full [example](https://github.com/go-chi/jwtauth/blob/master/_example/main.go). See the full [example](https://github.com/go-chi/jwtauth/blob/master/_example/main.go).