@@ -41,23 +41,23 @@ public function authenticate(&$state)
4141 }
4242
4343 $ userAttributes = [];
44- $ userInfoAttribues = $ userInfo ->data ->attributes ;
45- $ customAttributes = $ state ['SPMetadata ' ]['CustomAttributes ' ];
44+ $ userInfoAttributes = $ userInfo ->data ->attributes ;
45+ $ userAttributesMapping = $ state ['SPMetadata ' ]['UserAttributesMapping ' ];
4646
47- if (is_array ($ customAttributes ) && !empty ($ customAttributes )) {
48- foreach ($ customAttributes as $ customAttributeKey => $ customAttributeValue ) {
49- $ userAttributes [$ customAttributeValue ] = isset ($ userInfoAttribues ->$ customAttributeKey )
50- ? $ userInfoAttribues ->$ customAttributeKey :
51- '' ;
47+ if (is_array ($ userAttributesMapping ) && !empty ($ userAttributesMapping )) {
48+ foreach ($ userAttributesMapping as $ mappedAttributeKey => $ mappedAttributeValue ) {
49+ $ userAttributes [$ mappedAttributeValue ] = isset ($ userInfoAttributes ->$ mappedAttributeKey )
50+ ? $ userInfoAttributes ->$ mappedAttributeKey
51+ : '' ;
5252 }
5353 } else {
5454 $ userAttributes = [
55- 'email ' => $ userInfoAttribues ->email ,
56- 'employee-id ' => $ userInfoAttribues ->{'employee-id ' },
57- 'document ' => $ userInfoAttribues ->{'document ' },
58- 'document-type ' => $ userInfoAttribues ->{'document-type ' },
59- 'name ' => $ userInfoAttribues ->{'name ' },
60- 'last-name ' => $ userInfoAttribues ->{'last-name ' },
55+ 'email ' => $ userInfoAttributes ->email ,
56+ 'employee-id ' => $ userInfoAttributes ->{'employee-id ' },
57+ 'document ' => $ userInfoAttributes ->{'document ' },
58+ 'document-type ' => $ userInfoAttributes ->{'document-type ' },
59+ 'name ' => $ userInfoAttributes ->{'name ' },
60+ 'last-name ' => $ userInfoAttributes ->{'last-name ' },
6161 ];
6262 }
6363
0 commit comments