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..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;
@@ -1830,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 @@
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() {
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);
}