首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Apache WSS4J未能初始化

Apache WSS4J未能初始化
EN

Stack Overflow用户
提问于 2019-06-27 14:49:17
回答 1查看 1.8K关注 0票数 0

我试图让Apache在Spring中验证一个WSS4J。我们可以很好地启动服务,但是当我们发送SOAP请求时,我们会得到以下错误:

代码语言:javascript
复制
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

我确信这只是找到正确的初始化的问题,我只是不确定这些初始化将在何处配置。

EN

回答 1

Stack Overflow用户

发布于 2019-06-28 10:52:00

为了能够验证签名的xml,使用头部中存在的binarySecurityToken --您需要确保xml是使用

"WSHandlerConstants.SIG_KEY_ID“= "DirectReference”

代码语言:javascript
复制
 List<WSSecurityEngineResult> res = engine.processSecurityHeader(signedDoc, null, null, crypto); 

signedDoc - SOAP信封作为文档

使用此方法验证签名。另外,在下面设置Crypto实例。

密码密码= CryptoFactory.getInstance("validator.properties");

尝试下面的Maven依赖项(这是我已有的一个工作示例)

代码语言:javascript
复制
    <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>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56793663

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档