Open jnorthrup opened 9 years ago
punching in some global objects as spring-util and xacml-specified
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:beans xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" xmlns:ns2="http://www.springframework.org/schema/beans" xmlns:ns3="http://www.springframework.org/schema/util" xmlns:ns4="http://camel.apache.org/schema/spring">
<ns2:description>beans::foo n0</ns2:description>
<ns2:bean class="oasis.names.tc.xacml._3_0.core.schema.wd_17.RequestType" scope="prototype" lazy-init="default" id="theRequest"/>
<ns2:bean class="oasis.names.tc.xacml._3_0.core.schema.wd_17.ResponseType" scope="prototype" lazy-init="true" id="theResponse"/>
<ns3:map id="EnvData" scope="singleton" key-type="java.lang.String">
<ns2:description>Env data</ns2:description>
</ns3:map>
<ns3:map id="PIPdata" scope="prototype" key-type="java.lang.String">
<ns2:description>PIP data</ns2:description>
</ns3:map>
<ns4:camelContext id="n1-SimplePolicy1">
<ns4:route id="n2">
<ns4:description> Medi Corp access control policy
+trace.out: visitPolicy (PolicyVisitor.java:153 )</ns4:description>
</ns4:route>
<ns4:route id="n3">
<ns4:from ref="n2"/>
</ns4:route>
<ns4:route id="n4">
<ns4:from ref="urn:oasis:names:tc:xacml:3.0:example:SimpleRule1"/>
</ns4:route>
</ns4:camelContext>
</ns2:beans>
stubbing in the main binding glue
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:beans xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" xmlns:ns2="http://www.springframework.org/schema/beans" xmlns:ns3="http://www.springframework.org/schema/util" xmlns:ns4="http://camel.apache.org/schema/spring">
<ns2:description>beans::foo n0</ns2:description>
<ns2:bean class="oasis.names.tc.xacml._3_0.core.schema.wd_17.RequestType" scope="prototype" lazy-init="default" id="theRequest"/>
<ns2:bean class="oasis.names.tc.xacml._3_0.core.schema.wd_17.ResponseType" scope="prototype" lazy-init="true" id="theResponse"/>
<ns3:map id="EnvData" scope="singleton" key-type="java.lang.String">
<ns2:description>Env data</ns2:description>
</ns3:map>
<ns3:map id="PIPdata" scope="prototype" key-type="java.lang.String">
<ns2:description>PIP data</ns2:description>
</ns3:map>
<ns4:camelContext id="n1-SimplePolicy1">
<ns4:route id="n2">
<ns4:description> Medi Corp access control policy
+trace.out: visitPolicy (PolicyVisitor.java:156 )</ns4:description>
</ns4:route>
<ns4:route id="n3">
<ns4:from ref="n2"/>
</ns4:route>
<ns4:route id="n4">
<ns4:from ref="urn:oasis:names:tc:xacml:3.0:example:SimpleRule1"/>
<ns4:filter>
<ns4:simple>specified.XacmlFunctionProto.from("urn:oasis:names:tc:xacml:1.0:function:rfc822Name-match").apply('med.example.com', ${body['urn:oasis:names:tc:xacml:1.0:subject-category:access-subject.urn:oasis:names:tc:xacml:1.0:subject:subject-id'] });</ns4:simple>
<ns4:to uri="direct:permit"/>
<ns4:otherwise>
<ns4:to uri="direct:deny"/>
</ns4:otherwise>
</ns4:filter>
</ns4:route>
</ns4:camelContext>
</ns2:beans>
hawtio plugin:
generation-time configs:
// -Dxcaml.rest.provider="netty4-http"
// -Dxcaml.rest.host="0.0.0.0"
// -Dxcaml.rest.port="8901"
// -Dxcaml.input="/home/jim/work/xcaml/pdp-core/src/test/resources/policy1.xml"
// -Dxcaml.output="/home/jim/work/xcaml/pdp-core/src/main/resources/META-INF/spring/xacmlroute"
launches rest and routes
[org.apache.camel.spring.Main.main()] INFO org.apache.camel.main.MainSupport - Apache Camel 2.15.0 starting
Apr 03, 2015 12:09:28 PM org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@5d91ded7: startup date [Fri Apr 03 12:09:28 PDT 2015]; root of context hierarchy
Apr 03, 2015 12:09:28 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from file [/vol/big240/snap/jim/work/xcaml/pdp-core/target/classes/META-INF/spring/xacmlroute.spring.xml]
[org.apache.camel.spring.Main.main()] INFO org.apache.camel.impl.converter.DefaultTypeConverter - Loaded 213 type converters
[org.apache.camel.spring.Main.main()] INFO org.apache.camel.spring.SpringCamelContext - Apache Camel 2.15.0 (CamelContext: n6-SimplePolicy1) is starting
[org.apache.camel.spring.Main.main()] INFO org.apache.camel.management.ManagedManagementStrategy - JMX is enabled
[org.apache.camel.spring.Main.main()] INFO org.apache.camel.component.jackson.JacksonDataFormat - Registering module: com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule@2bce021d
[org.apache.camel.spring.Main.main()] INFO org.apache.camel.component.jackson.JacksonDataFormat - Registering module: com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule@298d3016
[org.apache.camel.spring.Main.main()] INFO org.apache.camel.spring.SpringCamelContext - AllowUseOriginalMessage is enabled. If access to the original message is not needed, then its recommended to turn this option off as it may improve performance.
[org.apache.camel.spring.Main.main()] INFO org.apache.camel.spring.SpringCamelContext - StreamCaching is not in use. If using streams then its recommended to enable stream caching. See more details at http://camel.apache.org/stream-caching.html
[org.apache.camel.spring.Main.main()] INFO org.apache.camel.component.netty4.http.HttpServerBootstrapFactory - BootstrapFactory on port 8901 is using bootstrap configuration: [NettyServerBootstrapConfiguration{protocol='tcp', host='0.0.0.0', port=8901, broadcast=false, sendBufferSize=65536, receiveBufferSize=65536, receiveBufferSizePredictor=0, workerCount=0, bossCount=1, keepAlive=true, tcpNoDelay=true, reuseAddress=true, connectTimeout=10000, backlog=0, serverInitializerFactory=org.apache.camel.component.netty4.http.HttpServerInitializerFactory@6e4b4b1e, nettyServerBootstrapFactory=null, options=null, ssl=false, sslHandler=null, sslContextParameters='null', needClientAuth=false, enabledProtocols='TLSv1,TLSv1.1,TLSv1.2, keyStoreFile=null, trustStoreFile=null, keyStoreResource='null', trustStoreResource='null', keyStoreFormat='JKS', securityProvider='SunX509', passphrase='null', bossGroup=null, workerGroup=null, networkInterface='null'}]
[org.apache.camel.spring.Main.main()] INFO org.apache.camel.spring.SpringCamelContext - Route: n5 started and consuming from: Endpoint[direct://request]
[org.apache.camel.spring.Main.main()] INFO org.apache.camel.spring.SpringCamelContext - Route: n1 started and consuming from: Endpoint[direct://start]
[org.apache.camel.spring.Main.main()] INFO org.apache.camel.component.netty4.SingleTCPNettyServerBootstrapFactory - ServerBootstrap binding to 0.0.0.0:8901
[org.apache.camel.spring.Main.main()] INFO org.apache.camel.component.netty4.NettyConsumer - Netty consumer bound to: 0.0.0.0:8901
[org.apache.camel.spring.Main.main()] INFO org.apache.camel.spring.SpringCamelContext - Route: route1 started and consuming from: Endpoint[http://0.0.0.0:8901/pdp?httpMethodRestrict=POST]
[org.apache.camel.spring.Main.main()] INFO org.apache.camel.spring.SpringCamelContext - Total 3 routes, of which 3 is started.
[org.apache.camel.spring.Main.main()] INFO org.apache.camel.spring.SpringCamelContext - Apache Camel 2.15.0 (CamelContext: n6-SimplePolicy1) started in 0.274 seconds
[qtp1036976789-29] INFO io.hawt.web.keycloak.KeycloakServlet - Keycloak integration is disabled
spring xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:beans xmlns="http://camel.apache.org/schema/spring" xmlns:ns2="http://www.springframework.org/schema/beans" xmlns:ns3="http://www.springframework.org/schema/util" xmlns:ns4="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<ns2:description>beans::foo n2</ns2:description>
<ns3:map id="EnvData" scope="singleton" key-type="java.lang.String">
<ns2:description>Env data</ns2:description>
</ns3:map>
<ns3:map id="PIPdata" scope="prototype" key-type="java.lang.String">
<ns2:description>PIP data</ns2:description>
</ns3:map>
<routeContext id="n0">
<route id="n1">
<from uri="direct:start"/>
<to uri="direct:request"/>
</route>
<route id="n5">
<from uri="direct:request"/>
<filter>
<groovy>import static specified.XacmlFunctionProto.from
import static xcaml.pdp.RequestTupleUtil.lookup
from("urn:oasis:names:tc:xacml:1.0:function:rfc822Name-match").apply('med.example.com', lookup( ${body} , "urn:oasis:names:tc:xacml:1.0:subject-category:access-subject" , "urn:oasis:names:tc:xacml:1.0:subject:subject-id" ) );</groovy>
<to uri="direct:permit"/>
<otherwise>
<to uri="direct:deny"/>
</otherwise>
</filter>
</route>
</routeContext>
<restContext id="n4">
<rest path="/pdp" bindingMode="json_xml" id="n3">
<post bindingMode="json_xml" type="oasis.names.tc.xacml._3_0.core.schema.wd_17.RequestType">
<to uri="direct:request"/>
</post>
</rest>
</restContext>
<camelContext id="n6-SimplePolicy1">
<routeContextRef ref="n0"/>
<restContextRef ref="n4"/>
<restConfiguration component="netty4-http" host="0.0.0.0" port="8901" bindingMode="json_xml"/>
</camelContext>
</ns2:beans>
initial visitor outputs
for the time being, we have a cheap way to embed stacktraces as parts of the debugging output (non-exception cases) to link to the source code of an element's creation while debugging in an IDE.
the camel route graph exists vageuly based on inbound xacml policy