1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-23 07:09:44 +02:00

fix: Lazy initialize OIDC client

This commit is contained in:
Disyer 2024-11-18 10:03:05 +02:00
parent 96956e1268
commit 88ffa08512
4 changed files with 58 additions and 23 deletions

View file

@ -1,8 +1,26 @@
const Errors = {
INVALID_OIDC_CONFIGURATION: {
invalidOidcConfiguration: 'Invalid OIDC configuration'
},
};
module.exports = {
fn() {
exits: {
invalidOidcConfiguration: {
responseType: 'serverError'
},
},
async fn() {
let oidc = null;
if (sails.hooks.oidc.isActive()) {
const oidcClient = sails.hooks.oidc.getClient();
let oidcClient;
try {
oidcClient = await sails.hooks.oidc.getClient();
} catch (error) {
sails.log.warn(`Error while initializing OIDC client: ${error}`);
throw Errors.INVALID_OIDC_CONFIGURATION;
}
const authorizationUrlParams = {
scope: sails.config.custom.oidcScopes,