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

Examples of com.sun.xml.wss.impl.policy.mls.SignatureTarget$Transform


            String localName = hdr.getLocalPart();
            String uri = hdr.getNamespaceURI();
            boolean found = false;
            if (MessageConstants.ADDRESSING_W3C_NAMESPACE.equals(uri) || MessageConstants.ADDRESSING_MEMBER_SUBMISSION_NAMESPACE.equals(uri)) {
                for (int i = 0; i < list.size(); i++) {
                    SignatureTarget st = (SignatureTarget) list.get(i);
                    QName value = st.getQName();
                    if (value.getLocalPart().equals(localName) && value.getNamespaceURI().equals(uri)) {
                        found = true;
                        break;
                    }
                }
View Full Code Here


        if(includeToken.endsWith("AlwaysToRecipient") ||includeToken.endsWith("Always")){
           strIgnore = true;
        }
        if ( uid != null ) {
            SignatureTargetCreator stcr = iAP.getTargetCreator();
            SignatureTarget stg = stcr.newURISignatureTarget(uid);
            SecurityPolicyUtil.setName(stg, token);
            if(!strIgnore){
                stcr.addSTRTransform(stg);
                stg.setPolicyQName(getQName(token));
            } else  {
               stcr.addTransform(stg);
            }           
            SignaturePolicy.FeatureBinding fb = (com.sun.xml.wss.impl.policy.mls.SignaturePolicy.FeatureBinding) sp.getFeatureBinding();
            fb.addTargetBinding(stg);
View Full Code Here

        createSupportingSignature(token);
    }
   
    protected void endorseSignature(SignaturePolicy sp){
        SignaturePolicy.FeatureBinding spFB = (SignaturePolicy.FeatureBinding)sp.getFeatureBinding();
        SignatureTarget sigTarget = stc.newURISignatureTarget(signaturePolicy.getUUID());
        stc.addTransform(sigTarget);
        SecurityPolicyUtil.setName(sigTarget, signaturePolicy);
        spFB.addTargetBinding(sigTarget);
        spFB.isEndorsingSignature(true);
    }
View Full Code Here

   
    public void process(SignedParts signedParts,SignaturePolicy.FeatureBinding binding){
        Iterator tv = signedParts.getHeaders();
        if(SecurityPolicyUtil.isSignedPartsEmpty(signedParts)){
            if(!allHeaders){
                SignatureTarget target = targetCreator.newURISignatureTarget("");
                targetCreator.addTransform(target);
                target.setValue(SignatureTarget.ALL_MESSAGE_HEADERS);
                target.isSOAPHeadersOnly(true);
                binding.addTargetBinding(target);
                target.setContentOnly(contentOnly);
                allHeaders = true;
            }
            if(!seenBody){
                SignatureTarget target = targetCreator.newQNameSignatureTarget(Target.BODY_QNAME);
                targetCreator.addTransform(target);
                binding.addTargetBinding(target);
                target.setContentOnly(contentOnly);
                seenBody = true;
            }
        }else{
            while(tv.hasNext()){
                Header ht = (Header)tv.next();
                if(!allHeaders && !seenSignTarget(ht)){
                    SignatureTarget target = targetCreator.newQNameSignatureTarget(new QName(ht.getURI(),ht.getLocalName()));
                    targetCreator.addTransform(target);
                    target.isSOAPHeadersOnly(true);
                    target.setContentOnly(contentOnly);
                    binding.addTargetBinding(target);
                }
            }
            if(signedParts.hasBody()){
                if(!seenBody){
                    SignatureTarget target = targetCreator.newQNameSignatureTarget(Target.BODY_QNAME);
                    targetCreator.addTransform(target);
                    target.setContentOnly(contentOnly);
                    binding.addTargetBinding(target);
                    seenBody = true;
                }
            }
            if(signedParts.hasAttachments()){
                if(!seenAttachments){
                    SignatureTarget target = targetCreator.newURISignatureTarget("");
                    target.setValue(MessageConstants.PROCESS_ALL_ATTACHMENTS);
                    targetCreator.addAttachmentTransform(target, signedParts.attachmentProtectionType());
                    binding.addTargetBinding(target);
                    seenAttachments = true;
                }
            }
View Full Code Here

   
    public void process(SignedElements signedElements,SignaturePolicy.FeatureBinding binding){
        Iterator<String> itr = signedElements.getTargets();
        while(itr.hasNext()){
            String xpathTarget = itr.next();
            SignatureTarget target = targetCreator.newXpathSignatureTarget(xpathTarget);
            targetCreator.addTransform(target);
            target.setContentOnly(contentOnly);
            //  target.setXPathVersion(signedElements.)
            binding.addTargetBinding(target);
        }
    }
View Full Code Here

        signParts.add(name);
        return false;
    }
   
    public void process(QName targetName,SignaturePolicy.FeatureBinding binding){
        SignatureTarget target = targetCreator.newQNameSignatureTarget(targetName);
        targetCreator.addTransform(target);
        binding.addTargetBinding(target);
    }
View Full Code Here

   
   
    protected void addToPrimarySignature(WSSPolicy policy,Token token) throws PolicyException{
        String includeToken = token.getIncludeToken();
        SecurityPolicyVersion spVersion = SecurityPolicyUtil.getSPVersion((PolicyAssertion) token);
        SignatureTarget target = null;
        if (includeToken.endsWith("Never") && PolicyUtil.isX509Token((PolicyAssertion) token, spVersion)) {
            String uid = pid.generateID();
            ((AuthenticationTokenPolicy.X509CertificateBinding) policy).setSTRID(uid);
            target = stc.newURISignatureTargetForSSToken(uid);
           //this flag will be used for computing securitytokenreference when the includetoken type is Never !!
            target.isITNever(true);
        } else {
            target = stc.newURISignatureTargetForSSToken(policy.getUUID());
        }
        SecurityPolicyUtil.setName(target, policy);

        if((!PolicyUtil.isUsernameToken((PolicyAssertion) token, spVersion) &&
           !spVersion.includeTokenAlways.equals(includeToken) &&
           !spVersion.includeTokenAlwaysToRecipient.equals(includeToken)) || PolicyUtil.isSamlToken((PolicyAssertion)token,spVersion)
           || PolicyUtil.isIssuedToken((PolicyAssertion)token,spVersion)){
            stc.addSTRTransform(target);
            target.setPolicyQName(getQName(policy));
        } else {
             stc.addTransform(target);
        }
        SignaturePolicy.FeatureBinding spFB = (SignaturePolicy.FeatureBinding)signaturePolicy.getFeatureBinding();
        spFB.addTargetBinding(target);
View Full Code Here

            SecurityPolicy primaryPolicy = (SecurityPolicy) i.next();
            if(PolicyTypeUtil.signaturePolicy(primaryPolicy)){
                SignaturePolicy sigPolicy = (SignaturePolicy)primaryPolicy;
                IntegrityAssertionProcessor iAP = new IntegrityAssertionProcessor(scp.getAlgorithmSuite(), true);
                SignatureTargetCreator stc = iAP.getTargetCreator();
                SignatureTarget sigTarget = stc.newURISignatureTarget(sigPolicy.getUUID());
                SecurityPolicyUtil.setName(sigTarget, sigPolicy);
                spFB.addTargetBinding(sigTarget);
                spFB.isEndorsingSignature(true);
                addedSigTarget = true;
                break;
            }
        }

        // If no primary signature (e.g. TransportBinding), sign the
        // TimeStamp.
        if (!addedSigTarget){
            List sList = policy.getSecondaryPolicies();
            Iterator j = sList.iterator();
            while (j.hasNext()) {
                SecurityPolicy secPolicy = (SecurityPolicy) j.next();
                if(PolicyTypeUtil.timestampPolicy(secPolicy)){
                    TimestampPolicy tsPolicy = (TimestampPolicy)secPolicy;
                    IntegrityAssertionProcessor iAP = new IntegrityAssertionProcessor(scp.getAlgorithmSuite(), true);
                    SignatureTargetCreator stc = iAP.getTargetCreator();
                    SignatureTarget sigTarget = stc.newURISignatureTarget(tsPolicy.getUUID());
                    SecurityPolicyUtil.setName(sigTarget, tsPolicy);
                    spFB.addTargetBinding(sigTarget);
                    spFB.isEndorsingSignature(true);
                    addedSigTarget = true;
                    break;
View Full Code Here

    }
    @Override
    protected void addToPrimarySignature(WSSPolicy policy,Token token) throws PolicyException{
        String includeToken = token.getIncludeToken();
        SecurityPolicyVersion spVersion = SecurityPolicyUtil.getSPVersion((PolicyAssertion) token);
        SignatureTarget target = null;
        if (includeToken.endsWith("Never") && PolicyUtil.isX509Token((PolicyAssertion) token, spVersion)) {
            String uid = pid.generateID();
            ((AuthenticationTokenPolicy.X509CertificateBinding) policy).setSTRID(uid);
            target = stc.newURISignatureTargetForSSToken(uid);
           //this flag will be used for computing securitytokenreference when the includetoken type is Never !!
            target.isITNever(true);
        } else {
            target = stc.newURISignatureTargetForSSToken(policy.getUUID());
        }
        SecurityPolicyUtil.setName(target, policy);

        if((!PolicyUtil.isUsernameToken((PolicyAssertion) token, spVersion) &&
           !spVersion.includeTokenAlways.equals(includeToken) &&
           !spVersion.includeTokenAlwaysToRecipient.equals(includeToken)) || PolicyUtil.isSamlToken((PolicyAssertion)token,spVersion)
           || PolicyUtil.isIssuedToken((PolicyAssertion)token,spVersion)){
            stc.addSTRTransform(target);
            target.setPolicyQName(getQName(policy));
        } else {
             stc.addTransform(target);
        }
        SignaturePolicy.FeatureBinding spFB = (SignaturePolicy.FeatureBinding)signaturePolicy.getFeatureBinding();
        spFB.addTargetBinding(target);
View Full Code Here

        this.algorithmSuite = algorithmSuite;
    }

    public SignatureTarget newURISignatureTarget(String uid){
        if ( uid != null ) {
            SignatureTarget target = new SignatureTarget();
            target.setType(SignatureTarget.TARGET_TYPE_VALUE_URI);
            target.setDigestAlgorithm(algorithmSuite.getDigestAlgorithm());
            target.setValue("#"+uid);
            addTransform(target);
            target.setEnforce(enforce);
            return target;
        }
        return null;
    }
View Full Code Here

TOP

Related Classes of com.sun.xml.wss.impl.policy.mls.SignatureTarget$Transform

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.