|
|
@@ -5,7 +5,6 @@ module.exports = function(crowi, app) {
|
|
|
, logger = require('@alias/logger')('growi:routes:login-passport')
|
|
|
, passport = require('passport')
|
|
|
, config = crowi.getConfig()
|
|
|
- , Config = crowi.model('Config')
|
|
|
, ExternalAccount = crowi.model('ExternalAccount')
|
|
|
, passportService = crowi.passportService
|
|
|
;
|
|
|
@@ -355,11 +354,11 @@ module.exports = function(crowi, app) {
|
|
|
const loginPassportSamlCallback = async(req, res) => {
|
|
|
const providerId = 'saml';
|
|
|
const strategyName = 'saml';
|
|
|
- const attrMapId = config.crowi['security:passport-saml:attrMapId'];
|
|
|
- const attrMapUsername = config.crowi['security:passport-saml:attrMapUsername'];
|
|
|
- const attrMapMail = config.crowi['security:passport-saml:attrMapMail'];
|
|
|
- const attrMapFirstName = config.crowi['security:passport-saml:attrMapFirstName'] || 'firstName';
|
|
|
- const attrMapLastName = config.crowi['security:passport-saml:attrMapLastName'] || 'lastName';
|
|
|
+ const attrMapId = crowi.configManager.getConfig('crowi', 'security:passport-saml:attrMapId');
|
|
|
+ const attrMapUsername = crowi.configManager.getConfig('crowi', 'security:passport-saml:attrMapUsername');
|
|
|
+ const attrMapMail = crowi.configManager.getConfig('crowi', 'security:passport-saml:attrMapMail');
|
|
|
+ const attrMapFirstName = crowi.configManager.getConfig('crowi', 'security:passport-saml:attrMapFirstName') || 'firstName';
|
|
|
+ const attrMapLastName = crowi.configManager.getConfig('crowi', 'security:passport-saml:attrMapLastName') || 'lastName';
|
|
|
|
|
|
let response;
|
|
|
try {
|
|
|
@@ -428,8 +427,8 @@ module.exports = function(crowi, app) {
|
|
|
|
|
|
const getOrCreateUser = async(req, res, userInfo, providerId) => {
|
|
|
// get option
|
|
|
- const isSameUsernameTreatedAsIdenticalUser = Config.isSameUsernameTreatedAsIdenticalUser(config, providerId);
|
|
|
- const isSameEmailTreatedAsIdenticalUser = Config.isSameEmailTreatedAsIdenticalUser(config, providerId);
|
|
|
+ const isSameUsernameTreatedAsIdenticalUser = crowi.passportService.isSameUsernameTreatedAsIdenticalUser(config, providerId);
|
|
|
+ const isSameEmailTreatedAsIdenticalUser = crowi.passportService.isSameEmailTreatedAsIdenticalUser(config, providerId);
|
|
|
try {
|
|
|
// find or register(create) user
|
|
|
const externalAccount = await ExternalAccount.findOrRegister(
|