use of org.gluu.oxtrust.api.server.util.LdapConfigurationDuplicatedException in project oxTrust by GluuFederation.
the class LDAPAuthenticationWebResource method createLdapConfiguration.
@POST
@Operation(summary = "Create a new configuration", description = "Create a new configuration")
@ApiResponses(value = { @ApiResponse(responseCode = "200", content = @Content(schema = @Schema(implementation = LdapConfigurationDTO.class)), description = "Success") })
@ProtectedApi(scopes = { WRITE_ACCESS })
public Response createLdapConfiguration(@Valid LdapConfigurationDTO ldapConfiguration) {
log(logger, "Create a new configuration");
try {
if (existingLdapConfigurationValidator.isInvalid(ldapConfiguration)) {
throw new LdapConfigurationDuplicatedException(ldapConfiguration.getConfigId());
}
GluuLdapConfiguration gluuLdapConfiguration = ldapConfigurationDtoAssembly.fromDto(ldapConfiguration);
ldapConfigurationService.save(gluuLdapConfiguration);
return Response.ok(read(ldapConfiguration.getConfigId())).build();
} catch (Exception e) {
log(logger, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
}
}
Aggregations