Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C2649200C91 for ; Sun, 11 Jun 2017 22:25:35 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C131D160BD7; Sun, 11 Jun 2017 20:25:35 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id ACA9E160BF1 for ; Sun, 11 Jun 2017 22:25:34 +0200 (CEST) Received: (qmail 83849 invoked by uid 500); 11 Jun 2017 20:25:33 -0000 Mailing-List: contact commits-help@airavata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airavata.apache.org Delivered-To: mailing list commits@airavata.apache.org Received: (qmail 83753 invoked by uid 99); 11 Jun 2017 20:25:33 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 11 Jun 2017 20:25:33 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 18BF6DFF2D; Sun, 11 Jun 2017 20:25:30 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: machristie@apache.org To: commits@airavata.apache.org Date: Sun, 11 Jun 2017 20:25:40 -0000 Message-Id: <9cc31955746c42049ad8816e74802bf4@git.apache.org> In-Reply-To: <954e9200c53c45f1b1b1986bc5868a8a@git.apache.org> References: <954e9200c53c45f1b1b1986bc5868a8a@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [11/12] airavata-php-gateway git commit: Merge branch 'AIRAVATA-2316-user-profile-service' into keycloak-integration archived-at: Sun, 11 Jun 2017 20:25:35 -0000 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 Authored: Fri Jun 9 17:00:40 2017 -0400 Committer: Marcus Christie 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 ----------------------------------------------------------------------