Java Code Examples for org.apache.ws.security.WSConstants#SIGN

The following examples show how to use org.apache.ws.security.WSConstants#SIGN . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractBindingPolicyValidator.java    From steady with Apache License 2.0 6 votes vote down vote up
/**
 * Check to see if a signature was applied before encryption.
 * Note that results are stored in the reverse order.
 */
private boolean isSignedBeforeEncrypted(List<WSSecurityEngineResult> results) {
    boolean signed = false;
    for (WSSecurityEngineResult result : results) {
        Integer actInt = (Integer)result.get(WSSecurityEngineResult.TAG_ACTION);
        List<WSDataRef> el = 
            CastUtils.cast((List<?>)result.get(WSSecurityEngineResult.TAG_DATA_REF_URIS));
        
        // Don't count an endorsing signature
        if (actInt.intValue() == WSConstants.SIGN && el != null
            && !(el.size() == 1 && el.get(0).getName().equals(SIG_QNAME))) {
            signed = true;
        }
        if (actInt.intValue() == WSConstants.ENCR && el != null) {
            if (signed) {
                return true;
            }
            return false;
        }
    }
    return false;
}
 
Example 2
Source File: AbstractBindingPolicyValidator.java    From steady with Apache License 2.0 6 votes vote down vote up
/**
 * Check to see if encryption was applied before signature.
 * Note that results are stored in the reverse order.
 */
private boolean isEncryptedBeforeSigned(List<WSSecurityEngineResult> results) {
    boolean encrypted = false;
    for (WSSecurityEngineResult result : results) {
        Integer actInt = (Integer)result.get(WSSecurityEngineResult.TAG_ACTION);
        List<WSDataRef> el = 
            CastUtils.cast((List<?>)result.get(WSSecurityEngineResult.TAG_DATA_REF_URIS));
        
        if (actInt.intValue() == WSConstants.ENCR && el != null) {
            encrypted = true;
        }
        // Don't count an endorsing signature
        if (actInt.intValue() == WSConstants.SIGN && el != null
            && !(el.size() == 1 && el.get(0).getName().equals(SIG_QNAME))) {
            if (encrypted) {
                return true;
            }
            return false;
        }
    }
    return false;
}
 
Example 3
Source File: AbstractBindingBuilder.java    From steady with Apache License 2.0 6 votes vote down vote up
private static X509Certificate getReqSigCert(List<WSHandlerResult> results) {
    /*
    * Scan the results for a matching actor. Use results only if the
    * receiving Actor and the sending Actor match.
    */
    for (WSHandlerResult rResult : results) {
        List<WSSecurityEngineResult> wsSecEngineResults = rResult.getResults();
        /*
        * Scan the results for the first Signature action. Use the
        * certificate of this Signature to set the certificate for the
        * encryption action :-).
        */
        for (WSSecurityEngineResult wser : wsSecEngineResults) {
            Integer actInt = (Integer)wser.get(WSSecurityEngineResult.TAG_ACTION);
            if (actInt.intValue() == WSConstants.SIGN) {
                return (X509Certificate)wser.get(WSSecurityEngineResult.TAG_X509_CERTIFICATE);
            }
        }
    }
    
    return null;
}
 
Example 4
Source File: AbstractBindingPolicyValidator.java    From steady with Apache License 2.0 6 votes vote down vote up
/**
 * Check to see if a signature was applied before encryption.
 * Note that results are stored in the reverse order.
 */
private boolean isSignedBeforeEncrypted(List<WSSecurityEngineResult> results) {
    boolean signed = false;
    for (WSSecurityEngineResult result : results) {
        Integer actInt = (Integer)result.get(WSSecurityEngineResult.TAG_ACTION);
        List<WSDataRef> el = 
            CastUtils.cast((List<?>)result.get(WSSecurityEngineResult.TAG_DATA_REF_URIS));
        
        // Don't count an endorsing signature
        if (actInt.intValue() == WSConstants.SIGN && el != null
            && !(el.size() == 1 && el.get(0).getName().equals(SIG_QNAME))) {
            signed = true;
        }
        if (actInt.intValue() == WSConstants.ENCR && el != null) {
            if (signed) {
                return true;
            }
            return false;
        }
    }
    return false;
}
 
Example 5
Source File: AbstractBindingPolicyValidator.java    From steady with Apache License 2.0 6 votes vote down vote up
/**
 * Check to see if encryption was applied before signature.
 * Note that results are stored in the reverse order.
 */
private boolean isEncryptedBeforeSigned(List<WSSecurityEngineResult> results) {
    boolean encrypted = false;
    for (WSSecurityEngineResult result : results) {
        Integer actInt = (Integer)result.get(WSSecurityEngineResult.TAG_ACTION);
        List<WSDataRef> el = 
            CastUtils.cast((List<?>)result.get(WSSecurityEngineResult.TAG_DATA_REF_URIS));
        
        if (actInt.intValue() == WSConstants.ENCR && el != null) {
            encrypted = true;
        }
        // Don't count an endorsing signature
        if (actInt.intValue() == WSConstants.SIGN && el != null
            && !(el.size() == 1 && el.get(0).getName().equals(SIG_QNAME))) {
            if (encrypted) {
                return true;
            }
            return false;
        }
    }
    return false;
}
 
Example 6
Source File: AbstractBindingBuilder.java    From steady with Apache License 2.0 6 votes vote down vote up
private static X509Certificate getReqSigCert(List<WSHandlerResult> results) {
    /*
    * Scan the results for a matching actor. Use results only if the
    * receiving Actor and the sending Actor match.
    */
    for (WSHandlerResult rResult : results) {
        List<WSSecurityEngineResult> wsSecEngineResults = rResult.getResults();
        /*
        * Scan the results for the first Signature action. Use the
        * certificate of this Signature to set the certificate for the
        * encryption action :-).
        */
        for (WSSecurityEngineResult wser : wsSecEngineResults) {
            Integer actInt = (Integer)wser.get(WSSecurityEngineResult.TAG_ACTION);
            if (actInt.intValue() == WSConstants.SIGN) {
                return (X509Certificate)wser.get(WSSecurityEngineResult.TAG_X509_CERTIFICATE);
            }
        }
    }
    
    return null;
}
 
Example 7
Source File: AbstractBindingPolicyValidator.java    From steady with Apache License 2.0 6 votes vote down vote up
/**
 * Check to see if a signature was applied before encryption.
 * Note that results are stored in the reverse order.
 */
private boolean isSignedBeforeEncrypted(List<WSSecurityEngineResult> results) {
    boolean signed = false;
    for (WSSecurityEngineResult result : results) {
        Integer actInt = (Integer)result.get(WSSecurityEngineResult.TAG_ACTION);
        List<WSDataRef> el = 
            CastUtils.cast((List<?>)result.get(WSSecurityEngineResult.TAG_DATA_REF_URIS));
        
        // Don't count an endorsing signature
        if (actInt.intValue() == WSConstants.SIGN && el != null
            && !(el.size() == 1 && el.get(0).getName().equals(SIG_QNAME))) {
            signed = true;
        }
        if (actInt.intValue() == WSConstants.ENCR && el != null) {
            if (signed) {
                return true;
            }
            return false;
        }
    }
    return false;
}
 
Example 8
Source File: AbstractBindingPolicyValidator.java    From steady with Apache License 2.0 6 votes vote down vote up
/**
 * Check to see if encryption was applied before signature.
 * Note that results are stored in the reverse order.
 */
private boolean isEncryptedBeforeSigned(List<WSSecurityEngineResult> results) {
    boolean encrypted = false;
    for (WSSecurityEngineResult result : results) {
        Integer actInt = (Integer)result.get(WSSecurityEngineResult.TAG_ACTION);
        List<WSDataRef> el = 
            CastUtils.cast((List<?>)result.get(WSSecurityEngineResult.TAG_DATA_REF_URIS));
        
        if (actInt.intValue() == WSConstants.ENCR && el != null) {
            encrypted = true;
        }
        // Don't count an endorsing signature
        if (actInt.intValue() == WSConstants.SIGN && el != null
            && !(el.size() == 1 && el.get(0).getName().equals(SIG_QNAME))) {
            if (encrypted) {
                return true;
            }
            return false;
        }
    }
    return false;
}
 
Example 9
Source File: AbstractBindingBuilder.java    From steady with Apache License 2.0 6 votes vote down vote up
private static X509Certificate getReqSigCert(List<WSHandlerResult> results) {
    /*
    * Scan the results for a matching actor. Use results only if the
    * receiving Actor and the sending Actor match.
    */
    for (WSHandlerResult rResult : results) {
        List<WSSecurityEngineResult> wsSecEngineResults = rResult.getResults();
        /*
        * Scan the results for the first Signature action. Use the
        * certificate of this Signature to set the certificate for the
        * encryption action :-).
        */
        for (WSSecurityEngineResult wser : wsSecEngineResults) {
            Integer actInt = (Integer)wser.get(WSSecurityEngineResult.TAG_ACTION);
            if (actInt.intValue() == WSConstants.SIGN) {
                return (X509Certificate)wser.get(WSSecurityEngineResult.TAG_X509_CERTIFICATE);
            }
        }
    }
    
    return null;
}
 
Example 10
Source File: AbstractBindingPolicyValidator.java    From steady with Apache License 2.0 6 votes vote down vote up
/**
 * Check to see if a signature was applied before encryption.
 * Note that results are stored in the reverse order.
 */
private boolean isSignedBeforeEncrypted(List<WSSecurityEngineResult> results) {
    boolean signed = false;
    for (WSSecurityEngineResult result : results) {
        Integer actInt = (Integer)result.get(WSSecurityEngineResult.TAG_ACTION);
        List<WSDataRef> el = 
            CastUtils.cast((List<?>)result.get(WSSecurityEngineResult.TAG_DATA_REF_URIS));
        
        // Don't count an endorsing signature
        if (actInt.intValue() == WSConstants.SIGN && el != null
            && !(el.size() == 1 && el.get(0).getName().equals(SIG_QNAME))) {
            signed = true;
        }
        if (actInt.intValue() == WSConstants.ENCR && el != null) {
            if (signed) {
                return true;
            }
            return false;
        }
    }
    return false;
}
 
Example 11
Source File: AbstractBindingPolicyValidator.java    From steady with Apache License 2.0 6 votes vote down vote up
/**
 * Check to see if encryption was applied before signature.
 * Note that results are stored in the reverse order.
 */
private boolean isEncryptedBeforeSigned(List<WSSecurityEngineResult> results) {
    boolean encrypted = false;
    for (WSSecurityEngineResult result : results) {
        Integer actInt = (Integer)result.get(WSSecurityEngineResult.TAG_ACTION);
        List<WSDataRef> el = 
            CastUtils.cast((List<?>)result.get(WSSecurityEngineResult.TAG_DATA_REF_URIS));
        
        if (actInt.intValue() == WSConstants.ENCR && el != null) {
            encrypted = true;
        }
        // Don't count an endorsing signature
        if (actInt.intValue() == WSConstants.SIGN && el != null
            && !(el.size() == 1 && el.get(0).getName().equals(SIG_QNAME))) {
            if (encrypted) {
                return true;
            }
            return false;
        }
    }
    return false;
}
 
Example 12
Source File: AbstractBindingBuilder.java    From steady with Apache License 2.0 6 votes vote down vote up
private static X509Certificate getReqSigCert(List<WSHandlerResult> results) {
    /*
    * Scan the results for a matching actor. Use results only if the
    * receiving Actor and the sending Actor match.
    */
    for (WSHandlerResult rResult : results) {
        List<WSSecurityEngineResult> wsSecEngineResults = rResult.getResults();
        /*
        * Scan the results for the first Signature action. Use the
        * certificate of this Signature to set the certificate for the
        * encryption action :-).
        */
        for (WSSecurityEngineResult wser : wsSecEngineResults) {
            Integer actInt = (Integer)wser.get(WSSecurityEngineResult.TAG_ACTION);
            if (actInt.intValue() == WSConstants.SIGN) {
                return (X509Certificate)wser.get(WSSecurityEngineResult.TAG_X509_CERTIFICATE);
            }
        }
    }
    
    return null;
}
 
Example 13
Source File: CustomProcessor.java    From steady with Apache License 2.0 5 votes vote down vote up
public final java.util.List<WSSecurityEngineResult> 
handleToken(
    final org.w3c.dom.Element elem, 
    final RequestData data, 
    final WSDocInfo wsDocInfo 
) throws WSSecurityException {
    final WSSecurityEngineResult result = 
        new WSSecurityEngineResult(WSConstants.SIGN);
    result.put("foo", this);
    return java.util.Collections.singletonList(result);
}
 
Example 14
Source File: CustomProcessor.java    From steady with Apache License 2.0 5 votes vote down vote up
public final java.util.List<WSSecurityEngineResult> 
handleToken(
    final org.w3c.dom.Element elem, 
    final RequestData data, 
    final WSDocInfo wsDocInfo 
) throws WSSecurityException {
    final WSSecurityEngineResult result = 
        new WSSecurityEngineResult(WSConstants.SIGN);
    result.put("foo", this);
    return java.util.Collections.singletonList(result);
}
 
Example 15
Source File: CustomProcessor.java    From steady with Apache License 2.0 5 votes vote down vote up
public final java.util.List<WSSecurityEngineResult> 
handleToken(
    final org.w3c.dom.Element elem, 
    final RequestData data, 
    final WSDocInfo wsDocInfo 
) throws WSSecurityException {
    final WSSecurityEngineResult result = 
        new WSSecurityEngineResult(WSConstants.SIGN);
    result.put("foo", this);
    return java.util.Collections.singletonList(result);
}
 
Example 16
Source File: CustomProcessor.java    From steady with Apache License 2.0 5 votes vote down vote up
public final java.util.List<WSSecurityEngineResult> 
handleToken(
    final org.w3c.dom.Element elem, 
    final RequestData data, 
    final WSDocInfo wsDocInfo 
) throws WSSecurityException {
    final WSSecurityEngineResult result = 
        new WSSecurityEngineResult(WSConstants.SIGN);
    result.put("foo", this);
    return java.util.Collections.singletonList(result);
}