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:
Jonathan ES Lin 2018-09-27 01:43:54 +08:00 committed by Peter Kieltyka
parent 53a0a4877a
commit ea7d7e213f
4 changed files with 49 additions and 121 deletions

View file

@ -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)
}