You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jorgen Chr Grooss <jo...@trapezegroup.com> on 2017/06/02 11:37:17 UTC

How to authenticate without password

Hi,

I have had the task to create a WS based on an existing WSDL.
I used CXF 3.1.11 to create it, and deployed it on Tomcat with basic authentication.
And all that worked fine.

I use the username in my service by getting a Pricipal in the WS.
java.security.Principal principal = wsContext.getUserPrincipal();

However now I need to call the WS without password is authenticated, but still I need the username in my WS.
If I do not authenticate in Tomcat the getUserPrincipal() returns null.
I can see that I do a lot of things in CXF, but I cannot point out how to do it.
Can you help me in the right direction?


Best Regards

Jørgen Christian

Re: How to authenticate without password

Posted by Colm O hEigeartaigh <co...@apache.org>.
You'll probably have to write a CXF interceptor to grab the header and
extract the Basic Auth username manually. For example:

https://github.com/apache/cxf/blob/master/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/interceptors/HttpsTokenInterceptorProvider.java#L156

On Fri, Jun 2, 2017 at 12:37 PM, Jorgen Chr Grooss <
jorgenchr.grooss@trapezegroup.com> wrote:

> Hi,
>
> I have had the task to create a WS based on an existing WSDL.
> I used CXF 3.1.11 to create it, and deployed it on Tomcat with basic
> authentication.
> And all that worked fine.
>
> I use the username in my service by getting a Pricipal in the WS.
> java.security.Principal principal = wsContext.getUserPrincipal();
>
> However now I need to call the WS without password is authenticated, but
> still I need the username in my WS.
> If I do not authenticate in Tomcat the getUserPrincipal() returns null.
> I can see that I do a lot of things in CXF, but I cannot point out how to
> do it.
> Can you help me in the right direction?
>
>
> Best Regards
>
> Jørgen Christian
>



-- 
Colm O hEigeartaigh

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