Crypto userCrypto = CryptoFactory.getInstance("wss40.properties");
SAML1CallbackHandler callbackHandler = new SAML1CallbackHandler();
callbackHandler.setStatement(SAML1CallbackHandler.Statement.AUTHN);
callbackHandler.setConfirmationMethod(SAML1Constants.CONF_HOLDER_KEY);
SAMLIssuer saml = new SAMLIssuerImpl();
saml.setIssuerName("www.example.com");
saml.setIssuerCrypto(issuerCrypto);
saml.setIssuerKeyName("wss40_server");
saml.setIssuerKeyPassword("security");
saml.setSignAssertion(true);
saml.setCallbackHandler(callbackHandler);
AssertionWrapper assertion = saml.newAssertion();
WSSecSignatureSAML wsSign = new WSSecSignatureSAML();
wsSign.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
wsSign.setUserInfo("wss40", "security");