use of io.jans.scim.service.scim2.interceptor.RejectFilterParam in project oxTrust by GluuFederation.
the class ResourceTypeWS method serve.
@GET
@Produces(MEDIA_TYPE_SCIM_JSON + UTF8_CHARSET_FRAGMENT)
@HeaderParam("Accept")
@DefaultValue(MEDIA_TYPE_SCIM_JSON)
@RejectFilterParam
public Response serve() {
try {
ListResponse listResponse = new ListResponse(1, 3, 3);
listResponse.addResource(getUserResourceType());
listResponse.addResource(getGroupResourceType());
listResponse.addResource(getFidoDeviceResourceType());
String json = resourceSerializer.getListResponseMapper().writeValueAsString(listResponse);
return Response.ok(json).location(new URI(endpointUrl)).build();
} catch (Exception e) {
log.error(e.getMessage(), e);
return getErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, "Unexpected error: " + e.getMessage());
}
}
use of io.jans.scim.service.scim2.interceptor.RejectFilterParam in project oxTrust by GluuFederation.
the class ServiceProviderConfigWS method serve.
@GET
@Produces(MEDIA_TYPE_SCIM_JSON + UTF8_CHARSET_FRAGMENT)
@HeaderParam("Accept")
@DefaultValue(MEDIA_TYPE_SCIM_JSON)
@RejectFilterParam
public Response serve() {
try {
ServiceProviderConfig serviceProviderConfig = new ServiceProviderConfig();
serviceProviderConfig.getFilter().setMaxResults(appConfiguration.getScimProperties().getMaxCount());
Meta meta = new Meta();
meta.setLocation(endpointUrl);
meta.setResourceType(ScimResourceUtil.getType(serviceProviderConfig.getClass()));
serviceProviderConfig.setMeta(meta);
boolean onTestMode = appConfiguration.isScimTestMode();
serviceProviderConfig.setAuthenticationSchemes(Arrays.asList(AuthenticationScheme.createOAuth2(onTestMode), AuthenticationScheme.createUma(!onTestMode)));
return Response.ok(resourceSerializer.serialize(serviceProviderConfig)).build();
} catch (Exception e) {
log.error(e.getMessage(), e);
return getErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, "Unexpected error: " + e.getMessage());
}
}
use of io.jans.scim.service.scim2.interceptor.RejectFilterParam in project jans by JanssenProject.
the class ServiceProviderConfigWS method serve.
@GET
@Produces(MEDIA_TYPE_SCIM_JSON + UTF8_CHARSET_FRAGMENT)
@HeaderParam("Accept")
@DefaultValue(MEDIA_TYPE_SCIM_JSON)
@RejectFilterParam
public Response serve() {
try {
ServiceProviderConfig serviceProviderConfig = new ServiceProviderConfig();
serviceProviderConfig.getFilter().setMaxResults(appConfiguration.getMaxCount());
Meta meta = new Meta();
meta.setLocation(endpointUrl);
meta.setResourceType(ScimResourceUtil.getType(serviceProviderConfig.getClass()));
serviceProviderConfig.setMeta(meta);
serviceProviderConfig.setAuthenticationSchemes(Collections.singletonList(AuthenticationScheme.createOAuth2(true)));
return Response.ok(resourceSerializer.serialize(serviceProviderConfig)).build();
} catch (Exception e) {
log.error(e.getMessage(), e);
return getErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, "Unexpected error: " + e.getMessage());
}
}
use of io.jans.scim.service.scim2.interceptor.RejectFilterParam in project oxTrust by GluuFederation.
the class SchemaWebService method serve.
@GET
@Produces(MEDIA_TYPE_SCIM_JSON + UTF8_CHARSET_FRAGMENT)
@HeaderParam("Accept")
@DefaultValue(MEDIA_TYPE_SCIM_JSON)
@RejectFilterParam
public Response serve() {
Response response;
try {
int total = resourceSchemas.size();
ListResponse listResponse = new ListResponse(1, total, total);
for (String urn : resourceSchemas.keySet()) {
listResponse.addResource(getSchemaInstance(resourceSchemas.get(urn), urn));
}
String json = resourceSerializer.getListResponseMapper().writeValueAsString(listResponse);
response = Response.ok(json).location(new URI(endpointUrl)).build();
} catch (Exception e) {
log.error("Failure at serve method", e);
response = getErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, "Unexpected error: " + e.getMessage());
}
return response;
}
use of io.jans.scim.service.scim2.interceptor.RejectFilterParam in project oxTrust by GluuFederation.
the class SchemaWebService method getSchemaById.
@GET
@Path("{schemaUrn}")
@Produces(MEDIA_TYPE_SCIM_JSON + UTF8_CHARSET_FRAGMENT)
@HeaderParam("Accept")
@DefaultValue(MEDIA_TYPE_SCIM_JSON)
@RejectFilterParam
public Response getSchemaById(@PathParam("schemaUrn") String urn) {
Response response;
try {
Class<? extends BaseScimResource> cls = resourceSchemas.get(urn);
if (cls == null) {
log.info("Schema urn {} not recognized", urn);
response = Response.status(Response.Status.NOT_FOUND).build();
} else {
String json = resourceSerializer.serialize(getSchemaInstance(cls, urn));
URI location = new URI(endpointUrl + "/" + urn);
response = Response.ok(json).location(location).build();
}
} catch (Exception e) {
log.error("Failure at getSchemaById method", e);
response = getErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, "Unexpected error: " + e.getMessage());
}
return response;
}
Aggregations