WS-Security无法使用CXF 3.1和Spring 4

时间:2016-04-08 14:37:41

标签: spring cxf

我在Spring 4.2.5中使用Apache Cxf 3.0.5,使用WS-Security保护Web服务

以下是示例标题

           测试一下       测试        

我正在使用以下拦截器,但无法获取身份验证标头信息

公共类JaxWsAuthenticationInterceptor扩展了AbstractPhaseInterceptor {

public JaxWsAuthenticationInterceptor() {
    super(Phase.POST_PROTOCOL);
}

public void handleMessage(SoapMessage message) throws Fault {

    List<WSHandlerResult> result = (List<WSHandlerResult>) message.getContextualProperty(WSHandlerConstants.RECV_RESULTS);
    for (WSHandlerResult res : result) {
        for (WSSecurityEngineResult secRes : res.getResults()) {
            Integer action = (Integer) secRes.get(WSSecurityEngineResult.TAG_ACTION);
            if (action != null && (action & WSConstants.UT) > 0) {
                WSUsernameTokenPrincipalImpl principal = (WSUsernameTokenPrincipalImpl) secRes.get(WSSecurityEngineResult.TAG_PRINCIPAL);                    
            }
        }
    }
}

}

0 个答案:

没有答案