strapi-plugin-oidc 1.10.0 → 1.10.1

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.
@@ -212,7 +212,7 @@ const index = {
212
212
  id: "settings.configuration",
213
213
  defaultMessage: "Configuration"
214
214
  },
215
- Component: () => Promise.resolve().then(() => require("./index-8VB7hT1F.js")),
215
+ Component: () => Promise.resolve().then(() => require("./index-iTiehRZW.js")),
216
216
  permissions: [{ action: PERMISSIONS.READ, subject: null }]
217
217
  };
218
218
  app.addSettingsLink(
@@ -232,11 +232,16 @@ const index = {
232
232
  });
233
233
  },
234
234
  bootstrap() {
235
+ const isAuthRoute = (path) => /\/auth\/(login|register|forgot-password|reset-password)/.test(path);
236
+ const hasSkipCookie = document.cookie.split(";").some((c) => c.trim() === "oidc_skip_login_page=1");
237
+ if (hasSkipCookie && isAuthRoute(window.location.pathname)) {
238
+ window.location.replace(OIDC_SIGN_IN_PATH);
239
+ return;
240
+ }
235
241
  const overlayContainer = document.createElement("div");
236
242
  document.body.appendChild(overlayContainer);
237
243
  client.createRoot(overlayContainer).render(React__default.default.createElement(LogoutOverlay));
238
244
  const defaultButtonText = t("login.sso");
239
- const isAuthRoute = (path) => /\/auth\/(login|register|forgot-password|reset-password)/.test(path);
240
245
  let ssoButtonInjected = false;
241
246
  let domObserver = null;
242
247
  const injectSSOButton = (buttonText) => {
@@ -209,7 +209,7 @@ const index = {
209
209
  id: "settings.configuration",
210
210
  defaultMessage: "Configuration"
211
211
  },
212
- Component: () => import("./index-DMJjpSUm.mjs"),
212
+ Component: () => import("./index-DH-_mRbC.mjs"),
213
213
  permissions: [{ action: PERMISSIONS.READ, subject: null }]
214
214
  };
215
215
  app.addSettingsLink(
@@ -229,11 +229,16 @@ const index = {
229
229
  });
230
230
  },
231
231
  bootstrap() {
232
+ const isAuthRoute = (path) => /\/auth\/(login|register|forgot-password|reset-password)/.test(path);
233
+ const hasSkipCookie = document.cookie.split(";").some((c) => c.trim() === "oidc_skip_login_page=1");
234
+ if (hasSkipCookie && isAuthRoute(window.location.pathname)) {
235
+ window.location.replace(OIDC_SIGN_IN_PATH);
236
+ return;
237
+ }
232
238
  const overlayContainer = document.createElement("div");
233
239
  document.body.appendChild(overlayContainer);
234
240
  createRoot(overlayContainer).render(React.createElement(LogoutOverlay));
235
241
  const defaultButtonText = t("login.sso");
236
- const isAuthRoute = (path) => /\/auth\/(login|register|forgot-password|reset-password)/.test(path);
237
242
  let ssoButtonInjected = false;
238
243
  let domObserver = null;
239
244
  const injectSSOButton = (buttonText) => {
@@ -5,7 +5,7 @@ import { useState, useRef, useId, useEffect, useCallback, useReducer, useMemo, m
5
5
  import { Typography, Flex, Box, MultiSelect, MultiSelectOption, Button, Dialog, Table, Pagination, PreviousLink, NextLink, PageLink, Field, Divider, Thead, Tr, Th, Tbody, Td, IconButton, Loader, Tooltip, Alert } from "@strapi/design-system";
6
6
  import { Cross, WarningCircle, Plus, Download, Upload, Trash, Calendar, Mail, Information } from "@strapi/icons";
7
7
  import { useIntl } from "react-intl";
8
- import { g as getTrad, E as EMAIL_REGEX, e as en, A as AUDIT_LOG_DEFAULTS, U as UI_DEFAULTS } from "./index-CbB2ZVt6.mjs";
8
+ import { g as getTrad, E as EMAIL_REGEX, e as en, A as AUDIT_LOG_DEFAULTS, U as UI_DEFAULTS } from "./index-CpOrxYA4.mjs";
9
9
  import styled from "styled-components";
10
10
  import { Filter, ClipboardList, Server } from "lucide-react";
11
11
  function Role({ oidcRoles, roles, onChangeRole }) {
@@ -7,7 +7,7 @@ const React = require("react");
7
7
  const designSystem = require("@strapi/design-system");
8
8
  const icons = require("@strapi/icons");
9
9
  const reactIntl = require("react-intl");
10
- const index = require("./index-CWvZ9OH0.js");
10
+ const index = require("./index-BF9ZcATc.js");
11
11
  const styled = require("styled-components");
12
12
  const lucideReact = require("lucide-react");
13
13
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const index = require("./index-CWvZ9OH0.js");
3
+ const index = require("./index-BF9ZcATc.js");
4
4
  require("react");
5
5
  require("react-dom/client");
6
6
  exports.default = index.index;
@@ -1,4 +1,4 @@
1
- import { i } from "./index-CbB2ZVt6.mjs";
1
+ import { i } from "./index-CpOrxYA4.mjs";
2
2
  import "react";
3
3
  import "react-dom/client";
4
4
  export {
@@ -254,7 +254,8 @@ const COOKIE_NAMES = {
254
254
  accessToken: "oidc_access_token",
255
255
  userEmail: "oidc_user_email",
256
256
  adminRefresh: "strapi_admin_refresh",
257
- authenticated: "oidc_authenticated"
257
+ authenticated: "oidc_authenticated",
258
+ skipLoginPage: "oidc_skip_login_page"
258
259
  };
259
260
  function shouldMarkSecure(strapi2, ctx) {
260
261
  const isProduction = strapi2.config.get("environment") === "production";
@@ -307,7 +308,17 @@ async function bootstrap({ strapi: strapi2 }) {
307
308
  const isAuthRoute = AUTH_ROUTES.some((r) => path.includes(r));
308
309
  const isTokenRefresh = path === tokenRefreshPath;
309
310
  const config2 = getPluginConfig();
310
- if (config2.OIDC_SKIP_LOGIN_PAGE && ctx.request.method === "GET" && (path === adminUrl || path.startsWith(`${adminUrl}/`)) && !EXCLUDED_ADMIN_PATHS.includes(path) && !STATIC_EXTENSIONS.some((ext) => path.endsWith(ext)) && !ctx.cookies.get(COOKIE_NAMES.adminRefresh)) {
311
+ const isAdminPage = ctx.request.method === "GET" && (path === adminUrl || path.startsWith(`${adminUrl}/`)) && !STATIC_EXTENSIONS.some((ext) => path.endsWith(ext));
312
+ if (isAdminPage) {
313
+ ctx.cookies.set(COOKIE_NAMES.skipLoginPage, config2.OIDC_SKIP_LOGIN_PAGE ? "1" : "0", {
314
+ httpOnly: false,
315
+ signed: false,
316
+ sameSite: "lax",
317
+ path: adminUrl,
318
+ secure: false
319
+ });
320
+ }
321
+ if (config2.OIDC_SKIP_LOGIN_PAGE && isAdminPage && !EXCLUDED_ADMIN_PATHS.includes(path) && !ctx.cookies.get(COOKIE_NAMES.adminRefresh)) {
311
322
  ctx.redirect(OIDC_SIGN_IN_PATH);
312
323
  return;
313
324
  }
@@ -248,7 +248,8 @@ const COOKIE_NAMES = {
248
248
  accessToken: "oidc_access_token",
249
249
  userEmail: "oidc_user_email",
250
250
  adminRefresh: "strapi_admin_refresh",
251
- authenticated: "oidc_authenticated"
251
+ authenticated: "oidc_authenticated",
252
+ skipLoginPage: "oidc_skip_login_page"
252
253
  };
253
254
  function shouldMarkSecure(strapi2, ctx) {
254
255
  const isProduction = strapi2.config.get("environment") === "production";
@@ -301,7 +302,17 @@ async function bootstrap({ strapi: strapi2 }) {
301
302
  const isAuthRoute = AUTH_ROUTES.some((r) => path.includes(r));
302
303
  const isTokenRefresh = path === tokenRefreshPath;
303
304
  const config2 = getPluginConfig();
304
- if (config2.OIDC_SKIP_LOGIN_PAGE && ctx.request.method === "GET" && (path === adminUrl || path.startsWith(`${adminUrl}/`)) && !EXCLUDED_ADMIN_PATHS.includes(path) && !STATIC_EXTENSIONS.some((ext) => path.endsWith(ext)) && !ctx.cookies.get(COOKIE_NAMES.adminRefresh)) {
305
+ const isAdminPage = ctx.request.method === "GET" && (path === adminUrl || path.startsWith(`${adminUrl}/`)) && !STATIC_EXTENSIONS.some((ext) => path.endsWith(ext));
306
+ if (isAdminPage) {
307
+ ctx.cookies.set(COOKIE_NAMES.skipLoginPage, config2.OIDC_SKIP_LOGIN_PAGE ? "1" : "0", {
308
+ httpOnly: false,
309
+ signed: false,
310
+ sameSite: "lax",
311
+ path: adminUrl,
312
+ secure: false
313
+ });
314
+ }
315
+ if (config2.OIDC_SKIP_LOGIN_PAGE && isAdminPage && !EXCLUDED_ADMIN_PATHS.includes(path) && !ctx.cookies.get(COOKIE_NAMES.adminRefresh)) {
305
316
  ctx.redirect(OIDC_SIGN_IN_PATH);
306
317
  return;
307
318
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-plugin-oidc",
3
- "version": "1.10.0",
3
+ "version": "1.10.1",
4
4
  "description": "A Strapi plugin that provides OpenID Connect (OIDC) authentication functionality for the Strapi Admin Panel.",
5
5
  "strapi": {
6
6
  "displayName": "OIDC Plugin",