KEYCLOAK-7304
This commit is contained in:
parent
f3340b113f
commit
fdc6fc59b8
4 changed files with 29 additions and 3 deletions
|
@ -1096,6 +1096,10 @@ public class RepresentationToModel {
|
|||
if (entry.getValue() == null || entry.getValue().trim().equals("")) {
|
||||
continue;
|
||||
} else {
|
||||
String flowId = entry.getValue();
|
||||
if (client.getRealm().getAuthenticationFlowById(flowId) == null) {
|
||||
throw new RuntimeException("Unable to resolve auth flow binding override for: " + entry.getKey());
|
||||
}
|
||||
client.setAuthenticationFlowBindingOverride(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
@ -1230,8 +1234,11 @@ public class RepresentationToModel {
|
|||
if (entry.getValue() == null || entry.getValue().trim().equals("")) {
|
||||
resource.removeAuthenticationFlowBindingOverride(entry.getKey());
|
||||
} else {
|
||||
String flowId = entry.getValue();
|
||||
if (resource.getRealm().getAuthenticationFlowById(flowId) == null) {
|
||||
throw new RuntimeException("Unable to resolve auth flow binding override for: " + entry.getKey());
|
||||
}
|
||||
resource.setAuthenticationFlowBindingOverride(entry.getKey(), entry.getValue());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -348,6 +348,19 @@ public class FlowOverrideTest extends AbstractTestRealmKeycloakTest {
|
|||
clients.get(clientRep.getId()).update(clientRep);
|
||||
testWithClientBrowserOverride();
|
||||
|
||||
query = clients.findByClientId(TEST_APP_FLOW);
|
||||
clientRep = query.get(0);
|
||||
clientRep.getAuthenticationFlowBindingOverrides().put(AuthenticationFlowBindings.BROWSER_BINDING, "bad-id");
|
||||
try {
|
||||
clients.get(clientRep.getId()).update(clientRep);
|
||||
Assert.fail();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
query = clients.findByClientId(TEST_APP_FLOW);
|
||||
clientRep = query.get(0);
|
||||
Assert.assertEquals(browserFlowId, clientRep.getAuthenticationFlowBindingOverrides().get(AuthenticationFlowBindings.BROWSER_BINDING));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -832,6 +832,10 @@ module.controller('ClientInstallationCtrl', function($scope, realm, client, serv
|
|||
module.controller('ClientDetailCtrl', function($scope, realm, client, templates, flows, $route, serverInfo, Client, ClientDescriptionConverter, Components, ClientStorageOperations, $location, $modal, Dialog, Notifications) {
|
||||
$scope.flows = [];
|
||||
$scope.clientFlows = [];
|
||||
var emptyFlow = {
|
||||
id: "",
|
||||
alias: ""
|
||||
}
|
||||
for (var i=0 ; i<flows.length ; i++) {
|
||||
if (flows[i].providerId == 'client-flow') {
|
||||
$scope.clientFlows.push(flows[i]);
|
||||
|
@ -839,6 +843,8 @@ module.controller('ClientDetailCtrl', function($scope, realm, client, templates,
|
|||
$scope.flows.push(flows[i]);
|
||||
}
|
||||
}
|
||||
$scope.flows.push(emptyFlow)
|
||||
$scope.clientFlows.push(emptyFlow)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -441,7 +441,7 @@
|
|||
<label for="browser" class="col-md-2 control-label">{{:: 'browser-flow' | translate}}</label>
|
||||
<div class="col-md-2">
|
||||
<div>
|
||||
<select id="browser" data-ng-model="clientEdit.authenticationFlowBindingOverrides['browser']" class="form-control" ng-options="flow.alias as flow.alias for flow in flows">
|
||||
<select id="browser" data-ng-model="clientEdit.authenticationFlowBindingOverrides['browser']" class="form-control" ng-options="flow.id as flow.alias for flow in flows">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -451,7 +451,7 @@
|
|||
<label for="grant" class="col-md-2 control-label">{{:: 'direct-grant-flow' | translate}}</label>
|
||||
<div class="col-md-2">
|
||||
<div>
|
||||
<select id="grant" ng-model="clientEdit.authenticationFlowBindingOverrides['direct_grant']" class="form-control" ng-options="flow.alias as flow.alias for flow in flows">
|
||||
<select id="grant" ng-model="clientEdit.authenticationFlowBindingOverrides['direct_grant']" class="form-control" ng-options="flow.id as flow.alias for flow in flows">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue