This commit is contained in:
2024-10-29 05:37:46 +01:00
commit fe33c5f123
34 changed files with 20148 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
diff --git a/node_modules/@strapi/plugin-users-permissions/server/bootstrap/grant-config.js b/node_modules/@strapi/plugin-users-permissions/server/bootstrap/grant-config.js
index 013e92c..720ce69 100644
--- a/node_modules/@strapi/plugin-users-permissions/server/bootstrap/grant-config.js
+++ b/node_modules/@strapi/plugin-users-permissions/server/bootstrap/grant-config.js
@@ -137,4 +137,12 @@ module.exports = (baseURL) => ({
callback: `${baseURL}/keycloak/callback`,
scope: ['openid', 'email', 'profile'],
},
+ trompette: {
+ enabled: true,
+ icon: '',
+ key: '',
+ secret: '',
+ callback: `${baseURL}/trompette/callback`,
+ scope:['openid', 'email', 'profile']
+ }
});
diff --git a/node_modules/@strapi/plugin-users-permissions/server/services/providers-registry.js b/node_modules/@strapi/plugin-users-permissions/server/services/providers-registry.js
index a559971..d0c508d 100644
--- a/node_modules/@strapi/plugin-users-permissions/server/services/providers-registry.js
+++ b/node_modules/@strapi/plugin-users-permissions/server/services/providers-registry.js
@@ -347,6 +347,21 @@ const getInitialProviders = ({ purest }) => ({
};
});
},
+ async trompette({ accessToken }) {
+ const trompette = purest({ provider: 'trompette' });
+ //const { body: userBody } = await trompette.get('user').auth(accessToken).request();
+
+ return keycloak
+ .get('user')
+ .auth(accessToken)
+ .request()
+ .then(({ body }) => {
+ return {
+ username: body.preferred_username,
+ email: body.email,
+ };
+ });
+ }
});
module.exports = () => {
@@ -373,3 +388,4 @@ module.exports = () => {
},
};
};
+

View File

@@ -0,0 +1,31 @@
diff --git a/node_modules/grant/config/oauth.json b/node_modules/grant/config/oauth.json
index 54afd00..4a2ba1e 100644
--- a/node_modules/grant/config/oauth.json
+++ b/node_modules/grant/config/oauth.json
@@ -1179,5 +1179,11 @@
"access_url": "https://zoom.us/oauth/token",
"oauth": 2,
"scope_delimiter": " "
- }
+ },
+ "trompette": {
+ "authorize_url": "https://trompette.espace120.fr/oauth/v2/authorize",
+ "access_url": "https://trompette.espace120.fr/oauth/v2/token",
+ "oauth": 2,
+ "scope_delimiter": " "
+ }
}
diff --git a/node_modules/grant/config/profile.json b/node_modules/grant/config/profile.json
index c5956c1..e9fe3f5 100644
--- a/node_modules/grant/config/profile.json
+++ b/node_modules/grant/config/profile.json
@@ -634,5 +634,8 @@
},
"zoom": {
"profile_url": "https://api.zoom.us/v2/users/me"
- }
+ },
+ "trompette": {
+ "profile_url": "https://trompette.espace120.fr/oidc/v1/userinfo"
+ }
}

View File

@@ -0,0 +1,24 @@
diff --git a/node_modules/purest/config/providers.json b/node_modules/purest/config/providers.json
index 8dd1dae..d0e5784 100644
--- a/node_modules/purest/config/providers.json
+++ b/node_modules/purest/config/providers.json
@@ -2784,5 +2784,19 @@
"authorization": "Bearer {auth}"
}
}
+ },
+ "trompette": {
+ "default": {
+ "origin": "",
+ "path": "",
+ "headers": {
+ "authorization": "Bearer {auth}"
+ }
+ },
+ "oauth": {
+ "origin": "https://trompette.espace120.fr",
+ "path": "oauth/{version}/{path}",
+ "version": "v2"
+ }
}
}