strapi-plugin-oidc 1.10.1 → 1.10.2

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-iTiehRZW.js")),
215
+ Component: () => Promise.resolve().then(() => require("./index-DN2ccKqO.js")),
216
216
  permissions: [{ action: PERMISSIONS.READ, subject: null }]
217
217
  };
218
218
  app.addSettingsLink(
@@ -233,8 +233,8 @@ const index = {
233
233
  },
234
234
  bootstrap() {
235
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)) {
236
+ const isServerBounce = window.location.search.includes("oidc_redirect=1");
237
+ if (!isServerBounce && isAuthRoute(window.location.pathname)) {
238
238
  window.location.replace(OIDC_SIGN_IN_PATH);
239
239
  return;
240
240
  }
@@ -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-BF9ZcATc.js");
10
+ const index = require("./index-B-sTTO3a.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 };
@@ -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-CpOrxYA4.mjs";
8
+ import { g as getTrad, E as EMAIL_REGEX, e as en, A as AUDIT_LOG_DEFAULTS, U as UI_DEFAULTS } from "./index-DnhzQm30.mjs";
9
9
  import styled from "styled-components";
10
10
  import { Filter, ClipboardList, Server } from "lucide-react";
11
11
  function Role({ oidcRoles, roles, onChangeRole }) {
@@ -209,7 +209,7 @@ const index = {
209
209
  id: "settings.configuration",
210
210
  defaultMessage: "Configuration"
211
211
  },
212
- Component: () => import("./index-DH-_mRbC.mjs"),
212
+ Component: () => import("./index-Dn8QUbkK.mjs"),
213
213
  permissions: [{ action: PERMISSIONS.READ, subject: null }]
214
214
  };
215
215
  app.addSettingsLink(
@@ -230,8 +230,8 @@ const index = {
230
230
  },
231
231
  bootstrap() {
232
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)) {
233
+ const isServerBounce = window.location.search.includes("oidc_redirect=1");
234
+ if (!isServerBounce && isAuthRoute(window.location.pathname)) {
235
235
  window.location.replace(OIDC_SIGN_IN_PATH);
236
236
  return;
237
237
  }
@@ -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-BF9ZcATc.js");
3
+ const index = require("./index-B-sTTO3a.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-CpOrxYA4.mjs";
1
+ import { i } from "./index-DnhzQm30.mjs";
2
2
  import "react";
3
3
  import "react-dom/client";
4
4
  export {
@@ -254,8 +254,7 @@ 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",
258
- skipLoginPage: "oidc_skip_login_page"
257
+ authenticated: "oidc_authenticated"
259
258
  };
260
259
  function shouldMarkSecure(strapi2, ctx) {
261
260
  const isProduction = strapi2.config.get("environment") === "production";
@@ -308,17 +307,7 @@ async function bootstrap({ strapi: strapi2 }) {
308
307
  const isAuthRoute = AUTH_ROUTES.some((r) => path.includes(r));
309
308
  const isTokenRefresh = path === tokenRefreshPath;
310
309
  const config2 = getPluginConfig();
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)) {
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)) {
322
311
  ctx.redirect(OIDC_SIGN_IN_PATH);
323
312
  return;
324
313
  }
@@ -3618,7 +3607,13 @@ function t(locale, key, fallback) {
3618
3607
  }
3619
3608
  async function oidcSignIn(ctx) {
3620
3609
  try {
3621
- const { OIDC_CLIENT_ID, OIDC_REDIRECT_URI, OIDC_SCOPE, OIDC_AUTHORIZATION_ENDPOINT } = configValidation();
3610
+ const config2 = configValidation();
3611
+ if (!config2.OIDC_SKIP_LOGIN_PAGE) {
3612
+ const adminUrl = strapi.config.get("admin.url", "/admin");
3613
+ ctx.redirect(`${adminUrl}/auth/login?oidc_redirect=1`);
3614
+ return;
3615
+ }
3616
+ const { OIDC_CLIENT_ID, OIDC_REDIRECT_URI, OIDC_SCOPE, OIDC_AUTHORIZATION_ENDPOINT } = config2;
3622
3617
  const { code_verifier: codeVerifier, code_challenge: codeChallenge } = await pkceChallenge__default.default();
3623
3618
  const state = node_crypto.randomBytes(32).toString("base64url");
3624
3619
  const nonce = node_crypto.randomBytes(32).toString("base64url");
@@ -248,8 +248,7 @@ 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",
252
- skipLoginPage: "oidc_skip_login_page"
251
+ authenticated: "oidc_authenticated"
253
252
  };
254
253
  function shouldMarkSecure(strapi2, ctx) {
255
254
  const isProduction = strapi2.config.get("environment") === "production";
@@ -302,17 +301,7 @@ async function bootstrap({ strapi: strapi2 }) {
302
301
  const isAuthRoute = AUTH_ROUTES.some((r) => path.includes(r));
303
302
  const isTokenRefresh = path === tokenRefreshPath;
304
303
  const config2 = getPluginConfig();
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)) {
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)) {
316
305
  ctx.redirect(OIDC_SIGN_IN_PATH);
317
306
  return;
318
307
  }
@@ -3612,7 +3601,13 @@ function t(locale, key, fallback) {
3612
3601
  }
3613
3602
  async function oidcSignIn(ctx) {
3614
3603
  try {
3615
- const { OIDC_CLIENT_ID, OIDC_REDIRECT_URI, OIDC_SCOPE, OIDC_AUTHORIZATION_ENDPOINT } = configValidation();
3604
+ const config2 = configValidation();
3605
+ if (!config2.OIDC_SKIP_LOGIN_PAGE) {
3606
+ const adminUrl = strapi.config.get("admin.url", "/admin");
3607
+ ctx.redirect(`${adminUrl}/auth/login?oidc_redirect=1`);
3608
+ return;
3609
+ }
3610
+ const { OIDC_CLIENT_ID, OIDC_REDIRECT_URI, OIDC_SCOPE, OIDC_AUTHORIZATION_ENDPOINT } = config2;
3616
3611
  const { code_verifier: codeVerifier, code_challenge: codeChallenge } = await pkceChallenge();
3617
3612
  const state = randomBytes(32).toString("base64url");
3618
3613
  const nonce = randomBytes(32).toString("base64url");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-plugin-oidc",
3
- "version": "1.10.1",
3
+ "version": "1.10.2",
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",