From b277afa6d94e4115ea5db710960325a02a48e463 Mon Sep 17 00:00:00 2001 From: Sebastian Rose Date: Sat, 10 Oct 2015 10:40:16 +0200 Subject: [PATCH 1/4] KEYCLOAK-1910, added same fix for registrations endpoint --- .../protocol/oidc/endpoints/AuthorizationEndpoint.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/services/src/main/java/org/keycloak/protocol/oidc/endpoints/AuthorizationEndpoint.java b/services/src/main/java/org/keycloak/protocol/oidc/endpoints/AuthorizationEndpoint.java index 23c943ec3c..7c51b74df0 100755 --- a/services/src/main/java/org/keycloak/protocol/oidc/endpoints/AuthorizationEndpoint.java +++ b/services/src/main/java/org/keycloak/protocol/oidc/endpoints/AuthorizationEndpoint.java @@ -17,7 +17,6 @@ import org.keycloak.models.ClientSessionModel; import org.keycloak.models.IdentityProviderModel; import org.keycloak.models.KeycloakSession; import org.keycloak.models.RealmModel; -import org.keycloak.models.utils.DefaultAuthenticationFlows; import org.keycloak.models.utils.KeycloakModelUtils; import org.keycloak.protocol.RestartLoginCookie; import org.keycloak.protocol.oidc.OIDCLoginProtocol; @@ -310,9 +309,12 @@ public class AuthorizationEndpoint { private Response buildRegister() { authManager.expireIdentityCookie(realm, uriInfo, clientConnection); - return session.getProvider(LoginFormsProvider.class) - .setClientSessionCode(new ClientSessionCode(realm, clientSession).getCode()) - .createRegistration(); + AuthenticationFlowModel flow = realm.getRegistrationFlow(); + String flowId = flow.getId(); + + AuthenticationProcessor processor = createProcessor(flowId, LoginActionsService.REGISTRATION_PATH); + + return processor.authenticate(); } private Response buildForgotCredential() { From 115663a32db3b5574fc54efc9850503322621287 Mon Sep 17 00:00:00 2001 From: girirajsharma Date: Sat, 10 Oct 2015 00:55:03 +0530 Subject: [PATCH 2/4] [KEYCLOAK-1932] Unable to create flow named exactly the same as removed NON-top level flow --- .../resources/admin/AuthenticationManagementResource.java | 8 ++++++++ 1 file changed, 8 insertions(+) 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 ede2e278a7..4b523a16c9 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 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); } From 639b5b617bf688a1021a5e78557c2704da2b1b93 Mon Sep 17 00:00:00 2001 From: girirajsharma Date: Sun, 11 Oct 2015 12:41:32 +0530 Subject: [PATCH 3/4] [KEYCLOAK-1931] UI doesn't reflect when flow is deleted --- .../resources/theme/base/admin/resources/js/controllers/realm.js | 1 + 1 file changed, 1 insertion(+) 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 d100df752a..37998e5e5f 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); }) }; From 20b92c410f39a95ad75c39b94717a33eead58c28 Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Mon, 12 Oct 2015 14:02:56 +0200 Subject: [PATCH 4/4] Fix for issue introduced by fixing KEYCLOAK-1931 --- .../base/admin/resources/js/controllers/realm.js | 13 +++++++++---- .../resources/partials/authentication-flows.html | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) 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 37998e5e5f..af93ac8da1 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 @@ -1711,6 +1711,10 @@ module.controller('AuthenticationFlowsCtrl', function($scope, $route, realm, flo } } + $scope.selectFlow = function(flow) { + $location.url("/realms/" + realm.realm + '/authentication/flows/' + flow.alias); + }; + var setupForm = function() { AuthenticationFlowExecutions.query({realm: realm.realm, alias: $scope.flow.alias}, function(data) { $scope.executions = data; @@ -1745,7 +1749,6 @@ module.controller('AuthenticationFlowsCtrl', function($scope, $route, realm, flo execution.postLevels.push(j); } } - $location.url("/realms/" + realm.realm + "/authentication/flows/" + $scope.flow.alias); }) }; @@ -1831,9 +1834,11 @@ module.controller('AuthenticationFlowsCtrl', function($scope, $route, realm, flo $scope.setupForm = setupForm; - setupForm(); - - + if (selectedFlow == null) { + $scope.selectFlow(flows[0]); + } else { + setupForm(); + } }); module.controller('RequiredActionsCtrl', function($scope, realm, unregisteredRequiredActions, diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/authentication-flows.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/authentication-flows.html index eb26ba359d..09afda2d0d 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/authentication-flows.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/authentication-flows.html @@ -10,7 +10,7 @@