remove nextcloud auth

This commit is contained in:
Sebastian Hugentobler 2022-01-10 08:12:42 +01:00
parent 697f58c0e4
commit 4b0320ecdd
Signed by: shu
GPG Key ID: BB32CF3CA052C2F0
2 changed files with 2 additions and 105 deletions

View File

@ -1,4 +1,4 @@
FROM alpine:3.14 as builder FROM alpine:3.15 as builder
RUN apk add --no-cache \ RUN apk add --no-cache \
git \ git \
@ -17,13 +17,11 @@ RUN npm install -g \
webpack-cli \ webpack-cli \
node-gyp node-gyp
ENV WIKIJS_VERSION=2.5.201 ENV WIKIJS_VERSION=2.5.268
RUN git clone https://github.com/Requarks/wiki.git -b $WIKIJS_VERSION /build RUN git clone https://github.com/Requarks/wiki.git -b $WIKIJS_VERSION /build
ADD nextcloud-auth.patch /build/nextcloud-auth.patch
WORKDIR /build WORKDIR /build
RUN git apply nextcloud-auth.patch
RUN npm install --legacy-peer-deps RUN npm install --legacy-peer-deps
# don't know why this is needed here too, but what the hell # don't know why this is needed here too, but what the hell
RUN npm install --save-dev webpack webpack-cli RUN npm install --save-dev webpack webpack-cli

View File

@ -1,101 +0,0 @@
From e26b40f3899efe1dccd1ad218f52b99decce198d Mon Sep 17 00:00:00 2001
From: Sebastian Hugentobler <sebastian@vanwa.ch>
Date: Tue, 7 Jan 2020 15:44:06 +0100
Subject: [PATCH] add nextcloud auth
---
package.json | 1 +
.../nextcloud/authentication.js | 36 +++++++++++++++++++
.../authentication/nextcloud/definition.yml | 25 +++++++++++++
3 files changed, 62 insertions(+)
create mode 100644 server/modules/authentication/nextcloud/authentication.js
create mode 100644 server/modules/authentication/nextcloud/definition.yml
diff --git a/package.json b/package.json
index 3ca42c3a..c92ec776 100644
--- a/package.json
+++ b/package.json
@@ -146,6 +146,7 @@
"passport-ldapauth": "2.1.4",
"passport-local": "1.0.0",
"passport-microsoft": "0.1.0",
+ "passport-nextcloud": "0.1.1",
"passport-oauth2": "1.5.0",
"passport-okta-oauth": "0.0.1",
"passport-openidconnect": "0.0.2",
diff --git a/server/modules/authentication/nextcloud/authentication.js b/server/modules/authentication/nextcloud/authentication.js
new file mode 100644
index 00000000..0b58a78d
--- /dev/null
+++ b/server/modules/authentication/nextcloud/authentication.js
@@ -0,0 +1,36 @@
+/* global WIKI */
+
+// ------------------------------------
+// Nextcloud Account
+// ------------------------------------
+
+const NextcloudStrategy = require('passport-nextcloud').Strategy
+const _ = require('lodash')
+
+module.exports = {
+ init (passport, conf) {
+ passport.use('nextcloud',
+ new NextcloudStrategy({
+ clientID: conf.clientId,
+ clientSecret: conf.clientSecret,
+ callbackURL: conf.callbackURL,
+ baseURL: conf.baseUrl,
+ scope: ['read_user']
+ }, async (accessToken, refreshToken, profile, cb) => {
+ try {
+ const user = await WIKI.models.users.processProfile({
+ profile: {
+ ...profile,
+ // not available from nextcloud so far
+ picture: ''
+ },
+ providerKey: 'nextcloud'
+ })
+ cb(null, user)
+ } catch (err) {
+ cb(err, null)
+ }
+ }
+ ))
+ }
+}
diff --git a/server/modules/authentication/nextcloud/definition.yml b/server/modules/authentication/nextcloud/definition.yml
new file mode 100644
index 00000000..30a136ed
--- /dev/null
+++ b/server/modules/authentication/nextcloud/definition.yml
@@ -0,0 +1,25 @@
+key: nextcloud
+title: Nextcloud
+description: Nextcloud is a suite of client-server software for creating and using file hosting services.
+author: requarks.io
+logo: https://static.requarks.io/logo/nextcloud.svg
+color: blue darken-1
+website: https://nextcloud.com
+isAvailable: true
+useForm: false
+props:
+ clientId:
+ type: String
+ title: Client ID
+ hint: Application Client ID
+ order: 1
+ clientSecret:
+ type: String
+ title: Client Secret
+ hint: Application Client Secret
+ order: 2
+ baseUrl:
+ type: String
+ title: Base URL
+ hint: Define the base URL (e.g. https://nextcloud.example.com).
+ order: 3
--
2.18.1