Examples of WSSecurityEngine


Examples of org.apache.ws.security.WSSecurityEngine

                XMLUtils.PrettyDocumentToString(signedDoc);
            LOG.debug(outputString);
        }
       
        try {
            WSSecurityEngine secEngine = new WSSecurityEngine();
            secEngine.processSecurityHeader(doc, null, callbackHandler, null);
            fail("The UsernameToken validation should have failed");
        } catch (WSSecurityException ex) {
            assertTrue(ex.getErrorCode() == WSSecurityException.MESSAGE_EXPIRED);
       
    }
View Full Code Here

Examples of org.apache.ws.security.WSSecurityEngine

     *
     * @param env soap envelope
     * @throws java.lang.Exception Thrown when there is a problem in verification
     */
    private List<WSSecurityEngineResult> verify(Document doc, boolean allowUsernameTokenDerivedKeys) throws Exception {
        WSSecurityEngine secEngine = new WSSecurityEngine();
        WSSConfig config = WSSConfig.getNewInstance();
        config.setAllowUsernameTokenNoPassword(allowUsernameTokenDerivedKeys);
        secEngine.setWssConfig(config);
        return secEngine.processSecurityHeader(doc, null, callbackHandler, null);
    }
View Full Code Here

Examples of org.apache.ws.security.WSSecurityEngine

     *
     * @param doc
     * @throws Exception Thrown when there is a problem in verification
     */
    private List<WSSecurityEngineResult> verify(Document doc) throws Exception {
        WSSecurityEngine secEngine = new WSSecurityEngine();
        List<WSSecurityEngineResult> results =
            secEngine.processSecurityHeader(
                doc, null, null, crypto
            );
        String outputString =
            org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(doc);
        assertTrue(outputString.indexOf("counter_port_type") > 0 ? true : false);
View Full Code Here

Examples of org.apache.ws.security.WSSecurityEngine

    private List<WSSecurityEngineResult> verifyWithoutProfile(Document doc) throws Exception {
        SamlAssertionValidator validator = new SamlAssertionValidator();
        validator.setValidateSignatureAgainstProfile(false);
       
        WSSecurityEngine secEngine = new WSSecurityEngine();
        WSSConfig config = secEngine.getWssConfig();
        config.setValidator(WSSecurityEngine.SAML_TOKEN, validator);
        config.setValidator(WSSecurityEngine.SAML2_TOKEN, validator);
       
        List<WSSecurityEngineResult> results =
            secEngine.processSecurityHeader(
                doc, null, null, crypto
            );
        String outputString =
            org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(doc);
        assertTrue(outputString.indexOf("counter_port_type") > 0 ? true : false);
View Full Code Here

Examples of org.apache.ws.security.WSSecurityEngine

            LOG.debug("Encrypted message:");
            LOG.debug(outputString);
        }
        assertTrue(outputString.indexOf("counter_port_type") == -1 ? true : false);
       
        WSSecurityEngine newEngine = new WSSecurityEngine();
        WSSConfig wssConfig = WSSConfig.getNewInstance();
        wssConfig.setWsiBSPCompliant(false);
        newEngine.setWssConfig(wssConfig);
        verify(encryptedDoc, newEngine, keystoreCallbackHandler, SOAP_BODY);
    }
View Full Code Here

Examples of org.apache.ws.security.WSSecurityEngine

        assertTrue(outputString.indexOf("testMethod") == -1);
        if (LOG.isDebugEnabled()) {
            LOG.debug(outputString);
        }
       
        WSSecurityEngine newEngine = new WSSecurityEngine();
        newEngine.getWssConfig().setPasswordsAreEncoded(true);
        newEngine.getWssConfig().setAllowUsernameTokenNoPassword(true);
        newEngine.processSecurityHeader(
            encryptedDoc, null, new EncodedPasswordCallbackHandler(), null
        );
    }
View Full Code Here

Examples of org.apache.ws.security.WSSecurityEngine

        assertTrue(outputString.indexOf("wsse11:Iteration") != -1);
        if (LOG.isDebugEnabled()) {
            LOG.debug(outputString);
        }
       
        WSSecurityEngine newEngine = new WSSecurityEngine();
        newEngine.getWssConfig().setPasswordsAreEncoded(true);
        newEngine.getWssConfig().setAllowUsernameTokenNoPassword(true);
        List<WSSecurityEngineResult> results =  newEngine.processSecurityHeader(
            signedDoc, null, new EncodedPasswordCallbackHandler(), null
        );
        WSSecurityEngineResult actionResult =
            WSSecurityUtil.fetchActionResult(results, WSConstants.SIGN);
        java.security.Principal principal =
View Full Code Here

Examples of org.apache.ws.security.WSSecurityEngine

            // expected
        }
       
        // Turn off BSP compliance and it should work
        config.setWsiBSPCompliant(false);
        WSSecurityEngine newEngine = new WSSecurityEngine();
        newEngine.setWssConfig(config);
        config.setAllowUsernameTokenNoPassword(true);
        newEngine.processSecurityHeader(doc, null, callbackHandler, crypto);
    }
View Full Code Here

Examples of org.apache.ws.security.WSSecurityEngine

       
        // Turn off BSP compliance and it should work
        WSSConfig config = WSSConfig.getNewInstance();
        config.setWsiBSPCompliant(false);
        config.setAllowUsernameTokenNoPassword(true);
        WSSecurityEngine newEngine = new WSSecurityEngine();
        newEngine.setWssConfig(config);
        newEngine.processSecurityHeader(doc, null, callbackHandler, crypto);
    }
View Full Code Here

Examples of org.apache.ws.security.WSSecurityEngine

       
        // Turn off BSP compliance and it should work
        WSSConfig config = WSSConfig.getNewInstance();
        config.setWsiBSPCompliant(false);
        config.setAllowUsernameTokenNoPassword(true);
        WSSecurityEngine newEngine = new WSSecurityEngine();
        newEngine.setWssConfig(config);
        newEngine.processSecurityHeader(doc, null, callbackHandler, crypto);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.