use of org.apache.knox.gateway.descriptor.ResourceDescriptor in project knox by apache.
the class GatewayDescriptorImpl method addResource.
@Override
public ResourceDescriptor addResource() {
ResourceDescriptor resource = createResource();
addResource(resource);
return resource;
}
use of org.apache.knox.gateway.descriptor.ResourceDescriptor in project knox by apache.
the class TestServiceDeploymentContributor method contributeService.
@Override
public void contributeService(DeploymentContext context, Service service) throws Exception {
ResourceDescriptor resource = context.getGatewayDescriptor().addResource();
resource.role(service.getRole());
resource.pattern("test-service-path/**?**");
addAuthenticationFilter(context, service, resource);
addIdentityAssertionFilter(context, service, resource);
addAuthorizationFilter(context, service, resource);
// addRewriteFilter( context, service, resource, null ); // This shouldn't be included for in-processes services.
context.contributeFilter(service, resource, "test-provider-role", "test-provider-name", null);
}
use of org.apache.knox.gateway.descriptor.ResourceDescriptor in project knox by apache.
the class ServiceTestDeploymentContributor method contributeService.
@Override
public void contributeService(DeploymentContext context, Service service) throws Exception {
String packages = StringUtils.join(getPackages(), ";");
for (String pattern : getPatterns()) {
ResourceDescriptor resource = context.getGatewayDescriptor().addResource();
resource.role(service.getRole());
resource.pattern(pattern);
addXForwardedFilter(context, service, resource);
// addAuthenticationFilter(context, service, resource);
// addIdentityAssertionFilter(context, service, resource);
// addAuthorizationFilter(context, service, resource);
// addRewriteFilter( context, service, resource, null );
List<FilterParamDescriptor> params = new ArrayList<FilterParamDescriptor>();
FilterParamDescriptor param = resource.createFilterParam();
param.name(PACKAGES_PARAM);
param.value(packages);
params.add(param);
FilterParamDescriptor traceType = resource.createFilterParam();
traceType.name("jersey.config.server.tracing");
traceType.value("ALL");
params.add(traceType);
FilterParamDescriptor traceLevel = resource.createFilterParam();
traceLevel.name("jersey.config.server.tracing.threshold");
traceLevel.value("VERBOSE");
params.add(traceLevel);
context.contributeFilter(service, resource, "pivot", "jersey", params);
context.contributeFilter(service, resource, "pivot", "jersey", params);
}
}
use of org.apache.knox.gateway.descriptor.ResourceDescriptor in project knox by apache.
the class TGSDeploymentContributor method contributeService.
@Override
public void contributeService(DeploymentContext context, Service service) throws URISyntaxException {
ResourceDescriptor resource = context.getGatewayDescriptor().addResource();
resource.role(service.getRole());
resource.pattern(TGS_EXTERNAL_PATH + "/accesstoken");
if (topologyContainsProviderType(context, "authentication")) {
context.contributeFilter(service, resource, "authentication", null, null);
}
if (topologyContainsProviderType(context, "federation")) {
context.contributeFilter(service, resource, "federation", null, null);
}
context.contributeFilter(service, resource, "identity-assertion", null, null);
}
use of org.apache.knox.gateway.descriptor.ResourceDescriptor in project knox by apache.
the class ApplicationDeploymentContributor method contributeResource.
private void contributeResource(DeploymentContext context, Service service, Route binding, Map<String, String> filterParams) throws URISyntaxException {
List<FilterParamDescriptor> params = new ArrayList<FilterParamDescriptor>();
ResourceDescriptor resource = context.getGatewayDescriptor().addResource();
resource.role(service.getRole());
resource.pattern(binding.getPath());
// add x-forwarded filter if enabled in config
if (context.getGatewayConfig().isXForwardedEnabled()) {
resource.addFilter().name(XFORWARDED_FILTER_NAME).role(XFORWARDED_FILTER_ROLE).impl(XForwardedHeaderFilter.class);
}
if (context.getGatewayConfig().isCookieScopingToPathEnabled()) {
FilterDescriptor filter = resource.addFilter().name(COOKIE_SCOPING_FILTER_NAME).role(COOKIE_SCOPING_FILTER_ROLE).impl(CookieScopeServletFilter.class);
filter.param().name(GatewayConfigImpl.HTTP_PATH).value(context.getGatewayConfig().getGatewayPath());
}
List<Policy> policyBindings = binding.getPolicies();
if (policyBindings == null) {
policyBindings = serviceDefinition.getPolicies();
}
if (policyBindings == null) {
// add default set
addDefaultPolicies(context, service, filterParams, params, resource);
} else {
addPolicies(context, service, filterParams, params, resource, policyBindings);
}
}
Aggregations