strapi-plugin-oidc 1.10.0 → 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-8VB7hT1F.js")),
215
+ Component: () => Promise.resolve().then(() => require("./index-DN2ccKqO.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 isServerBounce = window.location.search.includes("oidc_redirect=1");
237
+ if (!isServerBounce && 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) => {
@@ -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-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-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-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-DMJjpSUm.mjs"),
212
+ Component: () => import("./index-Dn8QUbkK.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 isServerBounce = window.location.search.includes("oidc_redirect=1");
234
+ if (!isServerBounce && 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) => {
@@ -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-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-CbB2ZVt6.mjs";
1
+ import { i } from "./index-DnhzQm30.mjs";
2
2
  import "react";
3
3
  import "react-dom/client";
4
4
  export {
@@ -3607,7 +3607,13 @@ function t(locale, key, fallback) {
3607
3607
  }
3608
3608
  async function oidcSignIn(ctx) {
3609
3609
  try {
3610
- 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;
3611
3617
  const { code_verifier: codeVerifier, code_challenge: codeChallenge } = await pkceChallenge__default.default();
3612
3618
  const state = node_crypto.randomBytes(32).toString("base64url");
3613
3619
  const nonce = node_crypto.randomBytes(32).toString("base64url");
@@ -3601,7 +3601,13 @@ function t(locale, key, fallback) {
3601
3601
  }
3602
3602
  async function oidcSignIn(ctx) {
3603
3603
  try {
3604
- 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;
3605
3611
  const { code_verifier: codeVerifier, code_challenge: codeChallenge } = await pkceChallenge();
3606
3612
  const state = randomBytes(32).toString("base64url");
3607
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.0",
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",