File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,11 @@ public static function findIdentity($id)
4343 {
4444 $ attributes = Yii::$ container ->get ('saml ' )->getAttributes ();
4545 if (sizeof ($ attributes ) > 0 ){
46- $ id = $ attributes ['username ' ][0 ];
46+ $ id = mt_rand ();
47+ $ uniqueIdentifierFromIdp = getenv ('IDP_PROVIDED_USER_IDENTIFIER_NAME ' ) ? getenv ('IDP_PROVIDED_USER_IDENTIFIER_NAME ' ) : '' ;
48+ if ($ uniqueIdentifierFromIdp ){
49+ $ id = $ attributes [$ uniqueIdentifierFromIdp ] && count ($ attributes [$ uniqueIdentifierFromIdp ])>0 ? $ attributes [$ uniqueIdentifierFromIdp ][0 ] : $ id ;
50+ }
4751 return new SamlIdentity ($ id ,$ attributes );
4852 }
4953 return null ;
Original file line number Diff line number Diff line change @@ -22,7 +22,12 @@ public function actionLogin(){
2222 Yii::$ container ->get ('saml ' )->requireAuth ();
2323 } else {
2424 $ attributes = Yii::$ container ->get ('saml ' )->getAttributes ();
25- $ id = $ attributes ['username ' ][0 ];
25+ $ id = mt_rand ();
26+ $ uniqueIdentifierFromIdp = getenv ('IDP_PROVIDED_USER_IDENTIFIER_NAME ' ) ? getenv ('IDP_PROVIDED_USER_IDENTIFIER_NAME ' ) : '' ;
27+ if ($ uniqueIdentifierFromIdp ){
28+ $ id = $ attributes [$ uniqueIdentifierFromIdp ] && count ($ attributes [$ uniqueIdentifierFromIdp ])>0 ? $ attributes [$ uniqueIdentifierFromIdp ][0 ] : $ id ;
29+ }
30+
2631 Yii::$ app ->user ->login (new SamlIdentity ($ id ,$ attributes ), 0 );
2732 $ this ->goBack ();
2833 }
You can’t perform that action at this time.
0 commit comments