mirror of
https://forgejo.merr.is/annika/jwtauth.git
synced 2025-12-11 13:47:41 -05:00
Move Verifier method to pkg-level func to accept *jwtauth.JwtAuth
This commit is contained in:
parent
a5d0d75313
commit
6444fb9aef
5 changed files with 24 additions and 7 deletions
|
|
@ -31,7 +31,7 @@ func init() {
|
|||
func TestSimple(t *testing.T) {
|
||||
r := chi.NewRouter()
|
||||
|
||||
r.Use(TokenAuth.Verifier, jwtauth.Authenticator)
|
||||
r.Use(jwtauth.Verifier(TokenAuth), jwtauth.Authenticator)
|
||||
|
||||
r.Get("/", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte("welcome"))
|
||||
|
|
@ -76,7 +76,7 @@ func TestMore(t *testing.T) {
|
|||
|
||||
// Protected routes
|
||||
r.Group(func(r chi.Router) {
|
||||
r.Use(TokenAuth.Verifier)
|
||||
r.Use(jwtauth.Verifier(TokenAuth))
|
||||
|
||||
authenticator := func(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue