Update go-chi/jwtauth to v3.3 and remove dgrijalva from direct dependencies

This commit is contained in:
Alex Frank Adhyatma 2019-03-07 11:55:45 +00:00
parent 83b738e298
commit a2d51bbfd8
No known key found for this signature in database
GPG key ID: 3AE15EAFE5BAFD5E
7 changed files with 27 additions and 28 deletions

View file

@ -14,8 +14,8 @@ import (
"testing"
"time"
jwtgo "github.com/dgrijalva/jwt-go"
"github.com/go-chi/chi"
"github.com/go-chi/jwtauth"
"github.com/spf13/viper"
"github.com/dhax/go-base/auth/jwt"
@ -240,7 +240,7 @@ func TestAuthResource_refresh(t *testing.T) {
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
jwt := genJWT(jwtgo.MapClaims{"token": tc.token, "exp": time.Minute * tc.exp})
jwt := genJWT(jwtauth.Claims{"token": tc.token, "exp": time.Minute * tc.exp})
res, body := testRequest(t, ts, "POST", "/refresh", nil, jwt)
if res.StatusCode != tc.status {
t.Errorf("got http status %d, want: %d", res.StatusCode, tc.status)
@ -300,7 +300,7 @@ func TestAuthResource_logout(t *testing.T) {
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
jwt := genJWT(jwtgo.MapClaims{"token": tc.token, "exp": time.Minute * tc.exp})
jwt := genJWT(jwtauth.Claims{"token": tc.token, "exp": time.Minute * tc.exp})
res, body := testRequest(t, ts, "POST", "/logout", nil, jwt)
if res.StatusCode != tc.status {
t.Errorf("got http status %d, want: %d", res.StatusCode, tc.status)
@ -343,7 +343,7 @@ func testRequest(t *testing.T, ts *httptest.Server, method, path string, body io
return resp, string(respBody)
}
func genJWT(c jwtgo.MapClaims) string {
func genJWT(c jwtauth.Claims) string {
_, tokenString, _ := auth.TokenAuth.JwtAuth.Encode(c)
return tokenString
}