相关疑难解决方法(0)

CXF 3.X和WSS4J 2.X中的CallbackHandler

我正在尝试将当前的应用程序升级到CXF 3和WSS4J 2.这让我非常头疼.

客户端的当前应用程序代码:

private void secureWebService( Client client, final Credentials credentials ) {

  // set some WS-Security information
  Map<String,Object> outProps = new HashMap<String,Object>();
  outProps.put( WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN );
  outProps.put( WSHandlerConstants.USER, credentials.getUsername() );
  outProps.put( WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT );

  // Callback used to retrieve password for given user.
  outProps.put( WSHandlerConstants.PW_CALLBACK_REF, new CallbackHandler() {
     @Override
     public void handle( Callback[] callbacks ) throws IOException, UnsupportedCallbackException {
        WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
        pc.setPassword( credentials.getPassword() );
     }
  });

  WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor( outProps );
  client.getOutInterceptors().clear();
  client.getOutInterceptors().add( …
Run Code Online (Sandbox Code Playgroud)

apache ws-security web-services cxf wss4j

3
推荐指数
1
解决办法
4376
查看次数

有没有办法从CXF中的JAX-RS REST资源访问CXF消息交换?

目前我们有一个使用CXF 2.4.2的RESTful API.在我的一个资源方法中,我想处理一些查询参数并将结果存储在CXF消息交换中,以便稍后使用输出拦截器.

我已经尝试过注入这里提到的WebServiceContext ,但它似乎没有用,可能是因为它是JAX-WS规范的一部分,我们正在使用JAX-RS.

任何帮助将不胜感激!

rest spring message exchange-server cxf

2
推荐指数
1
解决办法
4349
查看次数