我在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);
}
}
}
}
}