@yrpri/api 9.0.133 → 9.0.134

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1437,7 +1437,6 @@ router.delete('/anonymize_current_user', function (req, res) {
1437
1437
  }
1438
1438
  });
1439
1439
  router.post('/logout', function (req, res) {
1440
- log.info("Anon debug logout");
1441
1440
  if (req.isAuthenticated()) {
1442
1441
  log.info('User Logging out', { userId: req.user.id, context: 'logout' });
1443
1442
  }
@@ -1447,8 +1446,11 @@ router.post('/logout', function (req, res) {
1447
1446
  const oidcProvider = req.ypDomain &&
1448
1447
  req.ypDomain.loginProviders &&
1449
1448
  req.ypDomain.loginProviders.find((p) => p.provider === 'oidc');
1449
+ log.info("oidcProvider", { oidcProvider });
1450
1450
  if (req.sso && oidcProvider && oidcProvider.endSessionURL) {
1451
+ log.info("Logging out from OIDC");
1451
1452
  logoutFromSession(req, res, 200, () => {
1453
+ log.info("Logging out from OIDC", { oidcProvider });
1452
1454
  req.sso.logout(oidcProvider.name, { postLogoutRedirectUri: '/' }, req, res, (error) => {
1453
1455
  if (error) {
1454
1456
  log.error('Error logging out from OIDC', { err: error });
@@ -2287,7 +2289,10 @@ router.get('/auth/audkenni/callback', async function (req, res) {
2287
2289
  }
2288
2290
  }
2289
2291
  else {
2290
- if (process.env.REDIRECT_TO_ROOT_AFTER_OIDC) {
2292
+ if (process.env.REDIRECT_AFTER_AUDKENNI_URL) {
2293
+ res.redirect(process.env.REDIRECT_AFTER_AUDKENNI_URL);
2294
+ }
2295
+ else if (process.env.REDIRECT_TO_ROOT_AFTER_OIDC) {
2291
2296
  res.redirect('/');
2292
2297
  }
2293
2298
  else {
package/models/domain.cjs CHANGED
@@ -237,6 +237,7 @@ module.exports = (sequelize, DataTypes) => {
237
237
  authorizationURL: domain.secret_api_keys.oidc.authorizationURL,
238
238
  tokenURL: domain.secret_api_keys.oidc.tokenURL,
239
239
  userInfoURL: domain.secret_api_keys.oidc.userInfoURL,
240
+ endSessionURL: domain.secret_api_keys.oidc.endSessionURL,
240
241
  callbackUrl: "https://" +
241
242
  callbackDomainName +
242
243
  "/api/users/auth/audkenni/callback",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yrpri/api",
3
- "version": "9.0.133",
3
+ "version": "9.0.134",
4
4
  "license": "MIT",
5
5
  "author": "Robert Bjarnason & Citizens Foundation",
6
6
  "repository": {
@@ -2,9 +2,9 @@ import ExcelJS from 'exceljs';
2
2
  import models from '../../models/index.cjs';
3
3
  (async () => {
4
4
  try {
5
- const [xlsPath, clientId, clientSecret, issuer, authorizationURL, tokenURL, userInfoURL,] = process.argv.slice(2);
5
+ const [xlsPath, clientId, clientSecret, issuer, authorizationURL, tokenURL, userInfoURL, endSessionURL,] = process.argv.slice(2);
6
6
  if (!xlsPath) {
7
- console.log('Usage: node importDomainsFromXls.js <path-to-xls> [clientId clientSecret issuer authorizationURL tokenURL userInfoURL]');
7
+ console.log('Usage: node importDomainsFromXls.js <path-to-xls> [clientId clientSecret issuer authorizationURL tokenURL userInfoURL endSessionURL]');
8
8
  process.exit(1);
9
9
  }
10
10
  const oidcProvided = clientId &&
@@ -12,7 +12,8 @@ import models from '../../models/index.cjs';
12
12
  issuer &&
13
13
  authorizationURL &&
14
14
  tokenURL &&
15
- userInfoURL;
15
+ userInfoURL &&
16
+ endSessionURL;
16
17
  const workbook = new ExcelJS.Workbook();
17
18
  await workbook.xlsx.readFile(xlsPath);
18
19
  const worksheet = workbook.getWorksheet(1);
@@ -29,6 +30,7 @@ import models from '../../models/index.cjs';
29
30
  authorizationURL,
30
31
  tokenURL,
31
32
  userInfoURL,
33
+ endSessionURL,
32
34
  }
33
35
  : null;
34
36
  for (let i = 2; i <= worksheet.rowCount; i++) {
@@ -8,6 +8,7 @@ const issuer = process.argv[5];
8
8
  const authorizationURL = process.argv[6];
9
9
  const tokenURL = process.argv[7];
10
10
  const userInfoURL = process.argv[8];
11
+ const endSessionURL = process.argv[9];
11
12
  console.log(`Updating OIDC keys for domain ${domainId}`);
12
13
  async.series([
13
14
  function (callback) {
@@ -29,7 +30,8 @@ async.series([
29
30
  issuer: issuer,
30
31
  authorizationURL: authorizationURL,
31
32
  tokenURL: tokenURL,
32
- userInfoURL: userInfoURL
33
+ userInfoURL: userInfoURL,
34
+ endSessionURL: endSessionURL
33
35
  };
34
36
  console.log("Updated secret_api_keys:", JSON.stringify(domain.secret_api_keys, null, 2));
35
37
  domain.changed('secret_api_keys', true);