keycloak-aplcache

Merge pull request #1706 from girirajsharma/Patch-Keycloak-1931 [KEYCLOAK-1931]

10/12/2015 8:48:45 AM

Details

diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js
index d100df7..37998e5 100755
--- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js
+++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js
@@ -1745,6 +1745,7 @@ module.controller('AuthenticationFlowsCtrl', function($scope, $route, realm, flo
                     execution.postLevels.push(j);
                 }
             }
+            $location.url("/realms/" + realm.realm + "/authentication/flows/" + $scope.flow.alias);
         })
     };
 
diff --git a/services/src/main/java/org/keycloak/services/resources/admin/AuthenticationManagementResource.java b/services/src/main/java/org/keycloak/services/resources/admin/AuthenticationManagementResource.java
index ede2e27..4b523a1 100755
--- a/services/src/main/java/org/keycloak/services/resources/admin/AuthenticationManagementResource.java
+++ b/services/src/main/java/org/keycloak/services/resources/admin/AuthenticationManagementResource.java
@@ -323,6 +323,14 @@ public class AuthenticationManagementResource {
         if (flow.isBuiltIn()) {
             throw new BadRequestException("Can't delete built in flow");
         }
+        List<AuthenticationExecutionModel> executions = realm.getAuthenticationExecutions(id);
+        for (AuthenticationExecutionModel execution : executions) {
+        	if(execution.getFlowId() != null) {
+        		AuthenticationFlowModel nonTopLevelFlow = realm.getAuthenticationFlowById(execution.getFlowId());
+        		realm.removeAuthenticationFlow(nonTopLevelFlow);
+        	}
+        	realm.removeAuthenticatorExecution(execution);
+        }
         realm.removeAuthenticationFlow(flow);
     }