mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-23 10:16:32 -05:00
Merge pull request #258 from ErikMichelson/misc/dropMattermost
Remove mattermost integration
This commit is contained in:
commit
a3f5dcb4c7
19 changed files with 7 additions and 125 deletions
|
@ -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**
|
||||
|
||||
|
|
12
app.json
12
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
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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 |
|
||||
|
|
|
@ -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 |
|
||||
|
|
|
@ -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` |
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -113,11 +113,6 @@ module.exports = {
|
|||
scope: undefined,
|
||||
version: 'v4'
|
||||
},
|
||||
mattermost: {
|
||||
baseURL: undefined,
|
||||
clientID: undefined,
|
||||
clientSecret: undefined
|
||||
},
|
||||
dropbox: {
|
||||
clientID: undefined,
|
||||
clientSecret: undefined,
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'))
|
||||
|
|
|
@ -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 + '/'
|
||||
})
|
||||
)
|
|
@ -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",
|
||||
|
|
|
@ -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.|
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<% if (allowAnonymous) { %>
|
||||
<a type="button" href="<%- serverURL %>/new" class="btn btn-sm btn-primary"><i class="fa fa-plus"></i> <%= __('New guest note') %></a>
|
||||
<% } %>
|
||||
<% 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) { %>
|
||||
<button class="btn btn-sm btn-success ui-signin" data-toggle="modal" data-target=".signin-modal"><%= __('Sign In') %></button>
|
||||
<% } %>
|
||||
</div>
|
||||
|
@ -50,7 +50,7 @@
|
|||
<% if (errorMessage && errorMessage.length > 0) { %>
|
||||
<div class="alert alert-danger" style="max-width: 400px; margin: 0 auto;"><%= errorMessage %></div>
|
||||
<% } %>
|
||||
<% 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) { %>
|
||||
<span class="ui-signin">
|
||||
<br>
|
||||
<a type="button" class="btn btn-lg btn-success ui-signin" data-toggle="modal" data-target=".signin-modal" style="min-width: 200px;"><%= __('Sign In') %></a>
|
||||
|
|
|
@ -28,11 +28,6 @@
|
|||
<i class="fa fa-gitlab"></i> <%= __('Sign in via %s', 'GitLab') %>
|
||||
</a>
|
||||
<% } %>
|
||||
<% if (authProviders.mattermost) { %>
|
||||
<a href="<%- serverURL %>/auth/mattermost" class="btn btn-lg btn-block btn-social btn-soundcloud">
|
||||
<i class="fa fa-mattermost"></i> <%= __('Sign in via %s', 'Mattermost') %>
|
||||
</a>
|
||||
<% } %>
|
||||
<% if (authProviders.dropbox) { %>
|
||||
<a href="<%- serverURL %>/auth/dropbox" class="btn btn-lg btn-block btn-social btn-dropbox">
|
||||
<i class="fa fa-dropbox"></i> <%= __('Sign in via %s', 'Dropbox') %>
|
||||
|
@ -53,7 +48,7 @@
|
|||
<i class="fa fa-mail-forward"></i> <%= __('Sign in via %s', authProviders.oauth2ProviderName || 'OAuth2') %>
|
||||
</a>
|
||||
<% } %>
|
||||
<% 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) { %>
|
||||
<hr>
|
||||
<% }%>
|
||||
<% if (authProviders.ldap) { %>
|
||||
|
@ -78,7 +73,7 @@
|
|||
</div>
|
||||
</form>
|
||||
<% } %>
|
||||
<% 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) { %>
|
||||
<hr>
|
||||
<% }%>
|
||||
<% if (authProviders.openID) { %>
|
||||
|
@ -97,7 +92,7 @@
|
|||
</div>
|
||||
</form>
|
||||
<% } %>
|
||||
<% 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) { %>
|
||||
<hr>
|
||||
<% }%>
|
||||
<% if (authProviders.email) { %>
|
||||
|
|
Loading…
Reference in a new issue