strapi-plugin-oidc 1.2.1 → 1.2.3

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.
package/README.md CHANGED
@@ -102,4 +102,5 @@ This plugin is a hard fork of the original [`strapi-plugin-sso`](https://github.
102
102
  - Cleaned up dead code and unused dependencies to improve maintainability.
103
103
  - Upgraded to use newer versions of Node.js.
104
104
  - Added styled success and error pages.
105
+ - Added an optional "Login via SSO" button on the Strapi login page, allowing users to authenticate via OIDC without enforcing it for everyone. Button text is configurable from the admin settings.
105
106
  - Added misc. quality of life improvements and bug fixes.
@@ -98,7 +98,7 @@ const index = {
98
98
  defaultMessage: "Configuration"
99
99
  },
100
100
  Component: async () => {
101
- return await import("./index-Dua1LXcu.mjs");
101
+ return await import("./index-DuJfeoFu.mjs");
102
102
  },
103
103
  permissions: [{ action: "plugin::strapi-plugin-oidc.read", subject: null }]
104
104
  }
@@ -126,6 +126,7 @@ const index = {
126
126
  if (isLogoutInProgress) {
127
127
  return;
128
128
  }
129
+ document.documentElement.style.visibility = "hidden";
129
130
  window.location.href = "/strapi-plugin-oidc/oidc";
130
131
  return;
131
132
  }
@@ -136,11 +137,13 @@ const index = {
136
137
  window.history.pushState = interceptHistory(window.history.pushState);
137
138
  window.history.replaceState = interceptHistory(window.history.replaceState);
138
139
  if (isAuthRoute(window.location.pathname)) {
140
+ document.documentElement.style.visibility = "hidden";
139
141
  window.location.replace("/strapi-plugin-oidc/oidc");
140
142
  }
141
143
  };
142
144
  let ssoButtonInjected = false;
143
145
  let ssoObserver = null;
146
+ let ssoButtonText = en["login.sso"];
144
147
  const injectSSOButton = () => {
145
148
  if (ssoButtonInjected) return;
146
149
  if (!isAuthRoute(window.location.pathname)) return;
@@ -158,7 +161,7 @@ const index = {
158
161
  const innerSpan = submitButton.querySelector("span");
159
162
  const span = document.createElement("span");
160
163
  if (innerSpan) span.className = innerSpan.className;
161
- span.textContent = en["login.sso"];
164
+ span.textContent = ssoButtonText;
162
165
  btn.appendChild(span);
163
166
  submitButton.parentNode.insertBefore(btn, submitButton.nextSibling);
164
167
  ssoButtonInjected = true;
@@ -180,6 +183,9 @@ const index = {
180
183
  if (localStorage.getItem(ENFORCE_CACHE_KEY) === "1") {
181
184
  patchHistory();
182
185
  }
186
+ if (isAuthRoute(window.location.pathname)) {
187
+ document.documentElement.style.visibility = "hidden";
188
+ }
183
189
  const checkEnforceOIDC = async () => {
184
190
  try {
185
191
  const response = await window.fetch("/strapi-plugin-oidc/settings/public");
@@ -191,10 +197,17 @@ const index = {
191
197
  patchHistory();
192
198
  } else {
193
199
  localStorage.removeItem(ENFORCE_CACHE_KEY);
194
- startSSOButtonObserver();
200
+ document.documentElement.style.visibility = "";
201
+ if (data.showSSOButton !== false) {
202
+ ssoButtonText = data.ssoButtonText || en["login.sso"];
203
+ startSSOButtonObserver();
204
+ } else {
205
+ stopSSOButtonObserver();
206
+ }
195
207
  }
196
208
  }
197
209
  } catch (error) {
210
+ document.documentElement.style.visibility = "";
198
211
  console.error("Failed to check OIDC enforcement setting:", error);
199
212
  }
200
213
  };
@@ -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-BJPMfkrf.js");
10
+ const index = require("./index-ENl8_IZn.js");
11
11
  const styled = require("styled-components");
12
12
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
13
13
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
@@ -5,7 +5,7 @@ import { useState, useCallback, useEffect, memo } from "react";
5
5
  import { Typography, Flex, Box, MultiSelect, MultiSelectOption, Field, Button, Divider, Thead, Tr, Th, Tbody, Td, Dialog, IconButton, Pagination, PreviousLink, PageLink, NextLink, Table, Alert, TextInput } from "@strapi/design-system";
6
6
  import { Plus, Trash, WarningCircle } from "@strapi/icons";
7
7
  import { useIntl } from "react-intl";
8
- import { e as en, p as pluginId } from "./index-DEfdDZQV.mjs";
8
+ import { e as en, p as pluginId } from "./index-CZ_FdaEz.mjs";
9
9
  import styled from "styled-components";
10
10
  function getTrad(id) {
11
11
  const pluginIdWithId = `${pluginId}.${id}`;
@@ -99,7 +99,7 @@ const index = {
99
99
  defaultMessage: "Configuration"
100
100
  },
101
101
  Component: async () => {
102
- return await Promise.resolve().then(() => require("./index-CQSLiYnE.js"));
102
+ return await Promise.resolve().then(() => require("./index-DZwncy7E.js"));
103
103
  },
104
104
  permissions: [{ action: "plugin::strapi-plugin-oidc.read", subject: null }]
105
105
  }
@@ -127,6 +127,7 @@ const index = {
127
127
  if (isLogoutInProgress) {
128
128
  return;
129
129
  }
130
+ document.documentElement.style.visibility = "hidden";
130
131
  window.location.href = "/strapi-plugin-oidc/oidc";
131
132
  return;
132
133
  }
@@ -137,11 +138,13 @@ const index = {
137
138
  window.history.pushState = interceptHistory(window.history.pushState);
138
139
  window.history.replaceState = interceptHistory(window.history.replaceState);
139
140
  if (isAuthRoute(window.location.pathname)) {
141
+ document.documentElement.style.visibility = "hidden";
140
142
  window.location.replace("/strapi-plugin-oidc/oidc");
141
143
  }
142
144
  };
143
145
  let ssoButtonInjected = false;
144
146
  let ssoObserver = null;
147
+ let ssoButtonText = en["login.sso"];
145
148
  const injectSSOButton = () => {
146
149
  if (ssoButtonInjected) return;
147
150
  if (!isAuthRoute(window.location.pathname)) return;
@@ -159,7 +162,7 @@ const index = {
159
162
  const innerSpan = submitButton.querySelector("span");
160
163
  const span = document.createElement("span");
161
164
  if (innerSpan) span.className = innerSpan.className;
162
- span.textContent = en["login.sso"];
165
+ span.textContent = ssoButtonText;
163
166
  btn.appendChild(span);
164
167
  submitButton.parentNode.insertBefore(btn, submitButton.nextSibling);
165
168
  ssoButtonInjected = true;
@@ -181,6 +184,9 @@ const index = {
181
184
  if (localStorage.getItem(ENFORCE_CACHE_KEY) === "1") {
182
185
  patchHistory();
183
186
  }
187
+ if (isAuthRoute(window.location.pathname)) {
188
+ document.documentElement.style.visibility = "hidden";
189
+ }
184
190
  const checkEnforceOIDC = async () => {
185
191
  try {
186
192
  const response = await window.fetch("/strapi-plugin-oidc/settings/public");
@@ -192,10 +198,17 @@ const index = {
192
198
  patchHistory();
193
199
  } else {
194
200
  localStorage.removeItem(ENFORCE_CACHE_KEY);
195
- startSSOButtonObserver();
201
+ document.documentElement.style.visibility = "";
202
+ if (data.showSSOButton !== false) {
203
+ ssoButtonText = data.ssoButtonText || en["login.sso"];
204
+ startSSOButtonObserver();
205
+ } else {
206
+ stopSSOButtonObserver();
207
+ }
196
208
  }
197
209
  }
198
210
  } catch (error) {
211
+ document.documentElement.style.visibility = "";
199
212
  console.error("Failed to check OIDC enforcement setting:", error);
200
213
  }
201
214
  };
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const index = require("./index-BJPMfkrf.js");
3
+ const index = require("./index-ENl8_IZn.js");
4
4
  exports.default = index.index;
@@ -1,4 +1,4 @@
1
- import { i } from "./index-DEfdDZQV.mjs";
1
+ import { i } from "./index-CZ_FdaEz.mjs";
2
2
  export {
3
3
  i as default
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-plugin-oidc",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
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",