strapi-custom-auth 1.2.8 → 1.2.9

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.
@@ -162,6 +162,7 @@ const index = {
162
162
  });
163
163
  const storage = localStorage.getItem("jwtToken") ? localStorage : sessionStorage;
164
164
  if (["microsoft"].includes(storage.getItem("provider"))) {
165
+ console.log("[STRAPI-CUSTOM-AUTH] storage", storage);
165
166
  app.addMenuLink({
166
167
  to: "/custom-logout",
167
168
  icon: icons.SignOut,
@@ -161,6 +161,7 @@ const index = {
161
161
  });
162
162
  const storage = localStorage.getItem("jwtToken") ? localStorage : sessionStorage;
163
163
  if (["microsoft"].includes(storage.getItem("provider"))) {
164
+ console.log("[STRAPI-CUSTOM-AUTH] storage", storage);
164
165
  app.addMenuLink({
165
166
  to: "/custom-logout",
166
167
  icon: SignOut,
@@ -3317,10 +3317,12 @@ async function microsoftSignInCallback(ctx) {
3317
3317
  }
3318
3318
  });
3319
3319
  const groupsList = groupResponse?.data.value;
3320
+ console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback USER groups", groupsList);
3320
3321
  const { mail, givenName, surname } = userResponse?.data;
3321
3322
  const dbUser = await userService.findOneByEmail(mail);
3322
3323
  let activateUser;
3323
3324
  let jwtToken;
3325
+ console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback retrieve roles", await roleService.retrieveMicrosoftUserRole(groupsList, config2));
3324
3326
  console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback: check user existence");
3325
3327
  if (dbUser) {
3326
3328
  console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback: user exists generating token");
@@ -39306,6 +39308,7 @@ var oauth = ({ strapi: strapi2 }) => ({
39306
39308
  renderSignUpSuccess(jwtToken, user, nonce, refreshToken, provider = "custom") {
39307
39309
  const config2 = strapi2.config.get("plugin::strapi-custom-auth");
39308
39310
  const REMEMBER_ME = config2["REMEMBER_ME"];
39311
+ console.log("[STRAPI-CUSTOM-AUTH] Sign up success redirecting to: ", strapi2.config.admin.url);
39309
39312
  let storage = "sessionStorage";
39310
39313
  if (REMEMBER_ME) {
39311
39314
  storage = "localStorage";
@@ -39424,10 +39427,12 @@ var role = ({ strapi: strapi2 }) => ({
39424
39427
  ]);
39425
39428
  const filteredGroups = groupList.filter((group) => allowedGroups.has(group.displayName));
39426
39429
  const dbRoles = await strapi2.db.query("admin::role").findMany();
39430
+ console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback USER strapi roles list", dbRoles);
39427
39431
  const roles2 = filteredGroups.map((group) => {
39428
39432
  const roleName = group.displayName.includes("Admin") ? "admin" : "editor";
39429
39433
  return dbRoles.find((role2) => role2.name.toLowerCase().includes(roleName))?.id;
39430
39434
  }).filter(Boolean);
39435
+ console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback USER strapi roles matched with entra groups", roles2);
39431
39436
  return roles2;
39432
39437
  }
39433
39438
  });
@@ -3302,10 +3302,12 @@ async function microsoftSignInCallback(ctx) {
3302
3302
  }
3303
3303
  });
3304
3304
  const groupsList = groupResponse?.data.value;
3305
+ console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback USER groups", groupsList);
3305
3306
  const { mail, givenName, surname } = userResponse?.data;
3306
3307
  const dbUser = await userService.findOneByEmail(mail);
3307
3308
  let activateUser;
3308
3309
  let jwtToken;
3310
+ console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback retrieve roles", await roleService.retrieveMicrosoftUserRole(groupsList, config2));
3309
3311
  console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback: check user existence");
3310
3312
  if (dbUser) {
3311
3313
  console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback: user exists generating token");
@@ -39291,6 +39293,7 @@ var oauth = ({ strapi: strapi2 }) => ({
39291
39293
  renderSignUpSuccess(jwtToken, user, nonce, refreshToken, provider = "custom") {
39292
39294
  const config2 = strapi2.config.get("plugin::strapi-custom-auth");
39293
39295
  const REMEMBER_ME = config2["REMEMBER_ME"];
39296
+ console.log("[STRAPI-CUSTOM-AUTH] Sign up success redirecting to: ", strapi2.config.admin.url);
39294
39297
  let storage = "sessionStorage";
39295
39298
  if (REMEMBER_ME) {
39296
39299
  storage = "localStorage";
@@ -39409,10 +39412,12 @@ var role = ({ strapi: strapi2 }) => ({
39409
39412
  ]);
39410
39413
  const filteredGroups = groupList.filter((group) => allowedGroups.has(group.displayName));
39411
39414
  const dbRoles = await strapi2.db.query("admin::role").findMany();
39415
+ console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback USER strapi roles list", dbRoles);
39412
39416
  const roles2 = filteredGroups.map((group) => {
39413
39417
  const roleName = group.displayName.includes("Admin") ? "admin" : "editor";
39414
39418
  return dbRoles.find((role2) => role2.name.toLowerCase().includes(roleName))?.id;
39415
39419
  }).filter(Boolean);
39420
+ console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback USER strapi roles matched with entra groups", roles2);
39416
39421
  return roles2;
39417
39422
  }
39418
39423
  });
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.8",
2
+ "version": "1.2.9",
3
3
  "keywords": [],
4
4
  "type": "commonjs",
5
5
  "exports": {