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

The following examples show how to use org.apache.ws.security.WSConstants#DKT . 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: AbstractSupportingTokenPolicyValidator.java    From steady with Apache License 2.0 5 votes vote down vote up
/**
 * Get a security result representing a Derived Key that has a secret key that
 * matches the parameter.
 */
private WSSecurityEngineResult getMatchingDerivedKey(byte[] secret) {
    for (WSSecurityEngineResult wser : results) {
        Integer actInt = (Integer)wser.get(WSSecurityEngineResult.TAG_ACTION);
        if (actInt.intValue() == WSConstants.DKT) {
            byte[] dktSecret = (byte[])wser.get(WSSecurityEngineResult.TAG_SECRET);
            if (Arrays.equals(secret, dktSecret)) {
                return wser;
            }
        }
    }
    return null;
}
 
Example 2
Source File: AbstractSupportingTokenPolicyValidator.java    From steady with Apache License 2.0 5 votes vote down vote up
/**
 * Get a security result representing a Derived Key that has a secret key that
 * matches the parameter.
 */
private WSSecurityEngineResult getMatchingDerivedKey(byte[] secret) {
    for (WSSecurityEngineResult wser : results) {
        Integer actInt = (Integer)wser.get(WSSecurityEngineResult.TAG_ACTION);
        if (actInt.intValue() == WSConstants.DKT) {
            byte[] dktSecret = (byte[])wser.get(WSSecurityEngineResult.TAG_SECRET);
            if (Arrays.equals(secret, dktSecret)) {
                return wser;
            }
        }
    }
    return null;
}
 
Example 3
Source File: AbstractSupportingTokenPolicyValidator.java    From steady with Apache License 2.0 5 votes vote down vote up
/**
 * Get a security result representing a Derived Key that has a secret key that
 * matches the parameter.
 */
private WSSecurityEngineResult getMatchingDerivedKey(byte[] secret) {
    for (WSSecurityEngineResult wser : results) {
        Integer actInt = (Integer)wser.get(WSSecurityEngineResult.TAG_ACTION);
        if (actInt.intValue() == WSConstants.DKT) {
            byte[] dktSecret = (byte[])wser.get(WSSecurityEngineResult.TAG_SECRET);
            if (Arrays.equals(secret, dktSecret)) {
                return wser;
            }
        }
    }
    return null;
}
 
Example 4
Source File: AbstractSupportingTokenPolicyValidator.java    From steady with Apache License 2.0 5 votes vote down vote up
/**
 * Get a security result representing a Derived Key that has a secret key that
 * matches the parameter.
 */
private WSSecurityEngineResult getMatchingDerivedKey(byte[] secret) {
    for (WSSecurityEngineResult wser : results) {
        Integer actInt = (Integer)wser.get(WSSecurityEngineResult.TAG_ACTION);
        if (actInt.intValue() == WSConstants.DKT) {
            byte[] dktSecret = (byte[])wser.get(WSSecurityEngineResult.TAG_SECRET);
            if (Arrays.equals(secret, dktSecret)) {
                return wser;
            }
        }
    }
    return null;
}
 
Example 5
Source File: SymmetricBindingPolicyValidator.java    From steady with Apache License 2.0 4 votes vote down vote up
public boolean validatePolicy(
    AssertionInfoMap aim,
    Message message,
    Element soapBody,
    List<WSSecurityEngineResult> results,
    List<WSSecurityEngineResult> signedResults,
    List<WSSecurityEngineResult> encryptedResults
) {
    Collection<AssertionInfo> ais = aim.get(SP12Constants.SYMMETRIC_BINDING);
    if (ais == null || ais.isEmpty()) {                       
        return true;
    }
    
    boolean hasDerivedKeys = false;
    for (WSSecurityEngineResult result : results) {
        Integer actInt = (Integer)result.get(WSSecurityEngineResult.TAG_ACTION);
        if (actInt.intValue() == WSConstants.DKT) {
            hasDerivedKeys = true;
            break;
        }
    }
    
    for (AssertionInfo ai : ais) {
        SymmetricBinding binding = (SymmetricBinding)ai.getAssertion();
        ai.setAsserted(true);

        // Check the protection order
        if (!checkProtectionOrder(binding, ai, results)) {
            continue;
        }
        
        // Check various properties of the binding
        if (!checkProperties(binding, ai, aim, results, signedResults, message)) {
            continue;
        }
        
        // Check various tokens of the binding
        if (!checkTokens(binding, ai, aim, hasDerivedKeys, signedResults, encryptedResults)) {
            continue;
        }
    }
    
    return true;
}
 
Example 6
Source File: AsymmetricBindingPolicyValidator.java    From steady with Apache License 2.0 4 votes vote down vote up
public boolean validatePolicy(
    AssertionInfoMap aim,
    Message message,
    Element soapBody,
    List<WSSecurityEngineResult> results,
    List<WSSecurityEngineResult> signedResults,
    List<WSSecurityEngineResult> encryptedResults
) {
    Collection<AssertionInfo> ais = aim.get(SP12Constants.ASYMMETRIC_BINDING);
    if (ais == null || ais.isEmpty()) {                       
        return true;
    }
    
    boolean hasDerivedKeys = false;
    for (WSSecurityEngineResult result : results) {
        Integer actInt = (Integer)result.get(WSSecurityEngineResult.TAG_ACTION);
        if (actInt.intValue() == WSConstants.DKT) {
            hasDerivedKeys = true;
            break;
        }
    }
    
    for (AssertionInfo ai : ais) {
        AsymmetricBinding binding = (AsymmetricBinding)ai.getAssertion();
        ai.setAsserted(true);

        // Check the protection order
        if (!checkProtectionOrder(binding, ai, results)) {
            continue;
        }
        
        // Check various properties of the binding
        if (!checkProperties(binding, ai, aim, results, signedResults, message)) {
            continue;
        }
        
        // Check various tokens of the binding
        if (!checkTokens(binding, ai, aim, hasDerivedKeys, signedResults, encryptedResults)) {
            continue;
        }
    }
    
    return true;
}
 
Example 7
Source File: SymmetricBindingPolicyValidator.java    From steady with Apache License 2.0 4 votes vote down vote up
public boolean validatePolicy(
    AssertionInfoMap aim,
    Message message,
    Element soapBody,
    List<WSSecurityEngineResult> results,
    List<WSSecurityEngineResult> signedResults,
    List<WSSecurityEngineResult> encryptedResults
) {
    Collection<AssertionInfo> ais = aim.get(SP12Constants.SYMMETRIC_BINDING);
    if (ais == null || ais.isEmpty()) {                       
        return true;
    }
    
    boolean hasDerivedKeys = false;
    for (WSSecurityEngineResult result : results) {
        Integer actInt = (Integer)result.get(WSSecurityEngineResult.TAG_ACTION);
        if (actInt.intValue() == WSConstants.DKT) {
            hasDerivedKeys = true;
            break;
        }
    }
    
    for (AssertionInfo ai : ais) {
        SymmetricBinding binding = (SymmetricBinding)ai.getAssertion();
        ai.setAsserted(true);

        // Check the protection order
        if (!checkProtectionOrder(binding, ai, results)) {
            continue;
        }
        
        // Check various properties of the binding
        if (!checkProperties(binding, ai, aim, results, signedResults, message)) {
            continue;
        }
        
        // Check various tokens of the binding
        if (!checkTokens(binding, ai, aim, hasDerivedKeys, signedResults, encryptedResults)) {
            continue;
        }
    }
    
    return true;
}
 
Example 8
Source File: AsymmetricBindingPolicyValidator.java    From steady with Apache License 2.0 4 votes vote down vote up
public boolean validatePolicy(
    AssertionInfoMap aim,
    Message message,
    Element soapBody,
    List<WSSecurityEngineResult> results,
    List<WSSecurityEngineResult> signedResults,
    List<WSSecurityEngineResult> encryptedResults
) {
    Collection<AssertionInfo> ais = aim.get(SP12Constants.ASYMMETRIC_BINDING);
    if (ais == null || ais.isEmpty()) {                       
        return true;
    }
    
    boolean hasDerivedKeys = false;
    for (WSSecurityEngineResult result : results) {
        Integer actInt = (Integer)result.get(WSSecurityEngineResult.TAG_ACTION);
        if (actInt.intValue() == WSConstants.DKT) {
            hasDerivedKeys = true;
            break;
        }
    }
    
    for (AssertionInfo ai : ais) {
        AsymmetricBinding binding = (AsymmetricBinding)ai.getAssertion();
        ai.setAsserted(true);

        // Check the protection order
        if (!checkProtectionOrder(binding, ai, results)) {
            continue;
        }
        
        // Check various properties of the binding
        if (!checkProperties(binding, ai, aim, results, signedResults, message)) {
            continue;
        }
        
        // Check various tokens of the binding
        if (!checkTokens(binding, ai, aim, hasDerivedKeys, signedResults, encryptedResults)) {
            continue;
        }
    }
    
    return true;
}
 
Example 9
Source File: SymmetricBindingPolicyValidator.java    From steady with Apache License 2.0 4 votes vote down vote up
public boolean validatePolicy(
    AssertionInfoMap aim,
    Message message,
    Element soapBody,
    List<WSSecurityEngineResult> results,
    List<WSSecurityEngineResult> signedResults,
    List<WSSecurityEngineResult> encryptedResults
) {
    Collection<AssertionInfo> ais = aim.get(SP12Constants.SYMMETRIC_BINDING);
    if (ais == null || ais.isEmpty()) {                       
        return true;
    }
    
    boolean hasDerivedKeys = false;
    for (WSSecurityEngineResult result : results) {
        Integer actInt = (Integer)result.get(WSSecurityEngineResult.TAG_ACTION);
        if (actInt.intValue() == WSConstants.DKT) {
            hasDerivedKeys = true;
            break;
        }
    }
    
    for (AssertionInfo ai : ais) {
        SymmetricBinding binding = (SymmetricBinding)ai.getAssertion();
        ai.setAsserted(true);

        // Check the protection order
        if (!checkProtectionOrder(binding, ai, results)) {
            continue;
        }
        
        // Check various properties of the binding
        if (!checkProperties(binding, ai, aim, results, signedResults, message)) {
            continue;
        }
        
        // Check various tokens of the binding
        if (!checkTokens(binding, ai, aim, hasDerivedKeys, signedResults, encryptedResults)) {
            continue;
        }
    }
    
    return true;
}
 
Example 10
Source File: AsymmetricBindingPolicyValidator.java    From steady with Apache License 2.0 4 votes vote down vote up
public boolean validatePolicy(
    AssertionInfoMap aim,
    Message message,
    Element soapBody,
    List<WSSecurityEngineResult> results,
    List<WSSecurityEngineResult> signedResults,
    List<WSSecurityEngineResult> encryptedResults
) {
    Collection<AssertionInfo> ais = aim.get(SP12Constants.ASYMMETRIC_BINDING);
    if (ais == null || ais.isEmpty()) {                       
        return true;
    }
    
    boolean hasDerivedKeys = false;
    for (WSSecurityEngineResult result : results) {
        Integer actInt = (Integer)result.get(WSSecurityEngineResult.TAG_ACTION);
        if (actInt.intValue() == WSConstants.DKT) {
            hasDerivedKeys = true;
            break;
        }
    }
    
    for (AssertionInfo ai : ais) {
        AsymmetricBinding binding = (AsymmetricBinding)ai.getAssertion();
        ai.setAsserted(true);

        // Check the protection order
        if (!checkProtectionOrder(binding, ai, results)) {
            continue;
        }
        
        // Check various properties of the binding
        if (!checkProperties(binding, ai, aim, results, signedResults, message)) {
            continue;
        }
        
        // Check various tokens of the binding
        if (!checkTokens(binding, ai, aim, hasDerivedKeys, signedResults, encryptedResults)) {
            continue;
        }
    }
    
    return true;
}
 
Example 11
Source File: SymmetricBindingPolicyValidator.java    From steady with Apache License 2.0 4 votes vote down vote up
public boolean validatePolicy(
    AssertionInfoMap aim,
    Message message,
    Element soapBody,
    List<WSSecurityEngineResult> results,
    List<WSSecurityEngineResult> signedResults,
    List<WSSecurityEngineResult> encryptedResults
) {
    Collection<AssertionInfo> ais = aim.get(SP12Constants.SYMMETRIC_BINDING);
    if (ais == null || ais.isEmpty()) {                       
        return true;
    }
    
    boolean hasDerivedKeys = false;
    for (WSSecurityEngineResult result : results) {
        Integer actInt = (Integer)result.get(WSSecurityEngineResult.TAG_ACTION);
        if (actInt.intValue() == WSConstants.DKT) {
            hasDerivedKeys = true;
            break;
        }
    }
    
    for (AssertionInfo ai : ais) {
        SymmetricBinding binding = (SymmetricBinding)ai.getAssertion();
        ai.setAsserted(true);

        // Check the protection order
        if (!checkProtectionOrder(binding, ai, results)) {
            continue;
        }
        
        // Check various properties of the binding
        if (!checkProperties(binding, ai, aim, results, signedResults, message)) {
            continue;
        }
        
        // Check various tokens of the binding
        if (!checkTokens(binding, ai, aim, hasDerivedKeys, signedResults, encryptedResults)) {
            continue;
        }
    }
    
    return true;
}
 
Example 12
Source File: AsymmetricBindingPolicyValidator.java    From steady with Apache License 2.0 4 votes vote down vote up
public boolean validatePolicy(
    AssertionInfoMap aim,
    Message message,
    Element soapBody,
    List<WSSecurityEngineResult> results,
    List<WSSecurityEngineResult> signedResults,
    List<WSSecurityEngineResult> encryptedResults
) {
    Collection<AssertionInfo> ais = aim.get(SP12Constants.ASYMMETRIC_BINDING);
    if (ais == null || ais.isEmpty()) {                       
        return true;
    }
    
    boolean hasDerivedKeys = false;
    for (WSSecurityEngineResult result : results) {
        Integer actInt = (Integer)result.get(WSSecurityEngineResult.TAG_ACTION);
        if (actInt.intValue() == WSConstants.DKT) {
            hasDerivedKeys = true;
            break;
        }
    }
    
    for (AssertionInfo ai : ais) {
        AsymmetricBinding binding = (AsymmetricBinding)ai.getAssertion();
        ai.setAsserted(true);

        // Check the protection order
        if (!checkProtectionOrder(binding, ai, results)) {
            continue;
        }
        
        // Check various properties of the binding
        if (!checkProperties(binding, ai, aim, results, signedResults, message)) {
            continue;
        }
        
        // Check various tokens of the binding
        if (!checkTokens(binding, ai, aim, hasDerivedKeys, signedResults, encryptedResults)) {
            continue;
        }
    }
    
    return true;
}