strapi-plugin-oidc 1.2.1 → 1.2.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.
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.
@@ -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-DdOqXIiR.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;
@@ -192,10 +195,17 @@ const index = {
192
195
  patchHistory();
193
196
  } else {
194
197
  localStorage.removeItem(ENFORCE_CACHE_KEY);
195
- startSSOButtonObserver();
198
+ document.documentElement.style.visibility = "";
199
+ if (data.showSSOButton !== false) {
200
+ ssoButtonText = data.ssoButtonText || en["login.sso"];
201
+ startSSOButtonObserver();
202
+ } else {
203
+ stopSSOButtonObserver();
204
+ }
196
205
  }
197
206
  }
198
207
  } catch (error) {
208
+ document.documentElement.style.visibility = "";
199
209
  console.error("Failed to check OIDC enforcement setting:", error);
200
210
  }
201
211
  };
@@ -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-DDF1gGuH.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;
@@ -191,10 +194,17 @@ const index = {
191
194
  patchHistory();
192
195
  } else {
193
196
  localStorage.removeItem(ENFORCE_CACHE_KEY);
194
- startSSOButtonObserver();
197
+ document.documentElement.style.visibility = "";
198
+ if (data.showSSOButton !== false) {
199
+ ssoButtonText = data.ssoButtonText || en["login.sso"];
200
+ startSSOButtonObserver();
201
+ } else {
202
+ stopSSOButtonObserver();
203
+ }
195
204
  }
196
205
  }
197
206
  } catch (error) {
207
+ document.documentElement.style.visibility = "";
198
208
  console.error("Failed to check OIDC enforcement setting:", error);
199
209
  }
200
210
  };
@@ -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-CyqfIFcE.mjs";
9
9
  import styled from "styled-components";
10
10
  function getTrad(id) {
11
11
  const pluginIdWithId = `${pluginId}.${id}`;
@@ -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-C5Zb3Oi6.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);
@@ -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-C5Zb3Oi6.js");
4
4
  exports.default = index.index;
@@ -1,4 +1,4 @@
1
- import { i } from "./index-DEfdDZQV.mjs";
1
+ import { i } from "./index-CyqfIFcE.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.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",