use of org.xdi.oxauth.model.gluu.GluuConfiguration in project oxAuth by GluuFederation.
the class GluuConfigurationWSTest method getConfigurationTest.
@RunAsClient
@Parameters({ "gluuConfigurationPath", "webTarget" })
@Consumes(MediaType.APPLICATION_JSON)
@Test
public void getConfigurationTest(String gluuConfigurationPath, @Optional @ArquillianResteasyResource("seam/resource") final WebTarget webTarget) throws Exception {
Response response = webTarget.path(gluuConfigurationPath).request().get();
String entity = response.readEntity(String.class);
BaseTest.showResponse("UMA : TConfiguration.configuration", response, entity);
assertEquals(response.getStatus(), 200, "Unexpected response code.");
try {
GluuConfiguration appConfiguration = ServerUtil.createJsonMapper().readValue(entity, GluuConfiguration.class);
System.err.println(appConfiguration.getIdGenerationEndpoint());
assertNotNull(appConfiguration, "Meta data configuration is null");
assertNotNull(appConfiguration.getIdGenerationEndpoint());
assertNotNull(appConfiguration.getIntrospectionEndpoint());
assertNotNull(appConfiguration.getAuthLevelMapping());
assertNotNull(appConfiguration.getScopeToClaimsMapping());
} catch (IOException e) {
e.printStackTrace();
fail();
}
}
use of org.xdi.oxauth.model.gluu.GluuConfiguration in project oxAuth by GluuFederation.
the class GluuConfigurationWS method getConfiguration.
@GET
@Produces({ "application/json" })
@ApiOperation(value = "Provides configuration data as json document. It contains non-standard OpenID Connect discovery metadata supported by the Gluu server.", response = GluuConfiguration.class)
@ApiResponses(value = { @ApiResponse(code = 500, message = "Failed to build gluu configuration json object.") })
public Response getConfiguration() {
try {
final GluuConfiguration conf = new GluuConfiguration();
conf.setIdGenerationEndpoint(appConfiguration.getIdGenerationEndpoint());
conf.setIntrospectionEndpoint(appConfiguration.getIntrospectionEndpoint());
conf.setAuthLevelMapping(createAuthLevelMapping());
conf.setScopeToClaimsMapping(createScopeToClaimsMapping());
// convert manually to avoid possible conflicts between resteasy
// providers, e.g. jettison, jackson
final String entity = ServerUtil.asPrettyJson(conf);
log.trace("Gluu 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.getErrorResponse(GluuErrorResponseType.SERVER_ERROR)).build());
}
}
Aggregations