mirror of
https://github.com/YunoHost-Apps/outline_ynh.git
synced 2024-09-03 19:56:12 +02:00
Test
This commit is contained in:
parent
def1b6deb9
commit
e110e7c200
2 changed files with 7 additions and 84 deletions
|
@ -155,93 +155,16 @@ index ada9fc0be..62d550282 100644
|
|||
"prosemirror-commands": "^1.5.2",
|
||||
diff --git a/plugins/req/plugin.json b/plugins/req/plugin.json
|
||||
new file mode 100644
|
||||
index 000000000..bf4c23043
|
||||
index 000000000..88780ccd7
|
||||
--- /dev/null
|
||||
+++ b/plugins/req/plugin.json
|
||||
@@ -0,0 +1,6 @@
|
||||
+{
|
||||
+ "id": "visiteur",
|
||||
+ "id": "req",
|
||||
+ "name": "visiteur",
|
||||
+ "priority": 30,
|
||||
+ "description": "Adds an req compatible authentication provider."
|
||||
+}
|
||||
diff --git a/plugins/req/server/auth/req.ts b/plugins/req/server/auth/req.ts
|
||||
new file mode 100644
|
||||
index 000000000..6fca14d54
|
||||
--- /dev/null
|
||||
+++ b/plugins/req/server/auth/req.ts
|
||||
@@ -0,0 +1,70 @@
|
||||
+import passport from "@outlinewiki/koa-passport";
|
||||
+import type { Context } from "koa";
|
||||
+import Router from "koa-router";
|
||||
+import { capitalize } from "lodash";
|
||||
+import { Strategy as ReqStrategy } from "passport-req";
|
||||
+import { slugifyDomain } from "@shared/utils/domains";
|
||||
+import accountProvisioner from "@server/commands/accountProvisioner";
|
||||
+import passportMiddleware from "@server/middlewares/passport";
|
||||
+import { User } from "@server/models";
|
||||
+import { AuthenticationResult } from "@server/types";
|
||||
+import {
|
||||
+ StateStore,
|
||||
+ getTeamFromContext,
|
||||
+ getClientFromContext,
|
||||
+} from "@server/utils/passport";
|
||||
+import env from "@server/env";
|
||||
+
|
||||
+const router = new Router();
|
||||
+const providerName = "req";
|
||||
+
|
||||
+export const config = {
|
||||
+ name: "visiteur",
|
||||
+ enabled: true,
|
||||
+};
|
||||
+
|
||||
+if (true) {
|
||||
+ passport.use(
|
||||
+ new ReqStrategy(
|
||||
+ async function (req,done) {
|
||||
+ try {
|
||||
+ const domain = "domain.tld";
|
||||
+ const subdomain = domain.split(".")[0];
|
||||
+ const teamName = capitalize(subdomain);
|
||||
+ const name = "visiteur";
|
||||
+ const email = "visiteur@anthropologiebiblique.fr";
|
||||
+ const result = await accountProvisioner({
|
||||
+ ip: req.ip,
|
||||
+ team: {
|
||||
+ name: teamName,
|
||||
+ domain,
|
||||
+ subdomain,
|
||||
+ },
|
||||
+ user: {
|
||||
+ name: name,
|
||||
+ email: email,
|
||||
+ avatarUrl: null,
|
||||
+ },
|
||||
+ authenticationProvider: {
|
||||
+ name: providerName,
|
||||
+ providerId: domain,
|
||||
+ },
|
||||
+ authentication: {
|
||||
+ providerId: "1234",
|
||||
+ accessToken: null,
|
||||
+ refreshToken: null,
|
||||
+ scopes: [],
|
||||
+ },
|
||||
+ });
|
||||
+ return done(null, result.user, result);
|
||||
+ } catch (err) {
|
||||
+ return done(err, null);
|
||||
+ }
|
||||
+ }
|
||||
+ )
|
||||
+ );
|
||||
+
|
||||
+ router.get("req", passportMiddleware(providerName));
|
||||
+}
|
||||
+
|
||||
+export default router;
|
||||
\ No newline at end of file
|
||||
diff --git a/plugins/req/server/index.ts b/plugins/req/server/index.ts
|
||||
new file mode 100644
|
||||
index 000000000..68081fb65
|
||||
|
@ -358,10 +281,10 @@ index 7ade24ab4..bfa263c64 100644
|
|||
scrollbarBackground: colors.black,
|
||||
scrollbarThumb: colors.lightBlack,
|
||||
diff --git a/yarn.lock b/yarn.lock
|
||||
index 5c04955ac..161b0dce8 100644
|
||||
index d29efefc4..73b36be01 100644
|
||||
--- a/yarn.lock
|
||||
+++ b/yarn.lock
|
||||
@@ -10663,6 +10663,14 @@ passport-oauth@1.0.x:
|
||||
@@ -10653,6 +10653,14 @@ passport-oauth@1.0.x:
|
||||
passport-oauth1 "1.x.x"
|
||||
passport-oauth2 "1.x.x"
|
||||
|
||||
|
@ -376,7 +299,7 @@ index 5c04955ac..161b0dce8 100644
|
|||
passport-slack-oauth2@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/passport-slack-oauth2/-/passport-slack-oauth2-1.2.0.tgz#d214a698b55a137393636a26827747f6c436dab4"
|
||||
@@ -10693,6 +10701,14 @@ passport@^0.7.0:
|
||||
@@ -10683,6 +10691,14 @@ passport@^0.7.0:
|
||||
pause "0.0.1"
|
||||
utils-merge "^1.0.1"
|
||||
|
||||
|
|
|
@ -12,12 +12,12 @@ index ada9fc0be..62d550282 100644
|
|||
"prosemirror-commands": "^1.5.2",
|
||||
diff --git a/plugins/req/plugin.json b/plugins/req/plugin.json
|
||||
new file mode 100644
|
||||
index 000000000..bf4c23043
|
||||
index 000000000..88780ccd7
|
||||
--- /dev/null
|
||||
+++ b/plugins/req/plugin.json
|
||||
@@ -0,0 +1,6 @@
|
||||
+{
|
||||
+ "id": "visiteur",
|
||||
+ "id": "req",
|
||||
+ "name": "visiteur",
|
||||
+ "priority": 30,
|
||||
+ "description": "Adds an req compatible authentication provider."
|
||||
|
|
Loading…
Add table
Reference in a new issue