3 Replies Latest reply on Aug 27, 2012 12:21 PM by David Ward

    Pluggable PolicyProviders

    David Ward Master

      As part of the work for SWITCHYARD-830, I needed a way to configure a SecurityPolicy "PolicyProvider" and associate it with those services who will use it to authenticate (or whatever the security action is) and provide the appropriate SecurityPolicy.  A couple examples of providers are PicketBoxSecurityPolicyProvider (which can do in-container authentication) and PicketLinkSecurityPolicyProvider (which can do out-of-container federated trust actions).


      The problem is the configuration.  What I did was create this structure:


              <component name="FooService">
                  <service name="FooService" requires="confidentiality">....
                  <policy-provider class="org.switchyard.security.picketlink.PicketLinkSecurityPolicyProvider" services="FooService/FooService, BarService/BazReference">
                          <property name="TokenType" value="SAML2"/>
                          <property name="ServiceName" value="PicketLinkSTS"/>
                          <property name="Port" value="PicketLinkSTSPort"/>
                          <property name="EndpointUri" value="http://localhost:8080/picketlink-sts-1.0.0/PicketLinkSTS"/>


      How this works is that inside the SwitchYard ExchangeHandler chain, there is a PolicyHandler that is created with a PolicyProviderRegistry.  The PolicyProviderRegistry holds mappings of service QNames to PolicyProviders that will attempt to provide any required policies dynamically.  The PolicyHandler 1st sees what Policies are required, then tries to apply based on matches in the PolicyProviderRegistry, then any leftover Policies that have not been met will cause a HandlerException to be thrown.


      So anyway, the above works, however I'm worried that I've added something that can be better done using the SCA spec, through the use of "policySet"s.  Here's an example from the SCA Policy Framework documentation:


      <policySet name="AuthenticationPolicy"




         <e:policyConfiguration xmlns:e=”http://example.com”>

            <e:authentication type = “X509”/>

               <e:trustedCAStore type=”JKS”/>








      This seems to be what I'm looking for. Should I change to use this mechanism instead?