...
|
...
|
@@ -3,13 +3,14 @@ package main |
|
|
import (
|
|
|
"context"
|
|
|
"flag"
|
|
|
"net/http"
|
|
|
"strings"
|
|
|
|
|
|
"github.com/zeromicro/go-zero/rest/httpx"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
|
|
|
"net/http"
|
|
|
"strings"
|
|
|
|
|
|
"github.com/golang-jwt/jwt/v4/request"
|
|
|
"github.com/zeromicro/go-zero/core/conf"
|
...
|
...
|
@@ -65,7 +66,8 @@ func systemSetup(c config.Config) { |
|
|
|
|
|
// 默认的token头 Authorization 修改为 x-mmm-accesstoken
|
|
|
request.AuthorizationHeaderExtractor = &request.PostExtractionFilter{
|
|
|
request.HeaderExtractor{"x-mmm-accesstoken"}, func(tok string) (string, error) {
|
|
|
Extractor: request.HeaderExtractor{"x-mmm-accesstoken"},
|
|
|
Filter: func(tok string) (string, error) {
|
|
|
// Should be a bearer token
|
|
|
if len(tok) > 6 && strings.ToUpper(tok[0:7]) == "BEARER " {
|
|
|
return tok[7:], nil
|
...
|
...
|
|