airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [1/2] airavata-php-gateway git commit: hacky fix to WSO2 OpenID -> CILogon issue
Date Fri, 29 Jul 2016 17:01:45 GMT
Repository: airavata-php-gateway
Updated Branches:
  refs/heads/develop 5146d9bf1 -> 66c8de253


hacky fix to WSO2 OpenID -> CILogon issue


Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/54bdf95f
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/54bdf95f
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/54bdf95f

Branch: refs/heads/develop
Commit: 54bdf95f34d26d825e2d0e86cad6a4d9f848e8a9
Parents: 349ccc6
Author: scnakandala <supun.nakandala@gmail.com>
Authored: Fri Jul 29 13:01:36 2016 -0400
Committer: scnakandala <supun.nakandala@gmail.com>
Committed: Fri Jul 29 13:01:36 2016 -0400

----------------------------------------------------------------------
 app/libraries/Wsis/Wsis.php | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/54bdf95f/app/libraries/Wsis/Wsis.php
----------------------------------------------------------------------
diff --git a/app/libraries/Wsis/Wsis.php b/app/libraries/Wsis/Wsis.php
index c7d929a..e764dd6 100755
--- a/app/libraries/Wsis/Wsis.php
+++ b/app/libraries/Wsis/Wsis.php
@@ -212,8 +212,20 @@ class Wsis {
      */
     public function getUserProfileFromOAuthToken($token){
         $userProfile = $this->oauthManger->getUserProfile($token);
-        return array('username'=>$userProfile->sub, 'email'=>$userProfile->email,
'firstname'=>$userProfile->given_name,
-            'lastname'=>$userProfile->family_name, 'roles'=>explode(",",$userProfile->roles));
+
+        //FIXME hacky fix for the CILogon -> OpenID issue in WSO2 IS
+        $sub = $userProfile->sub;
+        if(0 === strpos($sub, 'http:/')){
+            $mod_sub = substr ($sub ,6);
+        }else{
+            $mod_sub = $sub;
+        }
+        $userProfile = $this->getUserProfile($mod_sub);
+        $lastname = $userProfile['lastname'];
+        $firstname = $userProfile['firstname'];
+        $email = $userProfile['email'];
+        $roles = $this->getUserRoles($mod_sub);
+        return array('username'=>$sub, 'firstname'=>$firstname, 'lastname'=>$lastname,
'email'=>$email, 'roles'=>$roles);
     }
 
     /**
@@ -463,6 +475,10 @@ class Wsis {
      * @param $username
      */
     public function getUserProfile($username){
+        //FIXME hacky fix for the CILogon -> OpenID issue in WSO2 IS
+        if(0 === strpos($username, 'http:/')){
+            $username = substr ($username ,6);
+        }
         return $this->userProfileManager->getUserProfile($username);
     }
 


Mime
View raw message