FileDocCategorySizeDatePackage
SecurityPolicyUtil.javaAPI DocExample6110Thu Jul 19 02:00:10 BST 2007com.sun.xml.ws.security.impl.policyconv

SecurityPolicyUtil

public class SecurityPolicyUtil extends Object
author
K.Venugopal@sun.com

Fields Summary
private static final QName
signaturePolicy
private static final QName
usernameTokenPolicy
private static final QName
x509TokenPolicy
private static final QName
timestampPolicy
Constructors Summary
public SecurityPolicyUtil()
Creates a new instance of SecurityPolicyUtil

    
           
      
    
Methods Summary
public static java.lang.StringconvertToXWSSConstants(java.lang.String type)

        if(type.contains(Token.REQUIRE_THUMBPRINT_REFERENCE)){
            return MessageConstants.THUMB_PRINT_TYPE;
        }else if(type.contains(Token.REQUIRE_KEY_IDENTIFIER_REFERENCE)){
            return MessageConstants.KEY_INDETIFIER_TYPE;
        }else if(type.contains(Token.REQUIRE_ISSUER_SERIAL_REFERENCE)){
            return MessageConstants.X509_ISSUER_TYPE ;
        }
        throw new UnsupportedOperationException(type+"  is not supported");
    
private static javax.xml.namespace.QNamegetQNameFromPolicy(com.sun.xml.wss.impl.policy.mls.WSSPolicy policy)

        if(PolicyTypeUtil.signaturePolicy(policy)){
            return signaturePolicy;
        } else if(PolicyTypeUtil.timestampPolicy(policy)){
            return timestampPolicy;
        } else if(PolicyTypeUtil.x509CertificateBinding(policy)){
            return x509TokenPolicy;
        } else if(PolicyTypeUtil.usernameTokenPolicy(policy)){
            return usernameTokenPolicy;
        } else if(PolicyTypeUtil.secureConversationTokenKeyBinding(policy)){
            return MessageConstants.SCT_NAME;
        }
        return null;
    
public static booleanisEncryptedPartsEmpty(com.sun.xml.ws.security.policy.EncryptedParts ep)

        if(!ep.hasBody()){
            if(!ep.getTargets().hasNext()){
                return true;
            }
        }
        return false;
    
public static booleanisSignedPartsEmpty(com.sun.xml.ws.security.policy.SignedParts sp)

        if(!sp.hasBody()){
            if(!sp.getHeaders().hasNext()){
                return true;
            }
        }
        return false;
    
public static voidsetCanonicalizationMethod(SignaturePolicy.FeatureBinding spFB, com.sun.xml.ws.security.policy.AlgorithmSuite algorithmSuite)

        if(algorithmSuite != null && algorithmSuite.getAdditionalProps().contains(Constants.InclusiveC14N)){
            spFB.setCanonicalizationAlgorithm(CanonicalizationMethod.INCLUSIVE);
        } else{
            spFB.setCanonicalizationAlgorithm(CanonicalizationMethod.EXCLUSIVE);
        }
        
        if(algorithmSuite != null &&
                algorithmSuite.getAdditionalProps().contains(Constants.InclusiveC14NWithCommentsForCm)){
            spFB.setCanonicalizationAlgorithm(CanonicalizationMethod.INCLUSIVE_WITH_COMMENTS);
        } else if(algorithmSuite != null && 
                algorithmSuite.getAdditionalProps().contains(Constants.ExclusiveC14NWithCommentsForCm)){
            spFB.setCanonicalizationAlgorithm(CanonicalizationMethod.EXCLUSIVE_WITH_COMMENTS);
        }
    
public static voidsetName(com.sun.xml.wss.impl.policy.mls.Target target, com.sun.xml.wss.impl.policy.mls.WSSPolicy policy)

        if(target.getType() == Target.TARGET_TYPE_VALUE_URI){
            target.setPolicyName(getQNameFromPolicy(policy));
        }