-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauthProviders.js
More file actions
38 lines (29 loc) · 916 Bytes
/
authProviders.js
File metadata and controls
38 lines (29 loc) · 916 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
'use strict';
const Joi = require('joi');
const Hoek = require('hoek');
// Declare internals
const internals = {};
exports.register = function (server, options, next) {
const results = Joi.validate(options, internals.schema);
Hoek.assert(!results.error, results.error);
const settings = results.value;
server.auth.strategy('slack', 'bell', {
provider: 'slack',
password: settings.cookiePassword,
clientId: settings.slackClientId,
clientSecret: settings.slackSecret,
forceHttps: true,
isSecure: true,
scope: ['team:read']
});
next();
};
exports.register.attributes = {
name: 'authProviders'
};
internals.schema = Joi.object({
cookiePassword: Joi.string().required(),
slackClientId: Joi.string().required(),
slackSecret: Joi.string().required(),
slackVerificationToken: Joi.string().required()
}).required();