Commit c24ba718 authored by TENCENT\denisfan's avatar TENCENT\denisfan
Browse files

yy

parent 64a48840
Showing with 8 additions and 3 deletions
+8 -3
......@@ -29,7 +29,8 @@ const postMidware = require('./app/midware/postMidware');
const localeMidware = require('./app/midware/localeMidware');
const helmet = require("koa-helmet");
// const compress = require('koa-compress')
const loginMidware = require('./app/midware/loginMidware');
const loginMidware = require('yami-sso-client').koa;
console.log(loginMidware);
const limitMidware = require('./app/midware/limitMidware');
const WebConf = require('./config/webConf');
......@@ -65,7 +66,9 @@ preMidware.forEach((midware)=>{
});
//登录校验
app.use(loginMidware);
let loginConf = require('./config/loginConf.js');
loginConf.ignore =loginConf.ignore.concat(['/favicon.ico', '/pages/server/api/get_locale']);
app.use(loginMidware(loginConf));
//激活router
app.use(pageRouter.routes(), pageRouter.allowedMethods());
......
......@@ -31,6 +31,7 @@ let cookieConfig = Object.assign({
//登录校验中间件
module.exports = async(ctx, next) => {
if (ctx.request.path === '/logout') {
ctx.cookies.set(loginConf.ticketCookieName || 'ticket', null, cookieDomainConfig);
ctx.cookies.set(loginConf.uidCookieName || 'uid', null, cookieDomainConfig);
......
......@@ -47,7 +47,8 @@
"url": "^0.11.0",
"validator": "^9.4.1",
"winston": "^2.4.2",
"winston-daily-rotate-file": "^1.7.2"
"winston-daily-rotate-file": "^1.7.2",
"yami-sso-client": "^1.0.1"
},
"devDependencies": {
"nodemon": "^1.17.5"
......
Supports Markdown
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