use of org.xdi.oxauth.model.fido.u2f.U2fConfiguration in project oxAuth by GluuFederation.
the class U2fConfigurationWS method getConfiguration.
@GET
@Produces({ "application/json" })
@ApiOperation(value = "Provides configuration data as json document. It contains options and endpoints supported by the FIDO U2F server.", response = U2fConfiguration.class)
@ApiResponses(value = { @ApiResponse(code = 500, message = "Failed to build FIDO U2F configuration json object.") })
public Response getConfiguration() {
try {
final String baseEndpointUri = appConfiguration.getBaseEndpoint();
final U2fConfiguration conf = new U2fConfiguration();
conf.setVersion("2.0");
conf.setIssuer(appConfiguration.getIssuer());
conf.setRegistrationEndpoint(baseEndpointUri + "/fido/u2f/registration");
conf.setAuthenticationEndpoint(baseEndpointUri + "/fido/u2f/authentication");
// convert manually to avoid possible conflicts between resteasy
// providers, e.g. jettison, jackson
final String entity = ServerUtil.asPrettyJson(conf);
log.trace("FIDO U2F configuration: {}", entity);
return Response.ok(entity).build();
} catch (Throwable ex) {
log.error(ex.getMessage(), ex);
throw new WebApplicationException(Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorResponseFactory.getUmaJsonErrorResponse(U2fErrorResponseType.SERVER_ERROR)).build());
}
}
Aggregations