use of io.gravitee.am.service.exception.AccessPolicyNotFoundException in project gravitee-access-management by gravitee-io.
the class ResourceAccessPoliciesEndpoint method get.
public void get(RoutingContext context) {
final JWT accessToken = context.get(ConstantKeys.TOKEN_CONTEXT_KEY);
final Client client = context.get(ConstantKeys.CLIENT_CONTEXT_KEY);
final String resource = context.request().getParam(RESOURCE_ID);
final String accessPolicyId = context.request().getParam(POLICY_ID);
resourceService.findAccessPolicy(domain.getId(), client.getId(), accessToken.getSub(), resource, accessPolicyId).switchIfEmpty(Single.error(new AccessPolicyNotFoundException(accessPolicyId))).subscribe(response -> context.response().putHeader(HttpHeaders.CACHE_CONTROL, "no-store").putHeader(HttpHeaders.PRAGMA, "no-cache").putHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).end(Json.encodePrettily(response)), error -> context.fail(error));
}
Aggregations