修复 AuthKey为空的时候 也可以过.

This commit is contained in:
eson
2023-06-25 11:26:47 +08:00
parent 8bd6f019ba
commit efe02a0355
23 changed files with 267 additions and 125 deletions

View File

@@ -31,6 +31,10 @@ func NewServiceContext(c config.Config) *ServiceContext {
func (svcCtx *ServiceContext) ParseJwtToken(r *http.Request) (jwt.MapClaims, error) {
AuthKey := r.Header.Get("Authorization")
if AuthKey == "" {
return nil, nil
}
if len(AuthKey) <= 50 {
return nil, errors.New(fmt.Sprint("Error parsing token, len:", len(AuthKey)))
}