Examples of Assertion


Examples of org.apache.neethi.Assertion

        }
    }
   
    public static Assertion getAddressingPolicy(AssertionInfoMap aim, boolean optional) {
        Collection<AssertionInfo> lst = aim.get(MetadataConstants.USING_ADDRESSING_2004_QNAME);
        Assertion assertion = null;
        if (null != lst && !lst.isEmpty()) {
            assertion = lst.iterator().next().getAssertion();
        }
        if (assertion == null) {
            lst = aim.get(MetadataConstants.USING_ADDRESSING_2005_QNAME);
            if (null != lst && !lst.isEmpty()) {
                assertion = lst.iterator().next().getAssertion();
            }
        }
        if (assertion == null) {
            lst = aim.get(MetadataConstants.USING_ADDRESSING_2006_QNAME);
            if (null != lst && !lst.isEmpty()) {
                assertion = lst.iterator().next().getAssertion();
            }
        }
        if (assertion == null) {
            return new PrimitiveAssertion(MetadataConstants.USING_ADDRESSING_2006_QNAME,
                                          optional);
        } else if (optional) {
            return new PrimitiveAssertion(assertion.getName(),
                                          optional);           
        }
        return assertion;
    }
View Full Code Here

Examples of org.apache.neethi.Assertion

                    //Cancel and Renew just sign with the token
                    Policy p = new Policy();
                    ExactlyOne ea = new ExactlyOne();
                    p.addPolicyComponent(ea);
                    All all = new All();
                    Assertion ass = NegotiationUtils.getAddressingPolicy(aim, false);
                    all.addPolicyComponent(ass);
                    ea.addPolicyComponent(all);
                    PolicyBuilder pbuilder = message.getExchange().getBus()
                        .getExtension(PolicyBuilder.class);
                    SymmetricBinding binding = new SymmetricBinding(SP12Constants.INSTANCE, pbuilder);
                    binding.setIncludeTimestamp(true);
                    ProtectionToken token = new ProtectionToken(SP12Constants.INSTANCE, pbuilder);
                   
                    SecureConversationToken scToken =
                        new SecureConversationToken(SP12Constants.INSTANCE);
                    scToken.setInclusion(SP12Constants.IncludeTokenType.INCLUDE_TOKEN_ALWAYS_TO_RECIPIENT);
                    token.setToken(scToken);
                    binding.setProtectionToken(token);
                    binding.setEntireHeadersAndBodySignatures(true);
                   
                    Binding origBinding = getBinding(aim);
                    binding.setAlgorithmSuite(origBinding.getAlgorithmSuite());
                    all.addPolicyComponent(binding);
                   
                    SignedEncryptedParts parts = new SignedEncryptedParts(true,
                                                                          SP12Constants.INSTANCE);
                    parts.setBody(true);
                    if (addNs != null) {
                        parts.addHeader(new Header("To", addNs));
                        parts.addHeader(new Header("From", addNs));
                        parts.addHeader(new Header("FaultTo", addNs));
                        parts.addHeader(new Header("ReplyTO", addNs));
                        parts.addHeader(new Header("MessageID", addNs));
                        parts.addHeader(new Header("RelatesTo", addNs));
                        parts.addHeader(new Header("Action", addNs));
                    }
                    all.addPolicyComponent(parts);
                    pol = p;
                    message.getInterceptorChain().add(SecureConversationTokenFinderInterceptor.INSTANCE);
                } else {
                    Policy p = new Policy();
                    ExactlyOne ea = new ExactlyOne();
                    p.addPolicyComponent(ea);
                    All all = new All();
                    Assertion ass = NegotiationUtils.getAddressingPolicy(aim, false);
                    all.addPolicyComponent(ass);
                    ea.addPolicyComponent(all);
                    pol = p.merge(pol);
                }
               
View Full Code Here

Examples of org.apache.neethi.Assertion

            log.debug("Processing Issuer policy");

            List issuerAssertions = (List) issuerPolicy.getAlternatives().next();

            for (Iterator iter = issuerAssertions.iterator(); iter.hasNext();) {
                Assertion tempAssertion = (Assertion) iter.next();
                //find the AlgorithmSuite assertion
                if (tempAssertion instanceof Binding) {

                    log.debug("Extracting algo suite from issuer " +
                              "policy binding");

                    this.algorithmSuite = ((Binding) tempAssertion)
                            .getAlgorithmSuite();
                }
            }
        }

        if (servicePolicy != null) {

            log.debug("Processing service policy to find Trust10 assertion");

            List assertions = (List) servicePolicy.getAlternatives().next();

            for (Iterator iter = assertions.iterator(); iter.hasNext();) {
                Assertion tempAssertion = (Assertion) iter.next();
                //find the Trust10 assertion
                if (tempAssertion instanceof Trust10) {
                    log.debug("Extracting Trust10 assertion from " +
                              "service policy");
                    this.trust10 = (Trust10) tempAssertion;
View Full Code Here

Examples of org.apache.neethi.Assertion

            throws WSSPolicyException {
       
        RampartPolicyData rpd = new RampartPolicyData();
       
        for (Iterator iter = topLevelAssertions.iterator(); iter.hasNext();) {
            Assertion assertion = (Assertion) iter.next();
            if (assertion instanceof Binding) {
                if (assertion instanceof SymmetricBinding) {
                    processSymmetricPolicyBinding((SymmetricBinding) assertion, rpd);
                } else if(assertion instanceof AsymmetricBinding) {
                    processAsymmetricPolicyBinding((AsymmetricBinding) assertion, rpd);
                } else {
                    processTransportBinding((TransportBinding) assertion, rpd);
                }
               
                /*
                 * Don't change the order of Wss11 / Wss10 instance checks
                 * because Wss11 extends Wss10 - thus first check Wss11.
                 */
            } else if (assertion instanceof Wss11) {
                processWSS11((Wss11) assertion, rpd);
            } else if (assertion instanceof Wss10) {
                processWSS10((Wss10) assertion, rpd);
            } else if (assertion instanceof SignedEncryptedElements) {
                processSignedEncryptedElements((SignedEncryptedElements) assertion,
                        rpd);
            } else if (assertion instanceof SignedEncryptedParts) {
                processSignedEncryptedParts((SignedEncryptedParts) assertion, rpd);
            } else if ( assertion instanceof RequiredElements) {  
                processRequiredElements((RequiredElements)assertion, rpd);
            } else if (assertion instanceof ContentEncryptedElements) {
                processContentEncryptedElements((ContentEncryptedElements) assertion, rpd);
            }else if (assertion instanceof SupportingToken) {
                processSupportingTokens((SupportingToken) assertion, rpd);
            } else if (assertion instanceof Trust10) {
                processTrust10((Trust10)assertion, rpd);
            } else if (assertion instanceof RampartConfig) {
                processRampartConfig((RampartConfig)assertion, rpd);
            } else if (assertion instanceof MTOMAssertion){
              processMTOMSerialization((MTOMAssertion)assertion, rpd);
            } else {
                log.debug("Unknown top level PED found: "
                        + assertion.getClass().getName());
            }
        }
       
        return rpd;
    }
View Full Code Here

Examples of org.apache.neethi.Assertion

     * @param rpd
     *            The WSS4J data to initialize
     */
    private static void symmetricBinding(SymmetricBinding binding,
            RampartPolicyData rpd) throws WSSPolicyException {
        Assertion token = binding.getProtectionToken();
       
        if (token != null) {
            rpd.setProtectionToken(((ProtectionToken)token).getProtectionToken());
        } else {
            Assertion encrToken = binding.getEncryptionToken();
            Assertion sigToken = binding.getSignatureToken();
            if (token == null && sigToken == null) {
                throw new WSSPolicyException("Symmetric binding should have a Protection token or" +
                                    " both Signature and Encryption tokens defined");
            }
            rpd.setEncryptionToken(
View Full Code Here

Examples of org.apache.neethi.Assertion

            log.debug("Processing Issuer policy");

            List issuerAssertions = (List) issuerPolicy.getAlternatives().next();

            for (Iterator iter = issuerAssertions.iterator(); iter.hasNext();) {
                Assertion tempAssertion = (Assertion) iter.next();
                //find the AlgorithmSuite assertion
                if (tempAssertion instanceof Binding) {

                    log.debug("Extracting algo suite from issuer " +
                              "policy binding");

                    this.algorithmSuite = ((Binding) tempAssertion)
                            .getAlgorithmSuite();
                }
            }
        }

        if (servicePolicy != null) {

            log.debug("Processing service policy to find Trust10 assertion");

            List assertions = (List) servicePolicy.getAlternatives().next();

            for (Iterator iter = assertions.iterator(); iter.hasNext();) {
                Assertion tempAssertion = (Assertion) iter.next();
                //find the Trust10 assertion
                if (tempAssertion instanceof Trust10) {
                    log.debug("Extracting Trust10 assertion from " +
                              "service policy");
                    this.trust10 = (Trust10) tempAssertion;
View Full Code Here

Examples of org.apache.woden.wsdl20.validation.Assertion

     * Note: with the outstanding API review issue about merging the two WSDL models, might be
     * able to change the Object paramater to a Woden-specific type.
     */
    private void checkAssertions(Class targetClass, Object target) throws WSDLException {
       
        Assertion a = null;
       
        //Check WSDL 2.0 assertions
        List wsdlAsserts = (List)fWsdlAsserts.get(targetClass);
        if (wsdlAsserts != null) {
            for (Iterator i = wsdlAsserts.iterator(); i.hasNext();) {
                a = (Assertion) i.next();
                a.validate(target, fWodenCtx);
            }
        }
        //Check extension assertions (get them from ExtensionRegistry)
        List extAsserts = (List)fExtAsserts.get(targetClass);
        if (extAsserts != null) {
            for (Iterator i = extAsserts.iterator(); i.hasNext();) {
                a = (Assertion) i.next();
                a.validate(target, fWodenCtx);
            }
        }
       
    }
View Full Code Here

Examples of org.apache.ws.policy.Assertion

             * can be fulfilled then we choose this alternative and signal a
             * success.
             */
            boolean all = true;
            while (all && iterator.hasNext()) {
                Assertion assertion = (Assertion) iterator.next();

                /*
                 * At this point we expect PrimitiveAssertions only.
                 */
                if (!(assertion instanceof PrimitiveAssertion)) {
                    log.debug("Got a unexpected assertion type: "
                            + assertion.getClass().getName());
                    continue;
                }
                /*
                 * We need to pick only the primitive assertions which contain a
                 * WSSecurityPolicy policy assertion. For that we'll check the
View Full Code Here

Examples of org.apache.ws.policy.Assertion

        commit = startPolicyTransaction(pa);

        List terms = pa.getTerms();
        if (commit && terms.size() > 0) {
            for (int i = 0; commit && i < terms.size(); i++) {
                Assertion assertion = (Assertion) pa.getTerms().get(i);
                if (assertion instanceof Policy) {
                    commit = processPolicy((Policy) assertion);
                } else if (assertion instanceof PrimitiveAssertion) {
                    commit = processPrimitiveAssertion((PrimitiveAssertion) assertion);
                }
View Full Code Here

Examples of org.beangle.security.cas.validation.Assertion

    return result;
  }

  private CasAuthentication authenticateNow(CasAuthentication auth) throws AuthenticationException {
    try {
      final Assertion assertion = ticketValidator.validate(auth.getCredentials().toString(),
          auth.getLoginUrl());
      String name = assertion.getPrincipal();
      final UserDetail userDetail = userDetailService.loadDetail(new UsernamePasswordAuthentication(
          name, null));
      if (null == userDetail) {
        logger.error("cannot load {}'s detail from system", name);
        throw new UsernameNotFoundException(StrUtils.concat("user ", name, " not found in system"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.