Hi

AFAIK, CXF HttpConduit will attempt a re-transmit if 401 is returned and a custom CXF HttpAuthSupplier is registered.

For example, see

https://github.com/apache/cxf/blob/master/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/client/BearerAuthSupplier.java

In your custom supplier you'd override:
public String getAuthorization(AuthorizationPolicy authPolicy,
                                   URI currentURI,
                                   Message message,
String fullHeader) {}

perhaps you'd do the extra calls inside this method before returning the final Authorization value for the original request to continue

Sergey




On 17/10/16 08:45, Konrad Windszus wrote:
I want to call a ReST web service with a JAX-RS client based on CXF. That web 
service has a custom authentication based on cookies and challenge/response 
authentication. To get authenticated (i.e. whenever a regular call returns a 
401) a dedicated GET request must be issued to get the challenge, and then an 
additional POST request to authenticate the user (and get back an 
authentication token as cookie). Instead of doing the authentication explicitly 
I would rather call that whenever necessary (to also deal with cases where 
previous authentication became invalid), i.e. as Interceptor or as Filter. The 
question is, how do I retrigger the original request once the user has been 
successfully authenticated in a ClientResponseFilter or Interceptor in case a 
401?
Has someone ever implemented something like this?
Thanks,
Konrad



--
Sergey Beryozkin

Talend Community Coders
http://coders.talend.com/

Reply via email to