简体   繁体   中英

How to authenticate a windows user in java web service?

I recently did a quick mock up of a web service using C# on IIS. All users are using Windows so, in the web service, I was able to get the current user via NTLM.

Now I have to migrate this to a Java web service running on Tomcat or WebSphere.

What authentication options are open to me? I see that Apache HttpComponents has an NTLM feature but I can only find instructions on how to use it on the client side. Can I use it in my web service to determine the current user? (Remember, all users will be Windows users)

Just to clarify: this is for use in a company intranet and all users will be logged in to Windows. This is why NTLM seems to be the right way to go.

Try WAFFLE windows authentication framework. ( http://waffle.codeplex.com/ )

It is one of the third party libraries suggested in the tomcat documentation. ( https://tomcat.apache.org/tomcat-7.0-doc/windows-auth-howto.html )

It comes with zero configurations and all you have to do is to modify your web.xml to you waffle as in this tutorial ( http://code.dblock.org/2010/05/20/single-sign-on-tomcat-negotiate-authenticator-kerberos-ntlm-w-waffle.html )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM