2018-07-03 10:44:27 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
Mattermost integration.
|
|
|
|
-----------------------
|
|
|
|
|
|
|
|
0. Current implementation requires user credentials to be the same
|
|
|
|
as in the Kolab server. Thanks to this we can auto-login users.
|
|
|
|
1. It has to use the same domain, if it's using different we have to use a proxy:
|
|
|
|
Following Apache config worked for me with kolab_chat_url=https://kolab.example.com/mattermost
|
|
|
|
|
|
|
|
ProxyPreserveHost Off
|
|
|
|
RewriteEngine On
|
2018-07-06 12:48:14 +00:00
|
|
|
RewriteCond %{REQUEST_URI} (/mattermost)?/api/v[0-9]+/(users/)?websocket [NC,OR]
|
2018-07-03 10:44:27 +00:00
|
|
|
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC,OR]
|
|
|
|
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
|
2018-07-06 12:48:14 +00:00
|
|
|
RewriteRule (/mattermost)?(/api/v[0-9]+/(users/)?websocket) ws://mattermost.example.com:8065$2 [P,QSA,L]
|
|
|
|
ProxyPass /mattermost http://mattermost.example.com:8065
|
2018-07-03 10:44:27 +00:00
|
|
|
|
2018-09-10 11:46:13 +02:00
|
|
|
// replace Mattermost security headers allowing the webmail domain
|
|
|
|
Header set X-Frame-Options "allow-from https://webmail.example.com";
|
|
|
|
Header set Content-Security-Policy "frame-ancestors https://webmail.example.com";
|
|
|
|
|
|
|
|
2. Enabling CORS connections in Mattermost config: AllowCorsFrom:"webmail.example.com" (or "*")
|
2018-07-03 10:44:27 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
// Chat application name. For now only 'mattermost' is supported.
|
|
|
|
$config['kolab_chat_driver'] = 'mattermost';
|
|
|
|
|
|
|
|
// Chat application URL
|
|
|
|
$config['kolab_chat_url'] = 'https://mattermost.example.com';
|
|
|
|
|
2018-09-10 11:46:13 +02:00
|
|
|
// Optional chat application domain (for session cookies)
|
|
|
|
$config['kolab_chat_session_domain'] = null;
|
|
|
|
|
2018-07-03 10:44:27 +00:00
|
|
|
// Enables opening chat in a new window (or tab)
|
|
|
|
$config['kolab_chat_extwin'] = false;
|
2018-07-09 14:16:02 +00:00
|
|
|
|
|
|
|
// Default channel to select when opening the chat app.
|
|
|
|
// Note: This has to be a channel ID.
|
|
|
|
$config['kolab_chat_channel'] = null;
|