You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2017/06/11 20:25:40 UTC
[11/12] airavata-php-gateway git commit: Merge branch
'AIRAVATA-2316-user-profile-service' into keycloak-integration
Merge branch 'AIRAVATA-2316-user-profile-service' into keycloak-integration
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/31b1ca84
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/31b1ca84
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/31b1ca84
Branch: refs/heads/keycloak-integration
Commit: 31b1ca844402ffbeaee3bd6c4e1a77c7684d9c2f
Parents: d021668 05250ee
Author: Marcus Christie <ma...@iu.edu>
Authored: Fri Jun 9 17:00:40 2017 -0400
Committer: Marcus Christie <ma...@iu.edu>
Committed: Fri Jun 9 17:00:40 2017 -0400
----------------------------------------------------------------------
app/controllers/AccountController.php | 27 +-
app/controllers/AdminController.php | 12 +-
app/controllers/UserSettingsController.php | 39 ++
app/libraries/AdminUtilities.php | 3 +-
app/libraries/Airavata/API/Airavata.php | 466 ++++++++++++++++++-
app/libraries/UserProfileUtilities.php | 48 ++
app/routes.php | 3 +
app/views/account/settings.blade.php | 16 +
app/views/account/user-profile.blade.php | 94 ++++
app/views/layout/basic.blade.php | 4 +-
app/views/layout/fixed-scripts.blade.php | 8 +-
.../user-profile-phone-template.blade.php | 9 +
public/css/bootstrap.min.css | 2 +-
13 files changed, 686 insertions(+), 45 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/31b1ca84/app/controllers/AccountController.php
----------------------------------------------------------------------
diff --cc app/controllers/AccountController.php
index d8d4a4e,3e70133..99709df
--- a/app/controllers/AccountController.php
+++ b/app/controllers/AccountController.php
@@@ -123,12 -110,20 +123,13 @@@ class AccountController extends BaseCon
$accessToken = $response->access_token;
$refreshToken = $response->refresh_token;
- $expirationTime = time() + $response->expires_in - 5; //5 seconds safe margin
+ $expirationTime = time() + $response->expires_in - 300; // 5 minutes safe margin
- $userProfile = WSIS::getUserProfileFromOAuthToken($accessToken);
+ $userProfile = Keycloak::getUserProfileFromOAuthToken($accessToken);
$username = $userProfile['username'];
$userRoles = $userProfile['roles'];
+ $userEmail = $userProfile["email"];
- //FIXME There is a bug in WSO2 IS which doest not return the admin role for the default admin user.
- //FIXME Hence as a workaround we manually add it here.
- if ($username == Config::get('pga_config.wsis')['admin-username']
- || $username == Config::get('pga_config.wsis')['admin-username'] . '@' . Config::get('pga_config.wsis')['tenant-domain']){
- $userRoles[] = Config::get('pga_config.wsis')['admin-role-name'];
- }
-
$authzToken = new Airavata\Model\Security\AuthzToken();
$authzToken->accessToken = $accessToken;
$authzToken->claimsMap['gatewayID'] = Config::get('pga_config.airavata')['gateway-id'];
@@@ -189,13 -183,12 +189,13 @@@
$accessToken = $response->access_token;
$refreshToken = $response->refresh_token;
- $expirationTime = time() + $response->expires_in - 5; //5 seconds safe margin
+ $expirationTime = time() + $response->expires_in - 300; //5 minutes safe margin
- $userProfile = WSIS::getUserProfileFromOAuthToken($accessToken);
+ $userProfile = Keycloak::getUserProfileFromOAuthToken($accessToken);
+ Log::debug("userProfile", array($userProfile));
$username = $userProfile['username'];
-
$userRoles = $userProfile['roles'];
+ $userEmail = $userProfile['email'];
//FIXME There is a bug in WSO2 IS which doest not return the admin role for the default admin user.
//FIXME Hence as a workaround we manually add it here.
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/31b1ca84/app/controllers/AdminController.php
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/31b1ca84/app/views/layout/basic.blade.php
----------------------------------------------------------------------