On Mar 11, 2013, at 8:23 AM, Colm O hEigeartaigh <[email protected]> wrote:
> WSS4J 2.0's policy model parses any child policies into Neethi policies. For
> example, the Layout class is a PolicyContainingAssertion with a child Policy
> that could be "Lax", "Strict", etc.
>
> I'm running into a problem about how to mark these policies as asserted in
> CXF, as there does not seem to be a corresponding "Assertion" for these
> policies. For example, I can get the Layout object from the binding via:
>
> Layout layout = binding.getLayout();
>
> If I want to assert the child policy, I have no way of doing it beyond
> something like:
>
> assertPolicy(aim, SP12Constants.LAXTSFIRST);
>
> protected boolean assertPolicy(AssertionInfoMap aim, QName q) {
> Collection<AssertionInfo> ais = aim.get(q);
> if (ais != null && !ais.isEmpty()) {
> for (AssertionInfo ai : ais) {
> ai.setAsserted(true);
> }
> return true;
> }
> return false;
> }
>
> Obviously this is not good for policy alternatives. How can I just assert the
> policy child element?
Well, the main reason is that if you know LAXTSFIRST is assertable, you want to
assert it for all instances of that policy so when we check for alternatives
later (incoming server side, we don't know which alternative is being used
yet), that would apply to wherever that policy is used. Thus, we normally spin
through and mark all of them asserted.
--
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com