use of org.gluu.oxtrust.model.scim2.provider.config.ServiceProviderConfig in project oxTrust by GluuFederation.
the class ServiceProviderConfigWS method listGroups.
@GET
@Produces(Constants.MEDIA_TYPE_SCIM_JSON + "; charset=utf-8")
@HeaderParam("Accept")
@DefaultValue(Constants.MEDIA_TYPE_SCIM_JSON)
public Response listGroups(@HeaderParam("Authorization") String authorization) throws Exception {
ServiceProviderConfig serviceProviderConfig = new ServiceProviderConfig();
Meta meta = new Meta();
meta.setLocation(appConfiguration.getBaseEndpoint() + "/scim/v2/ServiceProviderConfig");
meta.setResourceType("ServiceProviderConfig");
serviceProviderConfig.setMeta(meta);
ArrayList<AuthenticationScheme> authenticationSchemes = new ArrayList<AuthenticationScheme>();
if (appConfiguration.isScimTestMode()) {
log.info(" ##### SCIM Test Mode is ACTIVE");
authenticationSchemes.add(AuthenticationScheme.createOAuth2(true));
} else {
authenticationSchemes.add(AuthenticationScheme.createUma(true));
}
serviceProviderConfig.setAuthenticationSchemes(authenticationSchemes);
URI location = new URI(appConfiguration.getBaseEndpoint() + "/scim/v2/ServiceProviderConfig");
return Response.ok(serviceProviderConfig).location(location).build();
}
use of org.gluu.oxtrust.model.scim2.provider.config.ServiceProviderConfig 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());
}
}
Aggregations