kamaci
kamaci

Reputation: 75117

How to Enable Spring Security for Apache-CXF JAX-WS

How can I enable Spring Security for apache JAX-WS at Apache-CXF? Examples at web includes Jax-RS examples but I don't use Jax-RS. I don't want to use cxf's security. How can implement it at my code?

Upvotes: 5

Views: 11351

Answers (1)

sourcedelica
sourcedelica

Reputation: 24040

Two potential ways:

  1. Put a BasicAuthenticationFilter or DigestAuthenticationFilter in front of your CXF Servlet.

  2. Use a WS-Security UsernamePasswordToken with CXF and write a CallbackHandler that a) creates a UsernamePasswordAuthenticationToken, b) calls authenticationManager.authenticate() and c) stores the authentication in the SecurityContextHolder.

Note that the above doesn't cover the concept of logout since login sessions are generally implemented with cookies and the above are stateless approaches. If you really need logout then you should consider using OAuth because you can implement logout by invalidating access tokens.

Upvotes: 9

Related Questions