当前位置: 首页>>代码示例>>Java>>正文


Java CryptoFactoryBean.setKeyStoreLocation方法代码示例

本文整理汇总了Java中org.springframework.ws.soap.security.wss4j.support.CryptoFactoryBean.setKeyStoreLocation方法的典型用法代码示例。如果您正苦于以下问题:Java CryptoFactoryBean.setKeyStoreLocation方法的具体用法?Java CryptoFactoryBean.setKeyStoreLocation怎么用?Java CryptoFactoryBean.setKeyStoreLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.ws.soap.security.wss4j.support.CryptoFactoryBean的用法示例。


在下文中一共展示了CryptoFactoryBean.setKeyStoreLocation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: keystoreCrypto

import org.springframework.ws.soap.security.wss4j.support.CryptoFactoryBean; //导入方法依赖的package包/类
@Bean
public CryptoFactoryBean keystoreCrypto() throws Exception {
	CryptoFactoryBean cryptoFactoryBean = new CryptoFactoryBean();
	cryptoFactoryBean.setKeyStoreLocation(keystore.getKeystore());
	cryptoFactoryBean.setDefaultX509Alias("mykey");

	cryptoFactoryBean.setKeyStorePassword(keystore.getKeystorePassword());
	return cryptoFactoryBean;
}
 
开发者ID:koen-serneels,项目名称:ws-proxy,代码行数:10,代码来源:OutboundInterceptors.java

示例2: truststoreCrypto

import org.springframework.ws.soap.security.wss4j.support.CryptoFactoryBean; //导入方法依赖的package包/类
@Bean
public CryptoFactoryBean truststoreCrypto() throws Exception {
	CryptoFactoryBean cryptoFactoryBean = new CryptoFactoryBean();
	cryptoFactoryBean.setKeyStoreLocation(truststore.getKeystore());
	cryptoFactoryBean.setKeyStorePassword(truststore.getKeystorePassword());
	return cryptoFactoryBean;
}
 
开发者ID:koen-serneels,项目名称:ws-proxy,代码行数:8,代码来源:OutboundInterceptors.java

示例3: createCryptoFactory

import org.springframework.ws.soap.security.wss4j.support.CryptoFactoryBean; //导入方法依赖的package包/类
private void createCryptoFactory(Resource location, String password) throws Exception {
    LOG.debug(String.format("Creating CryptoFacade with KeyStore at '%s'", location));
    CryptoFactoryBean cryptoFactory = new CryptoFactoryBean();
    cryptoFactory.setKeyStoreLocation(location);
    cryptoFactory.setKeyStorePassword(password);
    cryptoFactory.setKeyStoreType(KEY_STORE_TYPE);
    cryptoFactory.setKeyStoreProvider(KEY_STORE_PROVIDER);
    cryptoFactory.afterPropertiesSet();
    cryptoFacade.setCrypto((Crypto) cryptoFactory.getObject());
    cryptoFacade.setWsSecurityEngine(wsSecurityEngine);
}
 
开发者ID:barnyard,项目名称:pi,代码行数:12,代码来源:KeyStoreCreatingCryptoFacadeFactoryBean.java

示例4: test

import org.springframework.ws.soap.security.wss4j.support.CryptoFactoryBean; //导入方法依赖的package包/类
@Test
public void test() throws Exception {
	
	WebServiceTemplate template = new WebServiceTemplate();
	
	SaajSoapMessageFactory messageFactory = new SaajSoapMessageFactory();
	messageFactory.setSoapVersion(SoapVersion.SOAP_12);
	messageFactory.afterPropertiesSet();
	template.setMessageFactory(messageFactory);
	
	CryptoFactoryBean cryptoFactory = new CryptoFactoryBean();
	cryptoFactory.setKeyStoreLocation(new ClassPathResource("keystore.jks"));
	cryptoFactory.setKeyStorePassword("password");
	cryptoFactory.afterPropertiesSet();
	Crypto crypto = cryptoFactory.getObject();
	
	SAML2CallbackHandler samlCallbackHandler = new SAML2CallbackHandler(crypto, "selfsigned");
	
	SAMLIssuerImpl issuer = new SAMLIssuerImpl();
	issuer.setIssuerCrypto(crypto);
	issuer.setIssuerKeyName("selfsigned");
	issuer.setIssuerKeyPassword("password");
	issuer.setIssuerName("selfsigned");
	issuer.setSendKeyValue(false);
	issuer.setSignAssertion(true);
	issuer.setCallbackHandler(samlCallbackHandler);
	
	Wss4jSecurityInterceptor securityInterceptor = new Wss4jSecurityInterceptor();
	securityInterceptor.setSecurementActions("Timestamp SAMLTokenSigned");
	securityInterceptor.setSecurementSignatureCrypto(crypto);
	securityInterceptor.setSecurementUsername("selfsigned");
	securityInterceptor.setSecurementPassword("password");
	securityInterceptor.setSamlIssuer(issuer);
	securityInterceptor.afterPropertiesSet();
	
	template.setInterceptors(new ClientInterceptor[] {securityInterceptor});
	template.afterPropertiesSet();
	
	Element hello = new Element("Hello", "urn:jaminh:example");
	template.sendSourceAndReceiveToResult("http://localhost:8080/spring-saml-example-war", new JDOMSource(hello), new JDOMResult());
	template.sendSourceAndReceiveToResult("http://localhost:8080/spring-saml-example-war", new JDOMSource(hello), new JDOMResult());
	template.sendSourceAndReceiveToResult("http://localhost:8080/spring-saml-example-war", new JDOMSource(hello), new JDOMResult());
	
}
 
开发者ID:jaminh,项目名称:spring-saml-example-war,代码行数:45,代码来源:HelloTest.java


注:本文中的org.springframework.ws.soap.security.wss4j.support.CryptoFactoryBean.setKeyStoreLocation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。