You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by Colm O hEigeartaigh <co...@apache.org> on 2013/03/11 13:23:22 UTC

WSS4J 2.0 policy model

Hi all,

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?

Colm.

-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com

Re: WSS4J 2.0 policy model

Posted by Daniel Kulp <dk...@apache.org>.
On Mar 11, 2013, at 8:23 AM, Colm O hEigeartaigh <co...@apache.org> 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
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com