53 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

2021-07-08 11:20:13 +02:00
'use strict';
module.exports = {
2021-08-13 15:35:19 +02:00
default: ({ env }) => ({
jwtSecret: env('JWT_SECRET'),
jwt: {
expiresIn: '30d',
},
ratelimit: {
interval: 60000,
max: 10,
},
2021-08-19 16:49:33 +02:00
layout: {
user: {
actions: {
create: 'contentManagerUser.create', // Use the User plugin's controller.
update: 'contentManagerUser.update',
2021-08-19 16:49:33 +02:00
},
},
},
callback: {
validate(callback, provider) {
let uCallback;
let uProviderCallback;
try {
uCallback = new URL(callback);
uProviderCallback = new URL(provider.callback);
} catch {
throw new Error('The callback is not a valid URL');
}
// Make sure the different origin matches
if (uCallback.origin !== uProviderCallback.origin) {
throw new Error(
`Forbidden callback provided: origins don't match. Please verify your config.`
);
}
// Make sure the different pathname matches
if (uCallback.pathname !== uProviderCallback.pathname) {
throw new Error(
`Forbidden callback provided: pathname don't match. Please verify your config.`
);
}
// NOTE: We're not checking the search parameters on purpose to allow passing different states
},
},
2021-08-13 15:35:19 +02:00
}),
validator() {},
2021-07-08 11:20:13 +02:00
};