Java springboot soap请求中的URL资源
我正在使用spring boot对证书进行数字签名。这是我的代码片段Java springboot soap请求中的URL资源,java,spring-boot,soap,ws-security,Java,Spring Boot,Soap,Ws Security,我正在使用spring boot对证书进行数字签名。这是我的代码片段 @Bean public Wss4jSecurityInterceptor securityInterceptor() throws Exception { Wss4jSecurityInterceptor securityInterceptor = new Wss4jSecurityInterceptor(); // set security actions securityInterceptor.s
@Bean
public Wss4jSecurityInterceptor securityInterceptor() throws Exception {
Wss4jSecurityInterceptor securityInterceptor = new Wss4jSecurityInterceptor();
// set security actions
securityInterceptor.setSecurementActions("Timestamp Signature");
// sign the request
securityInterceptor.setSecurementPassword("password");
securityInterceptor.setSecurementSignatureCrypto(getCryptoFactoryBean().getObject());
securityInterceptor.setSecurementSignatureKeyIdentifier("DirectReference");
return securityInterceptor;
}
@Bean
public CryptoFactoryBean getCryptoFactoryBean() throws IOException {
CryptoFactoryBean cryptoFactoryBean = new CryptoFactoryBean();
cryptoFactoryBean.setKeyStorePassword("password");
cryptoFactoryBean.setKeyStoreLocation(new UrlResource("http://hostname/cert.p12"));
return cryptoFactoryBean;
}
我得到以下错误:
原因:java.io.FileNotFoundException:URL[http://hostname/cert.p12]无法解析为绝对文件路径,因为它不位于文件系统中:http://hostname/cert.p12
位于org.springframework.util.ResourceUtils.getFile(ResourceUtils.java:215)
位于org.springframework.core.io.AbstractFileResolvingerSource.getFile(AbstractFileResolvingerSource.java:53)
位于org.springframework.core.io.UrlResource.getFile(UrlResource.java:213)
位于org.springframework.ws.soap.security.wss4j2.support.CryptoFactoryBean.getResourcePath(CryptoFactoryBean.java:91)
有没有办法在cryptoFactoryBean.setKeyStoreLocation中使用URL
谢谢,显然不是。由于
CryptoFactoryBean
要求它位于文件系统上(由于使用了仅适用于本地资源的getFile
),感谢您的确认。除了CryptoFactoryBean之外,您知道在这个场景中还可以使用什么吗?显然不知道。由于CryptoFactoryBean
要求它位于文件系统上(由于使用了仅适用于本地资源的getFile
),感谢您的确认。除了CryptoFactoryBean之外,您知道在这个场景中还可以使用什么吗?