Просмотр исходного кода

Merge pull request #595 from weseek/feat/SSO-SAML

Feat/sso saml
Yuki Takei 7 лет назад
Родитель
Сommit
5bb1ae3116

+ 7 - 3
src/server/routes/login-passport.js

@@ -324,11 +324,15 @@ module.exports = function(crowi, app) {
   const loginPassportSamlCallback = async(req, res, next) => {
     const providerId = 'saml';
     const strategyName = 'saml';
+    const attrMapId = config.crowi['security:passport-saml:attrMapId'] || 'id';
+    const attrMapUsername = config.crowi['security:passport-saml:attrMapUsername'] || 'userName';
+    const attrMapFirstName = config.crowi['security:passport-saml:attrMapFirstName'] || 'firstName';
+    const attrMapLastName = config.crowi['security:passport-saml:attrMapLastName'] || 'lastName';
     const response = await promisifiedPassportAuthentication(req, res, next, strategyName);
     const userInfo = {
-      'id': response.id,
-      'username': response.username,
-      'name': `${response.firstName} ${response.lastName}`,
+      'id': response[attrMapId],
+      'username': response[attrMapUsername],
+      'name': `${response[attrMapFirstName]} ${response[attrMapLastName]}`,
     };
 
     const externalAccount = await getOrCreateUser(req, res, next, userInfo, providerId);

+ 0 - 13
src/server/views/admin/widget/passport/saml.html

@@ -105,19 +105,6 @@
       </div>
     </div>
 
-    <div class="form-group">
-      <label for="settingForm[security:passport-saml:attrMapMail]" class="col-xs-3 control-label">Mail</label>
-      <div class="col-xs-6">
-        <input class="form-control" type="text" placeholder="Default: mail"
-            name="settingForm[security:passport-saml:attrMapMail]" value="{{ settingForm['security:passport-saml:attrMapMail'] || '' }}">
-        <p class="help-block">
-          <small>
-            {{ t("security_setting.SAML.mapping_detail", "Email") }}
-          </small>
-        </p>
-      </div>
-    </div>
-
     <div class="form-group">
       <label for="settingForm[security:passport-saml:attrMapFirstName]" class="col-xs-3 control-label">First Name</label>
       <div class="col-xs-6">