Search in sources :

Example 31 with X509Token

use of org.apache.wss4j.policy.model.X509Token in project cxf by apache.

the class X509TokenPolicyValidator method validatePolicies.

/**
 * Validate policies.
 */
public void validatePolicies(PolicyValidatorParameters parameters, Collection<AssertionInfo> ais) {
    List<WSSecurityEngineResult> bstResults = parameters.getResults().getActionResults().get(WSConstants.BST);
    for (AssertionInfo ai : ais) {
        X509Token x509TokenPolicy = (X509Token) ai.getAssertion();
        ai.setAsserted(true);
        assertToken(x509TokenPolicy, parameters.getAssertionInfoMap());
        if (!isTokenRequired(x509TokenPolicy, parameters.getMessage())) {
            continue;
        }
        if ((bstResults == null || bstResults.isEmpty()) && parameters.getSignedResults().isEmpty()) {
            ai.setNotAsserted("The received token does not match the token inclusion requirement");
            continue;
        }
        if (!checkTokenType(x509TokenPolicy.getTokenType(), bstResults, parameters.getSignedResults())) {
            ai.setNotAsserted("An incorrect X.509 Token Type is detected");
            continue;
        }
    }
}
Also used : AssertionInfo(org.apache.cxf.ws.policy.AssertionInfo) X509Token(org.apache.wss4j.policy.model.X509Token) WSSecurityEngineResult(org.apache.wss4j.dom.engine.WSSecurityEngineResult)

Aggregations

X509Token (org.apache.wss4j.policy.model.X509Token)31 IssuedToken (org.apache.wss4j.policy.model.IssuedToken)21 SecurityContextToken (org.apache.wss4j.policy.model.SecurityContextToken)20 AbstractToken (org.apache.wss4j.policy.model.AbstractToken)19 KerberosToken (org.apache.wss4j.policy.model.KerberosToken)19 SpnegoContextToken (org.apache.wss4j.policy.model.SpnegoContextToken)18 UsernameToken (org.apache.wss4j.policy.model.UsernameToken)18 SamlToken (org.apache.wss4j.policy.model.SamlToken)14 KeyValueToken (org.apache.wss4j.policy.model.KeyValueToken)13 SecureConversationToken (org.apache.wss4j.policy.model.SecureConversationToken)12 QName (javax.xml.namespace.QName)9 AssertionInfo (org.apache.cxf.ws.policy.AssertionInfo)9 SecurityToken (org.apache.cxf.ws.security.tokenstore.SecurityToken)8 AlgorithmSuiteType (org.apache.wss4j.policy.model.AlgorithmSuite.AlgorithmSuiteType)8 SupportingTokens (org.apache.wss4j.policy.model.SupportingTokens)8 WSSSecurityProperties (org.apache.wss4j.stax.ext.WSSSecurityProperties)7 WSSecUsernameToken (org.apache.wss4j.dom.message.WSSecUsernameToken)6 WSSConstants (org.apache.wss4j.stax.ext.WSSConstants)6 Element (org.w3c.dom.Element)6 SOAPException (javax.xml.soap.SOAPException)5