diff --git a/README.md b/README.md index 245c7a3ac..34c59c37e 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ works best for you. CodiMD can integrate with -* facebook, twitter, github, gitlab, mattermost, dropbox, google, ldap, saml and [oauth2](docs/guides/auth/oauth.md) **for login** +* facebook, twitter, github, gitlab, dropbox, google, ldap, saml and [oauth2](docs/guides/auth/oauth.md) **for login** * imgur, s3, minio, azure **for image/attachment storage** (files can also be local!) * dropbox **for export and import** diff --git a/app.json b/app.json index f2a2b74c1..8642e0b28 100644 --- a/app.json +++ b/app.json @@ -100,18 +100,6 @@ "description": "GitLab API client scope (optional)", "required": false }, - "CMD_MATTERMOST_BASEURL": { - "description": "Mattermost authentication endpoint", - "required": false - }, - "CMD_MATTERMOST_CLIENTID": { - "description": "Mattermost API client id", - "required": false - }, - "CMD_MATTERMOST_CLIENTSECRET": { - "description": "Mattermost API client secret", - "required": false - }, "CMD_DROPBOX_CLIENTID": { "description": "Dropbox API client id", "required": false diff --git a/config.json.example b/config.json.example index 0366c3b20..b1766c5cc 100644 --- a/config.json.example +++ b/config.json.example @@ -62,11 +62,6 @@ "scope": "use 'read_user' scope for auth user only or remove this property if you need gitlab snippet import/export support (will result to be default scope 'api')", "version": "use 'v4' if gitlab version > 11, 'v3' otherwise. Default to 'v4'" }, - "mattermost": { - "baseURL": "change this", - "clientID": "change this", - "clientSecret": "change this" - }, "dropbox": { "clientID": "change this", "clientSecret": "change this", diff --git a/docs/configuration-config-file.md b/docs/configuration-config-file.md index 5134af7f4..d26d24f61 100644 --- a/docs/configuration-config-file.md +++ b/docs/configuration-config-file.md @@ -142,12 +142,6 @@ these are rarely used for various reasons. | --------- | ------ | ----------- | | `ldap` | `{providerName: ..., url: ..., bindDn: ..., bindCredentials: ..., searchBase: ..., searchFilter: ..., searchAttributes: ..., usernameField: ..., useridField: ..., tlsca: ...}` | An object detailing the LDAP connection. Refer to the [LDAP-AD guide](guides/auth/ldap-AD.md) for more details! | -### Mattermost Login - -| variables | example values | description | -| --------- | ------ | ----------- | -| `mattermost` | `{baseURL: ..., clientID: ..., clientSecret: ...}` | An object containing the base URL of your Mattermost application data. Refer to the [Mattermost guide](guides/auth/mattermost-self-hosted.md) for more details! | - ### OAuth2 Login | variables | example values | description | diff --git a/docs/configuration-env-vars.md b/docs/configuration-env-vars.md index d203c80b4..41695517f 100644 --- a/docs/configuration-env-vars.md +++ b/docs/configuration-env-vars.md @@ -154,15 +154,6 @@ defaultNotePath can't be set from env-vars | `CMD_LDAP_PROVIDERNAME` | `My institution` | Optional name to be displayed at login form indicating the LDAP provider | -### Mattermost Login - -| variable | example value | description | -| -------- | ------------- | ----------- | -| `CMD_MATTERMOST_BASEURL` | no example | Mattermost authentication endpoint for versions below 5.0. For Mattermost version 5.0 and above, see [guide](guides/auth/mattermost-self-hosted.md). | -| `CMD_MATTERMOST_CLIENTID` | no example | Mattermost API client id | -| `CMD_MATTERMOST_CLIENTSECRET` | no example | Mattermost API client secret | - - ### OAuth2 Login | variable | example value | description | diff --git a/docs/guides/auth/oauth.md b/docs/guides/auth/oauth.md index 46314e26f..c8965788f 100644 --- a/docs/guides/auth/oauth.md +++ b/docs/guides/auth/oauth.md @@ -6,7 +6,6 @@ | twitter | `/auth/twitter/callback` | | github | `/auth/github/callback` | | gitlab | `/auth/gitlab/callback` | -| mattermost | `/auth/mattermost/callback` | | dropbox | `/auth/dropbox/callback` | | google | `/auth/google/callback` | | saml | `/auth/saml/callback` | diff --git a/lib/app.js b/lib/app.js index 544d63758..69b78871a 100644 --- a/lib/app.js +++ b/lib/app.js @@ -188,7 +188,6 @@ app.locals.authProviders = { twitter: config.isTwitterEnable, github: config.isGitHubEnable, gitlab: config.isGitLabEnable, - mattermost: config.isMattermostEnable, dropbox: config.isDropboxEnable, google: config.isGoogleEnable, ldap: config.isLDAPEnable, diff --git a/lib/config/default.js b/lib/config/default.js index f47fe344d..bb51f3e2a 100644 --- a/lib/config/default.js +++ b/lib/config/default.js @@ -113,11 +113,6 @@ module.exports = { scope: undefined, version: 'v4' }, - mattermost: { - baseURL: undefined, - clientID: undefined, - clientSecret: undefined - }, dropbox: { clientID: undefined, clientSecret: undefined, diff --git a/lib/config/dockerSecret.js b/lib/config/dockerSecret.js index 02b959d94..ef2a2cf98 100644 --- a/lib/config/dockerSecret.js +++ b/lib/config/dockerSecret.js @@ -42,10 +42,6 @@ if (fs.existsSync(basePath)) { clientID: getSecret('gitlab_clientID'), clientSecret: getSecret('gitlab_clientSecret') }, - mattermost: { - clientID: getSecret('mattermost_clientID'), - clientSecret: getSecret('mattermost_clientSecret') - }, dropbox: { clientID: getSecret('dropbox_clientID'), clientSecret: getSecret('dropbox_clientSecret'), diff --git a/lib/config/environment.js b/lib/config/environment.js index 219be4995..5be42c65d 100644 --- a/lib/config/environment.js +++ b/lib/config/environment.js @@ -77,11 +77,6 @@ module.exports = { clientSecret: process.env.CMD_GITLAB_CLIENTSECRET, scope: process.env.CMD_GITLAB_SCOPE }, - mattermost: { - baseURL: process.env.CMD_MATTERMOST_BASEURL, - clientID: process.env.CMD_MATTERMOST_CLIENTID, - clientSecret: process.env.CMD_MATTERMOST_CLIENTSECRET - }, oauth2: { providerName: process.env.CMD_OAUTH2_PROVIDERNAME, baseURL: process.env.CMD_OAUTH2_BASEURL, diff --git a/lib/config/hackmdEnvironment.js b/lib/config/hackmdEnvironment.js index dcfda0bc1..26141f50a 100644 --- a/lib/config/hackmdEnvironment.js +++ b/lib/config/hackmdEnvironment.js @@ -67,11 +67,6 @@ module.exports = { clientSecret: process.env.HMD_GITLAB_CLIENTSECRET, scope: process.env.HMD_GITLAB_SCOPE }, - mattermost: { - baseURL: process.env.HMD_MATTERMOST_BASEURL, - clientID: process.env.HMD_MATTERMOST_CLIENTID, - clientSecret: process.env.HMD_MATTERMOST_CLIENTSECRET - }, oauth2: { baseURL: process.env.HMD_OAUTH2_BASEURL, userProfileURL: process.env.HMD_OAUTH2_USER_PROFILE_URL, diff --git a/lib/config/index.js b/lib/config/index.js index c542516d6..1e2b8e898 100644 --- a/lib/config/index.js +++ b/lib/config/index.js @@ -116,7 +116,6 @@ config.isEmailEnable = config.email config.isOpenIDEnable = config.openID config.isGitHubEnable = config.github.clientID && config.github.clientSecret config.isGitLabEnable = config.gitlab.clientID && config.gitlab.clientSecret -config.isMattermostEnable = config.mattermost.clientID && config.mattermost.clientSecret config.isLDAPEnable = config.ldap.url config.isSAMLEnable = config.saml.idpSsoUrl config.isOAuth2Enable = config.oauth2.clientID && config.oauth2.clientSecret diff --git a/lib/models/user.js b/lib/models/user.js index 50c781083..28cbc58d8 100644 --- a/lib/models/user.js +++ b/lib/models/user.js @@ -117,15 +117,6 @@ module.exports = function (sequelize, DataTypes) { photo = generateAvatarURL(profile.username) } break - case 'mattermost': - photo = profile.avatarUrl - if (photo) { - if (bigger) photo = photo.replace(/(\?s=)\d*$/i, '$1400') - else photo = photo.replace(/(\?s=)\d*$/i, '$196') - } else { - photo = generateAvatarURL(profile.username) - } - break case 'dropbox': photo = generateAvatarURL('', profile.emails[0].value, bigger) break diff --git a/lib/web/auth/index.js b/lib/web/auth/index.js index 86ab4b28e..724888419 100644 --- a/lib/web/auth/index.js +++ b/lib/web/auth/index.js @@ -38,7 +38,6 @@ if (config.isFacebookEnable) authRouter.use(require('./facebook')) if (config.isTwitterEnable) authRouter.use(require('./twitter')) if (config.isGitHubEnable) authRouter.use(require('./github')) if (config.isGitLabEnable) authRouter.use(require('./gitlab')) -if (config.isMattermostEnable) authRouter.use(require('./mattermost')) if (config.isDropboxEnable) authRouter.use(require('./dropbox')) if (config.isGoogleEnable) authRouter.use(require('./google')) if (config.isLDAPEnable) authRouter.use(require('./ldap')) diff --git a/lib/web/auth/mattermost/index.js b/lib/web/auth/mattermost/index.js deleted file mode 100644 index 78eca2af4..000000000 --- a/lib/web/auth/mattermost/index.js +++ /dev/null @@ -1,48 +0,0 @@ -'use strict' - -const Router = require('express').Router -const passport = require('passport') -const Mattermost = require('mattermost') -const OAuthStrategy = require('passport-oauth2').Strategy -const config = require('../../../config') -const { passportGeneralCallback } = require('../utils') - -const mattermost = new Mattermost.Client() - -let mattermostAuth = module.exports = Router() - -let mattermostStrategy = new OAuthStrategy({ - authorizationURL: config.mattermost.baseURL + '/oauth/authorize', - tokenURL: config.mattermost.baseURL + '/oauth/access_token', - clientID: config.mattermost.clientID, - clientSecret: config.mattermost.clientSecret, - callbackURL: config.serverURL + '/auth/mattermost/callback' -}, passportGeneralCallback) - -mattermostStrategy.userProfile = (accessToken, done) => { - mattermost.setUrl(config.mattermost.baseURL) - mattermost.token = accessToken - mattermost.useHeaderToken() - mattermost.getMe( - (data) => { - done(null, data) - }, - (err) => { - done(err) - } - ) -} - -passport.use(mattermostStrategy) - -mattermostAuth.get('/auth/mattermost', function (req, res, next) { - passport.authenticate('oauth2')(req, res, next) -}) - -// mattermost auth callback -mattermostAuth.get('/auth/mattermost/callback', - passport.authenticate('oauth2', { - successReturnToOrRedirect: config.serverURL + '/', - failureRedirect: config.serverURL + '/' - }) -) diff --git a/package.json b/package.json index 4736b8aaf..0b7ffc3dd 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,6 @@ "markdown-it-sup": "^1.0.0", "markdown-pdf": "^10.0.0", "mathjax": "~2.7.6", - "mattermost": "^3.4.0", "mermaid": "~8.4.6", "meta-marked": "git+https://github.com/codimd/meta-marked#semver:^0.4.5", "method-override": "^2.3.7", diff --git a/public/docs/privacy.md.example b/public/docs/privacy.md.example index 441a993a2..a60d4d5d7 100644 --- a/public/docs/privacy.md.example +++ b/public/docs/privacy.md.example @@ -6,7 +6,7 @@ We process the following data, for the following purposes: |your data|our usage| |---------|---------| |IP-Address|Used to communicate with your browser and our servers. It's may exposed to third-parties which provide resources for this service. These services are, depending on your login method, the document you visit and the setup of this instance: Google, Disqus, MathJax, GitHub, SlideShare/LinkedIn, yahoo, Libravatar, Imgur, Amazon, and Cloudflare.| -|Usernames and profiles|Your username as well as user profiles that are connected with it are transmitted and stored by us to provide a useful login integration with services like GitHub, Facebook, Twitter, GitLab, Dropbox, Google. Depending on the setup of this CodiMD instance there are maybe other third-parties involved using SAML, LDAP or the integration with a Mattermost instance.| +|Usernames and profiles|Your username as well as user profiles that are connected with it are transmitted and stored by us to provide a useful login integration with services like GitHub, Facebook, Twitter, GitLab, Dropbox, Google. Depending on the setup of this CodiMD instance there are maybe other third-parties involved using SAML, OAuth2 or LDAP.| |Profile pictures| Your profile picture is either loaded from the service you used to login, the CodiMD instance or Libravatar.| |Uploaded pictures| Pictures that are uploaded for documents are either uploaded to Amazon S3, Imgur, a minio instance or the local filesystem of the CodiMD server.| diff --git a/public/views/index/body.ejs b/public/views/index/body.ejs index 6506ae7df..47704efa6 100644 --- a/public/views/index/body.ejs +++ b/public/views/index/body.ejs @@ -15,7 +15,7 @@ <% if (allowAnonymous) { %> <%= __('New guest note') %> <% } %> - <% if (authProviders.facebook || authProviders.twitter || authProviders.github || authProviders.gitlab || authProviders.mattermost || authProviders.dropbox || authProviders.google || authProviders.ldap || authProviders.saml || authProviders.oauth2 || authProviders.email) { %> + <% if (authProviders.facebook || authProviders.twitter || authProviders.github || authProviders.gitlab || authProviders.dropbox || authProviders.google || authProviders.ldap || authProviders.saml || authProviders.oauth2 || authProviders.email) { %> <% } %> @@ -50,7 +50,7 @@ <% if (errorMessage && errorMessage.length > 0) { %>
<%= errorMessage %>
<% } %> - <% if (authProviders.facebook || authProviders.twitter || authProviders.github || authProviders.gitlab || authProviders.mattermost || authProviders.dropbox || authProviders.google || authProviders.ldap || authProviders.saml || authProviders.oauth2 || authProviders.email) { %> + <% if (authProviders.facebook || authProviders.twitter || authProviders.github || authProviders.gitlab || authProviders.dropbox || authProviders.google || authProviders.ldap || authProviders.saml || authProviders.oauth2 || authProviders.email) { %>
<%= __('Sign In') %> diff --git a/public/views/shared/signin-modal.ejs b/public/views/shared/signin-modal.ejs index 40f01b577..685596c9d 100644 --- a/public/views/shared/signin-modal.ejs +++ b/public/views/shared/signin-modal.ejs @@ -28,11 +28,6 @@ <%= __('Sign in via %s', 'GitLab') %> <% } %> - <% if (authProviders.mattermost) { %> - - <%= __('Sign in via %s', 'Mattermost') %> - - <% } %> <% if (authProviders.dropbox) { %> <%= __('Sign in via %s', 'Dropbox') %> @@ -53,7 +48,7 @@ <%= __('Sign in via %s', authProviders.oauth2ProviderName || 'OAuth2') %> <% } %> - <% if ((authProviders.facebook || authProviders.twitter || authProviders.github || authProviders.gitlab || authProviders.mattermost || authProviders.dropbox || authProviders.google || authProviders.saml || authProviders.oauth2) && authProviders.ldap) { %> + <% if ((authProviders.facebook || authProviders.twitter || authProviders.github || authProviders.gitlab || authProviders.dropbox || authProviders.google || authProviders.saml || authProviders.oauth2) && authProviders.ldap) { %>
<% }%> <% if (authProviders.ldap) { %> @@ -78,7 +73,7 @@ <% } %> - <% if ((authProviders.facebook || authProviders.twitter || authProviders.github || authProviders.gitlab || authProviders.mattermost || authProviders.dropbox || authProviders.google || authProviders.ldap || authProviders.oauth2) && authProviders.openID) { %> + <% if ((authProviders.facebook || authProviders.twitter || authProviders.github || authProviders.gitlab || authProviders.dropbox || authProviders.google || authProviders.ldap || authProviders.oauth2) && authProviders.openID) { %>
<% }%> <% if (authProviders.openID) { %> @@ -97,7 +92,7 @@ <% } %> - <% if ((authProviders.facebook || authProviders.twitter || authProviders.github || authProviders.gitlab || authProviders.mattermost || authProviders.dropbox || authProviders.google || authProviders.ldap || authProviders.oauth2 || authProviders.openID) && authProviders.email) { %> + <% if ((authProviders.facebook || authProviders.twitter || authProviders.github || authProviders.gitlab || authProviders.dropbox || authProviders.google || authProviders.ldap || authProviders.oauth2 || authProviders.openID) && authProviders.email) { %>
<% }%> <% if (authProviders.email) { %>