[KEYCLOAK-7569] support for authentication flow update

Added support for the PUT method of the authentication flow endpoint in
the admin API.

Now it's possible to run the 'update' method for authentication/flows in
kcadm.sh.
This commit is contained in:
wyvie 2018-06-28 18:27:01 +02:00 committed by Marek Posolda
parent 65551159e0
commit 1450a7fad4

View file

@ -246,6 +246,32 @@ public class AuthenticationManagementResource {
return ModelToRepresentation.toRepresentation(realm, flow);
}
/**
* Update an authentication flow
*
* @param flow Authentication flow representation
* @return
*/
@Path("/flows/{id}")
@PUT
@NoCache
@Consumes(MediaType.APPLICATION_JSON)
public Response updateFlow(@PathParam("id") String id, AuthenticationFlowRepresentation flow) {
auth.realm().requireManageRealm();
AuthenticationFlowRepresentation existingFlow = getFlow(id);
if (flow.getAlias() == null || flow.getAlias().isEmpty()) {
return ErrorResponse.exists("Failed to update flow with empty alias name");
}
flow.setId(existingFlow.getId());
realm.updateAuthenticationFlow(RepresentationToModel.toModel(flow));
adminEvent.operation(OperationType.UPDATE).resourcePath(uriInfo).representation(flow).success();
return Response.accepted(flow).build();
}
/**
* Delete an authentication flow
*