java – WSContext. Getuserprincipal() returns null for password digest validation

In my web service, I need to record the caller's ID, but wscontext Getuserprincipal() returns null, even if the user authenticates through WS security with password authentication According to JavaDocs for jax-ws 2.1, if the user has not been authenticated, wscontext Getuserprincipal() can only return null

Do I have to do something in the security handler to set the user principal to wscontext? The document seems to indicate that it is done automatically

I'm using the city 1.1 stack (1.1.5 I think) with Jax WS 2.1 on Tomcat 3 stack

Solution

Try iterating over wscontext getMessageContext(). Entryset () and displays the values. Sometimes they are there, but for some reason, the getuserprincipal () method cannot retrieve them

In this case, get your principal directly from there and leave a comment that you are not very portable in the future

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>