From 63cb280a1dcff75014921c4ae79a01f2edafabc1 Mon Sep 17 00:00:00 2001
From: "Seth Wheeler (Student)" <wheelersc@cox.net>
Date: Tue, 4 Aug 2020 23:17:32 -0700
Subject: [PATCH] uncomment lines

---
 lib/passport-cas.js | 92 ++++++++++++++++++++++-----------------------
 1 file changed, 46 insertions(+), 46 deletions(-)

diff --git a/lib/passport-cas.js b/lib/passport-cas.js
index b36f415..6d248d4 100644
--- a/lib/passport-cas.js
+++ b/lib/passport-cas.js
@@ -221,52 +221,52 @@ CasStrategy.prototype.authenticate = function (req, options) {
           emails: [],
         };
 
-        // Map relevant extended attributes returned by CAS into the profile
-        // for (var key in profile) {
-        //   if (key == 'name') {
-        //     for (const subKey in profile[key]) {
-        //       var mappedKey = self.casPropertyMap[subKey] || subKey;
-        //       var value = attributes[mappedKey];
-        //       if (Array.isArray(value)) {
-        //         profile.name[subKey] = value[0];
-        //       } else {
-        //         profile.name[subKey] = value;
-        //       }
-        //       delete attributes[mappedKey];
-        //     }
-        //   } else if (key == 'emails') {
-        //     var mappedKey = self.casPropertyMap.emails || 'emails';
-        //     const emails = attributes[mappedKey];
-        //     if (Array.isArray(emails)) {
-        //       if (typeof emails[0] === 'object') {
-        //         profile.emails = emails;
-        //       } else {
-        //         for (let i = 0; i < emails.length; i++) {
-        //           profile.emails.push({
-        //             value: emails[i],
-        //             type: 'default',
-        //           });
-        //         }
-        //       }
-        //     } else {
-        //       profile.emails = [emails];
-        //     }
-        //     delete attributes[mappedKey];
-        //   } else {
-        //     var mappedKey = self.casPropertyMap[key] || key;
-        //     var value = attributes[mappedKey];
-        //     if (Array.isArray(value)) {
-        //       profile[key] = value[0];
-        //     } else if (value) {
-        //       profile[key] = value;
-        //     }
-        //     delete attributes[mappedKey];
-        //   }
-        // }
-        // // Add remaining attributes to the profile object
-        // for (var key in attributes) {
-        //   profile[key] = attributes[key];
-        // }
+        Map relevant extended attributes returned by CAS into the profile
+        for (var key in profile) {
+          if (key == 'name') {
+            for (const subKey in profile[key]) {
+              var mappedKey = self.casPropertyMap[subKey] || subKey;
+              var value = attributes[mappedKey];
+              if (Array.isArray(value)) {
+                profile.name[subKey] = value[0];
+              } else {
+                profile.name[subKey] = value;
+              }
+              delete attributes[mappedKey];
+            }
+          } else if (key == 'emails') {
+            var mappedKey = self.casPropertyMap.emails || 'emails';
+            const emails = attributes[mappedKey];
+            if (Array.isArray(emails)) {
+              if (typeof emails[0] === 'object') {
+                profile.emails = emails;
+              } else {
+                for (let i = 0; i < emails.length; i++) {
+                  profile.emails.push({
+                    value: emails[i],
+                    type: 'default',
+                  });
+                }
+              }
+            } else {
+              profile.emails = [emails];
+            }
+            delete attributes[mappedKey];
+          } else {
+            var mappedKey = self.casPropertyMap[key] || key;
+            var value = attributes[mappedKey];
+            if (Array.isArray(value)) {
+              profile[key] = value[0];
+            } else if (value) {
+              profile[key] = value;
+            }
+            delete attributes[mappedKey];
+          }
+        }
+        // Add remaining attributes to the profile object
+        for (var key in attributes) {
+          profile[key] = attributes[key];
+        }
 
         if (self._passReqToCallback) {
           self._verify(req, username, profile, verified);