|
|
@@ -74,8 +74,8 @@ app.use(function(ctx, next){
|
|
|
});
|
|
|
});
|
|
|
//
|
|
|
-// // routes
|
|
|
-// app.use(router.routes(provider), router.allowedMethods());
|
|
|
+// routes
|
|
|
+app.use(router().routes(), router().allowedMethods());
|
|
|
|
|
|
// error-handling
|
|
|
app.on('error', (err, ctx) => {
|
|
|
@@ -84,45 +84,45 @@ app.on('error', (err, ctx) => {
|
|
|
|
|
|
|
|
|
// SSO
|
|
|
-app.use(helmet());
|
|
|
-
|
|
|
-if (process.env.NODE_ENV === 'production') {
|
|
|
- app.proxy = true;
|
|
|
- set(configuration, 'cookies.short.secure', true);
|
|
|
- set(configuration, 'cookies.long.secure', true);
|
|
|
-
|
|
|
- app.use(async (ctx, next) => {
|
|
|
- if (ctx.secure) {
|
|
|
- await next();
|
|
|
- } else if (ctx.method === 'GET' || ctx.method === 'HEAD') {
|
|
|
- ctx.redirect(ctx.href.replace(/^http:\/\//i, 'https://'));
|
|
|
- } else {
|
|
|
- ctx.body = {
|
|
|
- error: 'invalid_request',
|
|
|
- error_description: 'do yourself a favor and only use https',
|
|
|
- };
|
|
|
- ctx.status = 400;
|
|
|
- }
|
|
|
- });
|
|
|
-}
|
|
|
-
|
|
|
-(async () => {
|
|
|
- let adapter;
|
|
|
- if (process.env.MONGODB_URI) {
|
|
|
- adapter = require('./adapters/memory_adapter'); // eslint-disable-line global-require
|
|
|
- // await adapter.connect();
|
|
|
- }
|
|
|
-
|
|
|
- const provider = new Provider(ISSUER, { adapter, ...configuration });
|
|
|
-
|
|
|
- provider.use(helmet());
|
|
|
-
|
|
|
- app.use(router(provider).routes(), router(provider).allowedMethods());
|
|
|
- app.use(mount(provider.app));
|
|
|
-})().catch((err) => {
|
|
|
- console.error(err);
|
|
|
- process.exitCode = 1;
|
|
|
-});
|
|
|
+// app.use(helmet());
|
|
|
+//
|
|
|
+// if (process.env.NODE_ENV === 'production') {
|
|
|
+// app.proxy = true;
|
|
|
+// set(configuration, 'cookies.short.secure', true);
|
|
|
+// set(configuration, 'cookies.long.secure', true);
|
|
|
+//
|
|
|
+// app.use(async (ctx, next) => {
|
|
|
+// if (ctx.secure) {
|
|
|
+// await next();
|
|
|
+// } else if (ctx.method === 'GET' || ctx.method === 'HEAD') {
|
|
|
+// ctx.redirect(ctx.href.replace(/^http:\/\//i, 'https://'));
|
|
|
+// } else {
|
|
|
+// ctx.body = {
|
|
|
+// error: 'invalid_request',
|
|
|
+// error_description: 'do yourself a favor and only use https',
|
|
|
+// };
|
|
|
+// ctx.status = 400;
|
|
|
+// }
|
|
|
+// });
|
|
|
+// }
|
|
|
+//
|
|
|
+// (async () => {
|
|
|
+// let adapter;
|
|
|
+// if (process.env.MONGODB_URI) {
|
|
|
+// adapter = require('./adapters/memory_adapter'); // eslint-disable-line global-require
|
|
|
+// // await adapter.connect();
|
|
|
+// }
|
|
|
+//
|
|
|
+// const provider = new Provider(ISSUER, { adapter, ...configuration });
|
|
|
+//
|
|
|
+// provider.use(helmet());
|
|
|
+//
|
|
|
+// app.use(router(provider).routes(), router(provider).allowedMethods());
|
|
|
+// app.use(mount(provider.app));
|
|
|
+// })().catch((err) => {
|
|
|
+// console.error(err);
|
|
|
+// process.exitCode = 1;
|
|
|
+// });
|
|
|
|
|
|
// Import and Set Nuxt.js options
|
|
|
const config = require('../nuxt.config.js')
|