Java SSO against a linux tomcat (mod_jk) - java

We are using mod_jk as load balancer between the java client apps and the tomcat server. Any service request can reach another tomcat. That makes the handshake more difficult.
The Server is Linux based what means for us we can't use waffle (it's for windows only).
NTLM is also not a option for our company because of the security (deprecation).
Using Spengo for HTTP request authentification is not possible. We have some requests that have to be accepted without any login/permission (public permission).
Are there any other alternatives or working examples with Spengo to realize a SSO for the windows clients?

Related

Windows integrated authentication for java web application SSO

Background: I currently have a java web application which is run on localhost on my Mac. Users can login to the web application, and their credentials are validated against an OpenLDAP server which is run on a certain port on my local machine as well (specifically using this docker image). The web application includes code which interacts with the LDAP server to provide the login username and password. Upon successful validation, the users are logged in and can continue to use the features of the app.
Problem: This web application will be deployed to clients who will be using Windows. They are requesting SSO capabilities - I.e. successful login to their windows machines under their domain bypasses the need for logging in to the web application when they run it. The clients cannot have some other Java application running on their machine which will help with SSO - simply logging into their windows machine should bypass the need for logging into the web application, which means Windows needs to be configured a certain way, and the web application needs to be configured a certain way for SSO. For testing purposes, I am using a windows 7 virtual machine which is run on the same machine that I am running and testing the web application on.
I've done research on SPNEGO, Java GSS API (looks like it needs client side code to communicate with server), Kerberos, Windows IIS etc. I know how to enable windows integrated authentication in Windows, but I don't know how to actually use this with my web application to enable SSO. Basically, I am still struggling on how to implement SSO capabilities in my specific case under these circumstances. Here are some specific questions:
Can browsers be configured to send encrypted windows credentials of the machine they are running on to the web application, which can then be decrypted by the web application and authenticated against LDAP? If so, how does this work?
Can the windows login credentials be configured to point to an LDAP server that validates them?
Overall, how can I integrate single sign on for a web application running on a windows machine, where the web application is configured to authenticate credentials through an LDAP server?
Windows SSO is based on Kerberos, not on LDAP. The reason why people usually mix them up is that Microsoft Active Directory acts as both LDAP server and Kerberos server.
If you need transparent authentication (SSO) for your Windows users you have to implement Kerberos authentication.
They way how Kerberos is implemented for web applications is called SPNEGO.
You need to do the following:
Create a service account in Active Directory for your server, say REALM\svc_server
Create an SPN for your server which will bind the domain name of your server to this server account. If your server is running on https://server.acme.com it should be HTTP/server.acme.com
If windows user is logged into domain REALM and goes to https://server.acme.com browser will lookup an SPN based on name HTTP/server.acme.com, request a Kerberos ticket from Active Directory and send it to server in a Authorization header as per SPNEGO specification
Now you just need to validate this ticket using built-in Java Kerberos API or using some third-party library (kerb4j, spring-security-kerberos, e.t.c.)
As you can see LDAP is not involved in this authentication flow (although it can be used for authorization as a next step)

SSO - from java clients on windows to java server on linux

I have a java application running on windows, which I need to authenticate to java application (servlet container) running on linux. I'm unfamiliar of this issue, so tried googling and experminted with different technologies, here are some things I found - all weren't right for me:
Waffle - waffle works only for Windows server. I thought redirecting the incoming requests to a Windows server for the login process, but that just adds new servers which I will need to support.
Spengo - I doesn't say if it works linux, but I think it is meant for Windows server. (I mean this OS implementation - http://spnego.sourceforge.net/)
I'm using tomcat, but we are migrating to different servers, so I don't want a specific "tomcat" solution, but rather one that I can use in pure java, if possible (or a servlet filter solution, which can run on any standard serlvet container).
There are lots of patterns available. You haven't mentioned how is the communication between your Java application and the server.
You can easily get ServletFilter model to work if the communication between your applications and server is over http.
If the communication is over RMI, you can intercept RMI requests on the server and perform authentication/authorisation before completing the request.
Take a look at Spring security : http://docs.spring.io/spring-security/site/docs/3.0.x/reference/springsecurity.html

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)

Implementing SSO in Apache, Jetty or Java Web Service

Hello stackoverflow'ers
we are currently faced with the task to support Single Sign On in our Java based web service.
The setup is like this: Linux server running Apache as a proxy -> Jetty -> Java web service.
All of this in a Windows Domain with Windows workstations as clients accessing the web service through their browser (mainly IE, some firefox).
The SSO will go through the Windows AD DC utilizing Kerberos through SPNEGO.
From what I have gathered it would be possible to implement the SSO either step of the way, in Apache, in Jetty or in the Java Code itself.
What I haven't been able to figure out so far is which approach makes the most sense in the given environment.
We obviously need to access the REMOTE_USER one way or another later on to perform further authorization in our application, but this is the only real requirement we have.
So what are the actual pro's and con's of implementing the SSO / SPNEGO on the Apache level vs. the Jetty level vs. in our own software - if there are any ?
Any help would be greatly appreciated!
Enjoy your day,
Tom
https://github.com/michael-o/mod_spnego/ for Apache Web Server and you are done.

Windows authentication in a Java/Tomcat server with an Android app

My project is an Android application that communicates with a server. The server is written in Java, deployed in Tomcat, and running on a Windows Server host.
I need to provide authentication against Windows domain accounts. Basically I need to ask the user of the app to type in their username and password; send this data to the Tomcat server; and have the server authenticate it.
I'm having trouble finding a straight answer as to how to do this. Since my app is not a web site, I don't have the option to do browser redirects or anything like that, and obviously the Android device on which the app runs is not a Windows machine and will most likely not even be on the local network.
I don't really need to execute anything as the Windows user, I just need to know that they are who they say they are. Hopefully there is a simple way to do this?
Thanks.
Assuming you want to use Java EE container-based form authentication, on the server you'll have to:
secure your web application
configure Tomcat to use Windows authentication
On the client, you can:
POST application/x-www-form-urlencoded login data with the special keys in the web form (j_password, etc.)
retain the session cookies in the response for subsequent interactions with the server
I haven't tested the specifics with these exact technologies but approach is sound.

Categories

Resources