Skip to content

Commit 0992f80

Browse files
committed
feat: short internal name for "oidc" plugin
1 parent 2eb75d1 commit 0992f80

24 files changed

Lines changed: 38 additions & 48 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ Just put the following in your `config/plugins.ts`.
2222

2323
```ts
2424
export default ({ env }) => ({
25-
"strapi-plugin-oidc": {
25+
"oidc": {
2626
enabled: true,
2727
config: {
2828
// Either sets token to session storage if false or local storage if true
2929
REMEMBER_ME: false,
3030

3131
// OpenID Connect
32-
OIDC_REDIRECT_URI: "https://your-strapi/api/strapi-plugin-oidc/callback",
32+
OIDC_REDIRECT_URI: "https://your-strapi/api/oidc/callback",
3333
OIDC_CLIENT_ID: "[Client ID from the provider]",
3434
OIDC_CLIENT_SECRET: "[Client secret from the provider]",
3535
OIDC_AUTHORIZATION_ENDPOINT: "[API Endpoint]",
@@ -72,7 +72,7 @@ export default [
7272
"strapi::security",
7373
"strapi::cors",
7474
// ...
75-
"plugin::strapi-plugin-oidc.block-native-auth",
75+
"plugin::oidc.block-native-auth",
7676
];
7777
```
7878

‎admin/src/OidcLoginPage.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const OidcLoginPage = () => {
1212
const { token } = useAuth("OidcLoginPage", (auth) => auth);
1313

1414
useEffect(() => {
15-
if (!token) window.location.replace("/api/strapi-plugin-oidc/sign-in");
15+
if (!token) window.location.replace("/api/oidc/sign-in");
1616
}, [token]);
1717

1818
if (token) return <Navigate to="/" />;

‎admin/src/index.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ export default {
1818
defaultMessage: "Single Sign-On",
1919
},
2020
Component: () => import("./pages/App"),
21-
permissions: [
22-
{ action: "plugin::strapi-plugin-oidc.read", subject: null },
23-
],
21+
permissions: [{ action: "plugin::oidc.read", subject: null }],
2422
});
2523
app.registerPlugin({ id: PLUGIN_ID, initializer: Initializer, name });
2624
},

‎admin/src/pages/HomePage/index.tsx‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ const HomePage = () => {
1818
const { get, put } = useFetchClient();
1919

2020
useEffect(() => {
21-
get("/strapi-plugin-oidc/sso-roles").then((response) => {
21+
get("/oidc/sso-roles").then((response) => {
2222
setExpression(response.data?.expression ?? "");
2323
});
2424
}, []);
2525

2626
const onSave = async () => {
2727
try {
28-
await put("/strapi-plugin-oidc/sso-roles", { expression });
28+
await put("/oidc/sso-roles", { expression });
2929
setSuccess(true);
3030
setTimeout(() => setSuccess(false), 3000);
3131
} catch (e) {
@@ -37,9 +37,7 @@ const HomePage = () => {
3737

3838
return (
3939
<Page.Protect
40-
permissions={[
41-
{ action: "plugin::strapi-plugin-oidc.read", subject: null },
42-
]}
40+
permissions={[{ action: "plugin::oidc.read", subject: null }]}
4341
>
4442
<Layouts.Header
4543
title="Single Sign On"

‎admin/src/pluginId.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import pluginPkg from "../../package.json";
22

3-
const PLUGIN_ID = pluginPkg.name.replace(/^@strapi\/plugin-/i, "");
3+
const PLUGIN_ID = pluginPkg.strapi.name;
44

55
export default PLUGIN_ID;

‎compose.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
- OIDC_AUTHORIZATION_ENDPOINT=https://${AUTH_DOMAIN}/api/oidc/authorization
77
- OIDC_TOKEN_ENDPOINT=https://${AUTH_DOMAIN}/api/oidc/token
88
- OIDC_USER_INFO_ENDPOINT=https://${AUTH_DOMAIN}/api/oidc/userinfo
9-
- OIDC_REDIRECT_URI=https://${CMS_DOMAIN}/api/strapi-plugin-oidc/callback
9+
- OIDC_REDIRECT_URI=https://${CMS_DOMAIN}/api/oidc/callback
1010
# TODO Should we load the client ID + secret from secrets instead?
1111
- OIDC_CLIENT_ID=onbU2exrz2I0RCJRrXsCQj49dgLFHLppCekGGdKmBaQ_7MWpAKcnylw6kO-7lUhsUtzmGJM8
1212
- OIDC_CLIENT_SECRET=yebsr4POK_hXenANvvo4DAHBGPIP_3a0

‎config/authelia/configuration.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ identity_providers:
1313
client_name: 'Strapi'
1414
client_secret: '{{ secret "/run/secrets/oidc_strapi_digest" }}'
1515
redirect_uris:
16-
- https://{{ mustEnv "CMS_DOMAIN" }}/api/strapi-plugin-oidc/callback
16+
- https://{{ mustEnv "CMS_DOMAIN" }}/api/oidc/callback
1717
scopes:
1818
- 'email'
1919
- 'groups'

‎cypress/e2e/login.cy.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import pluginPkg from "../../package.json";
44

55
const CMS = "https://cms.strapi.local";
66
const IDP = "https://auth.strapi.local";
7-
const PLUGIN_ID = pluginPkg.name.replace(/^@strapi\/plugin-/i, "");
7+
const PLUGIN_ID = pluginPkg.strapi.name;
88

99
describe("SSO plugin", () => {
1010
describe("OIDC sign-in", () => {

‎cypress/support/commands.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Cypress.Commands.add("loginAs", (username, password) => {
1919
AUTHELIA_STACK.idp,
2020
{ args: { cms: AUTHELIA_STACK.cms, username, password } },
2121
({ cms, username, password }) => {
22-
cy.visit(`${cms}/api/strapi-plugin-oidc/sign-in`);
22+
cy.visit(`${cms}/api/oidc/sign-in`);
2323
cy.get("#username-textfield").type(username);
2424
cy.get("#password-textfield").type(password);
2525
cy.get("#sign-in-button").click();

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Plug-in for single sign-on with Strapi!",
55
"strapi": {
66
"displayName": "Single Sign On",
7-
"name": "strapi-plugin-oidc",
7+
"name": "oidc",
88
"description": "Version 5 enables single sign-on",
99
"kind": "plugin"
1010
},

0 commit comments

Comments
 (0)