Beispiel #1
0
import { SAML } from './saml_utils';
import bodyParser from 'body-parser';
import fiber from 'fibers';
import _ from 'underscore';

if (!Accounts.saml) {
	Accounts.saml = {
		settings: {
			debug: false,
			generateUsername: false,
			providers: [],
		},
	};
}

RoutePolicy.declare('/_saml/', 'network');

/**
 * Fetch SAML provider configs for given 'provider'.
 */
function getSamlProviderConfig(provider) {
	if (! provider) {
		throw new Meteor.Error('no-saml-provider',
			'SAML internal error',
			{ method: 'getSamlProviderConfig' });
	}
	const samlProvider = function(element) {
		return (element.provider === provider);
	};
	return Accounts.saml.settings.providers.filter(samlProvider)[0];
}
Beispiel #2
0
import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';
import { Random } from 'meteor/random';
import { WebApp } from 'meteor/webapp';
import { settings } from '../../settings';
import { RoutePolicy } from 'meteor/routepolicy';
import { Rooms, Subscriptions, CredentialTokens } from '../../models';
import { _setRealName } from '../../lib';
import { logger } from './cas_rocketchat';
import _ from 'underscore';
import fiber from 'fibers';
import url from 'url';
import CAS from 'cas';

RoutePolicy.declare('/_cas/', 'network');

const closePopup = function(res) {
	res.writeHead(200, { 'Content-Type': 'text/html' });
	const content = '<html><head><script>window.close()</script></head></html>';
	res.end(content, 'utf-8');
};

const casTicket = function(req, token, callback) {

	// get configuration
	if (!settings.get('CAS_enabled')) {
		logger.error('Got ticket validation request, but CAS is not enabled');
		callback();
	}

	// get ticket and validate.