Package com.sun.xml.wss.impl.policy.mls

Examples of com.sun.xml.wss.impl.policy.mls.Target


           }
           return true;
       }
       //TODO: This logic fails if we have more than 2 targets in the ArrayList
       private boolean hasBodyFollowedByUsername(ArrayList targets) {
           Target t = (Target)targets.get(targets.size() - 1);
           int idx = t.getValue().indexOf(USERNAMETOKEN);
           if (idx == -1) {
               return false;
           }
           return true;
       }
View Full Code Here


       private boolean hasEncryptBodyPolicy(EncryptionPolicy policy) {
           EncryptionPolicy.FeatureBinding fb =
               (EncryptionPolicy.FeatureBinding)policy.getFeatureBinding();
           Iterator it = fb.getTargetBindings().iterator();
           while (it.hasNext()) {
               Target target = (Target)it.next();
               int idx = target.getValue().indexOf(BODY);
               if (idx > -1) {
                   return true;
               }
           }
           return false;
View Full Code Here

    // replace uri target types with qname target types
    @SuppressWarnings("unchecked")
    private void modifyTargets(ArrayList targets) {
        for (int i = 0; i < targets.size(); i++) {
            Target target = (Target) targets.get(i);
            if (Target.TARGET_TYPE_VALUE_URI.equals(target.getType())) {
                findAndReplaceTargets(target);
            }
        }
    }
View Full Code Here

    private static void dereferenceTargets(ArrayList targets, ArrayList nodeSet, SecurableSoapMessage message,
            boolean inferred)
            throws XWSSecurityException {
        Iterator i = targets.iterator();
        while (i.hasNext()) {
            Target t = (Target) i.next();
            boolean mandatory = t.getEnforce();
            boolean contentOnly = t.getContentOnly();
            Object object = null;
            EncryptedData data = null;
            try{
                if(!t.isAttachment()){
                    Element el = null;
                    if(inferred && t instanceof EncryptionTarget){
                        el = ((EncryptionTarget)t).getElementData();
                        data = new EncryptedElement(el,contentOnly);
                        nodeSet.add(data);
                    }else{
                        object =  message.getMessageParts(t);
                        if (object instanceof Element){
                            data = new EncryptedElement((Element)object,contentOnly);
                            nodeSet.add(data);
                        }else if (object instanceof NodeList){
                            NodeList nl = (NodeList) object;
                            for (int j=0; j< nl.getLength(); j++){
                                data = new EncryptedElement((Element)nl.item(j),contentOnly);
                                nodeSet.add(data);
                            }
                        }else if(object instanceof Node){
                            data = new EncryptedElement((Element)object,contentOnly);
                            nodeSet.add(data);
                        }
                    }
                   
                }else{
                    if(!inferred){
                        AttachmentPart ap = (AttachmentPart)message.getMessageParts(t);
                        data = new AttachmentData(ap.getContentId(), contentOnly);
                    }else{
                        data = new AttachmentData(t.getValue(),contentOnly);
                    }
                    nodeSet.add(data);
                }
            }catch(XWSSecurityException ex){
                if(!inferred && mandatory){
View Full Code Here

                    targets = ((SignaturePolicy.FeatureBinding)wssPolicy.getFeatureBinding()).getTargetBindings();
                }               
                foundPrimaryPolicy = true;
                Iterator ite = targets.iterator();
                while(ite.hasNext()){
                    Target t = (Target)ite.next();
                    if (t.getEnforce()){               
                       
                        // roll the pointer down the header till a primary block is hit
                        // if end of header is hit (pointer is null) break out of the loop
                        while (current != null && HarnessUtil.isSecondaryHeaderElement(current))
                            current = HarnessUtil.getNextElement(current);
View Full Code Here

        for (SecurityPolicy sp : encPolicies) {
            if (PolicyTypeUtil.encryptionPolicy(sp)) {
                EncryptionPolicy.FeatureBinding fb = (EncryptionPolicy.FeatureBinding) ((EncryptionPolicy) sp).getFeatureBinding();
                ArrayList targets = fb.getTargetBindings();
                for (int i = 0; i < targets.size(); i++) {
                    Target t = (Target) targets.get(i);
                    if (t.getType() == Target.TARGET_TYPE_VALUE_QNAME) {
                        if (qName.equals(t.getQName())) {
                            return true;
                        }
                    }
                }
            }
View Full Code Here

                    SecurityPolicy secPolicy = (SecurityPolicy) policy;
                    if (PolicyTypeUtil.signaturePolicy(secPolicy)) {
                        SignaturePolicy.FeatureBinding sfb = (SignaturePolicy.FeatureBinding) ((SignaturePolicy) secPolicy).getFeatureBinding();
                        ArrayList targets = sfb.getTargetBindings();
                        for (int i = 0; i < targets.size(); i++) {
                            Target t = (Target) targets.get(i);
                            if (t.getType() == Target.TARGET_TYPE_VALUE_QNAME) {
                                if (encPoliciesContain(t.getQName(), encPolicies)) {                                   
                                    if(isWSS11){
                                        if (!containsEncryptedHeader) {
                                            QName encHeaderQName = new QName("http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd", "EncryptedHeader");
                                            t.setQName(encHeaderQName);
                                            containsEncryptedHeader = true;
                                        } else {
                                            targets.remove(i);
                                        }
                                    }else {
                                        if (!containsEncryptedHeader) {
                                            QName encDataQName = new QName("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "EncryptedData");
                                             t.setQName(encDataQName);
                                            containsEncryptedHeader = true;
                                        } else {
                                            targets.remove(i);
                                        }
                                    }                                   
View Full Code Here

            Iterator itr = re.getTargets();
            while(itr.hasNext()){
                String xpathExpr = (String)itr.next();
                if(!targetValues.contains(xpathExpr)){
                    targetValues.add(xpathExpr);
                    Target tr = new Target();
                    tr.setType(Target.TARGET_TYPE_VALUE_XPATH);
                    tr.setValue(xpathExpr);
                    tr.setContentOnly(false);
                    tr.setEnforce(true);
                    targets.add(tr);
                }
            }
        }
       mp.append(mt)
View Full Code Here

TOP

Related Classes of com.sun.xml.wss.impl.policy.mls.Target

Copyright © 2018 www.massapicom. 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.