mirror of
https://forgejo.merr.is/annika/jwtauth.git
synced 2025-12-11 13:47:41 -05:00
Remove unnecessary code and clean up errors (#30)
* Initial refactor * Fix some of the tests * Handle more specific errors from jwt library * Fix comments * Rename package * Verify signing algo after nil check
This commit is contained in:
parent
53a0a4877a
commit
ea7d7e213f
4 changed files with 49 additions and 121 deletions
|
|
@ -62,6 +62,7 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
|
||||
jwt "github.com/dgrijalva/jwt-go"
|
||||
"github.com/go-chi/chi"
|
||||
"github.com/go-chi/jwtauth"
|
||||
)
|
||||
|
|
@ -73,7 +74,7 @@ func init() {
|
|||
|
||||
// For debugging/example purposes, we generate and print
|
||||
// a sample jwt token with claims `user_id:123` here:
|
||||
_, tokenString, _ := tokenAuth.Encode(jwtauth.Claims{"user_id": 123})
|
||||
_, tokenString, _ := tokenAuth.Encode(jwt.MapClaims{"user_id": 123})
|
||||
fmt.Printf("DEBUG: a sample jwt is %s\n\n", tokenString)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue