I´ve been stucked with this task for days now.. In the login form of my web application, before the user could enter the username and password, I want to receive in the request the username of his Windows account. After a lot of research I´ve found that Kerberos is what I have to use, but I don´t know how. I have access to the Active Directory server, so I created the service principal name, established on Java the connection to the AD, but it´s impossible to me to get the windows user.
Now I´m trying yo use Waffle, and as I read, is as simple as import some JARs and in a JSP file get the principal name (it´s suppose to be the Windows user), but as I sayed, I couldn´t do it.
Has anyone done something similar before??
Any help would be REALLY appreciatted,
Thanks in advance.
UPDATE:
As you requested, this is what I´ve done so far:
On the WServer 2012 R2 (where I have the AD) I created a user called santi.mitrol.net
Register a spn to that user with the following command:
setspn -A HTTP/santi.mitrol.net santi.mitrol.net
and after this, I created the related keytab:
ktpass -out C:\temp\test.keytab -princ HTTP/santi.mitrol.net@DEV-MITROL.LOCAL -mapUser santi.mitrol.net -mapOp set -pass MYPASS -crypto RC4-HMAC-NT -pType KRB5_NT_PRINCIPAL
After this setup, I created this project: https://github.com/spring-projects/spring-security-kerberos/tree/master/spring-security-kerberos-samples/sec-server-win-auth/src/main but I can´t make it work...
With Waffle the same.. on my web.xml I have this:
<filter-name>SecurityFilter</filter-name>
<!--<filter-class>waffle.servlet.NegotiateSecurityFilter</filter-class>-->
<filter-class>net.mitrol.config.activedirectory.CustomFilter</filter-class>
<filter-name>SecurityFilter</filter-name>
<url-pattern>/*</url-pattern>
But when I make a request to the Tomcat that I have deployed on my PC from another PC, they get the prompt for entering the credentials, and that´s not what I need, I only need to receive on the request the Windows user that is logged in on the machine that is making the request.
Thanksssss