我试图让Apache在Spring中验证一个WSS4J。我们可以很好地启动服务,但是当我们发送SOAP请求时,我们会得到以下错误:
No message with ID "invalidSAMLsecurity" found in resource bundle "org/apache/xml/security/resource/xmlsecurity"; nested exception is org.apache.wss4j.common.ext.WSSecurityException: No message with ID "invalidSAMLsecurity" found in resource bundle "org/apache/xml/security/resource/xmlsecurity"现在,根据我的理解,当您没有调用WSSec.init()方法时,就会发生这种情况。但是,Apache中唯一的WSSec类是在org.apache.wss4j.stax包中,而且使用Maven下载WSS4J 2.2.3似乎不允许您访问stax包。
我很肯定我只是找错地方了,但是当前的Apache是针对WSS4J的,所以我甚至不确定我使用的版本是否有访问这些包的权限,而且我似乎找不到2.2.3版本的2.3.0-SNAPSHOT。
我确信这只是找到正确的初始化的问题,我只是不确定这些初始化将在何处配置。
发布于 2019-06-28 10:52:00
为了能够验证签名的xml,使用头部中存在的binarySecurityToken --您需要确保xml是使用
"WSHandlerConstants.SIG_KEY_ID“= "DirectReference”
List<WSSecurityEngineResult> res = engine.processSecurityHeader(signedDoc, null, null, crypto); signedDoc - SOAP信封作为文档
使用此方法验证签名。另外,在下面设置Crypto实例。
密码密码= CryptoFactory.getInstance("validator.properties");
尝试下面的Maven依赖项(这是我已有的一个工作示例)
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>2.1.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.wss4j</groupId>
<type>pom</type>
<artifactId>wss4j</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.wss4j</groupId>
<artifactId>wss4j-ws-security-dom</artifactId>
<version>2.0.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.ws.security</groupId>
<artifactId>wss4j</artifactId>
<version>1.6.19</version>
</dependency>
<dependency>
<groupId>org.apache.wss4j</groupId>
<artifactId>wss4j-ws-security-common</artifactId>
<version>2.0.2</version>
</dependency>https://stackoverflow.com/questions/56793663
复制相似问题