export token parser for refresh token service

master
kevin 4 years ago
parent 196475383b
commit a7c02414f3

@ -8,7 +8,7 @@ import (
"github.com/dgrijalva/jwt-go" "github.com/dgrijalva/jwt-go"
"github.com/tal-tech/go-zero/core/logx" "github.com/tal-tech/go-zero/core/logx"
"github.com/tal-tech/go-zero/rest/internal" "github.com/tal-tech/go-zero/rest/token"
) )
const ( const (
@ -43,7 +43,7 @@ func Authorize(secret string, opts ...AuthorizeOption) func(http.Handler) http.H
opt(&authOpts) opt(&authOpts)
} }
parser := internal.NewTokenParser() parser := token.NewTokenParser()
return func(next http.Handler) http.Handler { return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
token, err := parser.ParseToken(r, secret, authOpts.PrevSecret) token, err := parser.ParseToken(r, secret, authOpts.PrevSecret)

@ -1,4 +1,4 @@
package internal package token
import ( import (
"net/http" "net/http"

@ -1,4 +1,4 @@
package internal package token
import ( import (
"net/http" "net/http"
Loading…
Cancel
Save