This commit is contained in:
gazebo
2019-03-05 10:36:51 +08:00
parent bbf1a33c79
commit 9179ad127d

View File

@@ -63,10 +63,12 @@ func New(rootTask tasksch.ITask, token string, w http.ResponseWriter, r *http.Re
mapData: make(map[interface{}]interface{}),
accessUUID: utils.GetUUID(),
}
globals.SugarLogger.Debugf("jxcontext New, token:%s", token)
if auth2.IsV2Token(token) {
authInfo, err2 := auth2.GetTokenInfo(token)
if err = err2; err == nil {
ctx.userInfo = authInfo
globals.SugarLogger.Debugf("jxcontext New, V2 authInfo:%s", utils.Format4Output(authInfo, false))
if authInfo.TokenType != auth2.TokenTypeNormal {
err = errors.New("需要正式TOKEN")
}
@@ -74,6 +76,7 @@ func New(rootTask tasksch.ITask, token string, w http.ResponseWriter, r *http.Re
} else {
userInfo, err2 := auth.GetUserInfo(token)
if err = err2; err == nil {
globals.SugarLogger.Debugf("jxcontext New, V1 authInfo:%s", utils.Format4Output(userInfo, false))
ctx.userInfo = userInfo
}
}