Add logout redirect URL when setting up Keycloak realm

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

Branch: refs/heads/keycloak-prod-migration
Commit: b8449f566b9335953296588255d9e28c2601fec8
Parents: ec20fe5
Author: Marcus Christie <[email protected]>
Authored: Fri Jun 30 11:30:54 2017 -0400
Committer: Marcus Christie <[email protected]>
Committed: Fri Jun 30 11:30:54 2017 -0400

----------------------------------------------------------------------
 .../core/impl/TenantManagementKeycloakImpl.java         | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/b8449f56/airavata-services/profile-service/iam-admin-services-core/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/impl/TenantManagementKeycloakImpl.java
----------------------------------------------------------------------
diff --git 
a/airavata-services/profile-service/iam-admin-services-core/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/impl/TenantManagementKeycloakImpl.java
 
b/airavata-services/profile-service/iam-admin-services-core/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/impl/TenantManagementKeycloakImpl.java
index 6ae0082..7448f62 100644
--- 
a/airavata-services/profile-service/iam-admin-services-core/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/impl/TenantManagementKeycloakImpl.java
+++ 
b/airavata-services/profile-service/iam-admin-services-core/src/main/java/org/apache/airavata/service/profile/iam/admin/services/core/impl/TenantManagementKeycloakImpl.java
@@ -237,11 +237,15 @@ public class TenantManagementKeycloakImpl implements 
TenantManagementInterface {
             pgaClient.setDefaultRoles(defaultRoles);
             List<String> redirectUris = new ArrayList<>();
             if(gatewayDetails.getGatewayURL()!=null){
-                if(gatewayDetails.getGatewayURL().endsWith("/")){
-                    redirectUris.add(gatewayDetails.getGatewayURL() + 
"callback-url");
-                } else {
-                    redirectUris.add(gatewayDetails.getGatewayURL() + 
"/callback-url");
+                String gatewayURL = gatewayDetails.getGatewayURL();
+                // Remove trailing slash from gatewayURL
+                if(gatewayURL.endsWith("/")) {
+                    gatewayURL = gatewayURL.substring(0, gatewayURL.length() - 
1);
                 }
+                // Add redirect URL after login
+                redirectUris.add(gatewayURL + "/callback-url");
+                // Add redirect URL after logout
+                redirectUris.add(gatewayURL);
             } else {
                 logger.error("Request for Realm Client Creation failed, 
callback URL not present");
                 IamAdminServicesException ex = new IamAdminServicesException();

Reply via email to