Commit 70580cec authored by 任国军's avatar 任国军

add jwt log

parent 3d7b8071
Pipeline #24511 passed with stage
in 7 seconds
...@@ -8,6 +8,7 @@ module.exports = { ...@@ -8,6 +8,7 @@ module.exports = {
get_jwt() { get_jwt() {
const { ctx } = this; const { ctx } = this;
const bearerToken = ctx.request.header.authorization; const bearerToken = ctx.request.header.authorization;
ctx.logger.info('course_headers: ' + JSON.stringify(ctx.request.header));
if (!bearerToken) { if (!bearerToken) {
ctx.throw(401, 'error auth'); ctx.throw(401, 'error auth');
} }
...@@ -21,6 +22,7 @@ module.exports = { ...@@ -21,6 +22,7 @@ module.exports = {
if (ctx.isEmpty(decode_res)) { if (ctx.isEmpty(decode_res)) {
ctx.throw(401, 'jwt校验失败'); ctx.throw(401, 'jwt校验失败');
} }
ctx.logger.info('course_token_decode: ' + JSON.stringify(decode_res));
const token_black = await this.app.memcache.get('course_auth_token_' + decode_res.data.user_uuid); const token_black = await this.app.memcache.get('course_auth_token_' + decode_res.data.user_uuid);
if (token_black !== token) { if (token_black !== token) {
ctx.throw(401, 'token不一致'); ctx.throw(401, 'token不一致');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment