[KEYCLOAK-1993] It's possible to create new authentication flow with empty name within another flow

This commit is contained in:
girirajsharma 2015-10-24 22:09:27 +05:30
parent 15828e899b
commit 4075d65241
2 changed files with 5 additions and 1 deletions

View file

@ -7,7 +7,7 @@
<div class="form-group">
<label class="col-md-2 control-label" for="alias">Alias </label>
<div class="col-sm-6">
<input class="form-control" type="text" id="alias" name="alias" data-ng-model="flow.alias" autofocus>
<input class="form-control" type="text" id="alias" name="alias" data-ng-model="flow.alias" autofocus required>
</div>
<kc-tooltip>Specifies display name for the flow.</kc-tooltip>
</div>

View file

@ -276,6 +276,10 @@ public class AuthenticationManagementResource {
@Consumes(MediaType.APPLICATION_JSON)
public Response createFlow(AuthenticationFlowModel model) {
this.auth.requireManage();
if (model.getAlias() == null || model.getAlias().isEmpty()) {
return ErrorResponse.exists("Failed to create flow with empty alias name");
}
if (realm.getFlowByAlias(model.getAlias()) != null) {
return ErrorResponse.exists("Flow " + model.getAlias() + " already exists");