Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Username in HTTP Header for SSO

I am looking to add single sign on (SSO) to one of my web applications. I don't want anything heavy at the moment, I just want to know the userId of the logged in user, without the need for them to enter a username.

The web app is an internal application, so I can guarantee they are coming from a Windows PC etc.

I have looked at jCIFS, but this doesn't seem to be supported any more, and recommends a commercial product.

I have also looked at WAFFLE, but I am building SSO for a playframework application, which does not use a Servlet stack, so I can't make use of the SecurityFilter. I have tried to make sense of the WindowsLoginModule, but couldn't really understand what I had to do to implement it.

Is it possible to just get the username from the HTTP header, or does it require some negotiation first before it will post the header?

like image 232
Codemwnci Avatar asked Dec 14 '10 14:12

Codemwnci


People also ask

What is SSO header?

A WAM system requests authentication from the end user, then injects identity data via the HTTP headers of a user's browser's HTTP request, for consumption by the protected application. This is more commonly referred to as Header Based SSO.

Does HTTP headers alone support authentication?

HTTP supports the use of several authentication mechanisms to control access to pages and other resources. These mechanisms are all based around the use of the 401 status code and the WWW-Authenticate response header. The client sends the user name and password as unencrypted base64 encoded text.

What is HTTP SSO?

What is Single Sign-On? Single sign-on (SSO) is an authentication method that enables users to securely authenticate with multiple applications and websites by using just one set of credentials.

What is the name of the authentication header?

The Authentication Header (AH) protocol provides data origin authentication, data integrity, and replay protection. However, AH does not provide data confidentiality, which means that all of your data is sent in the clear.


2 Answers

You want the windows user to automagically login to your intranet webapp. So the user accounts would sit in an active directory and the usual microsoft way would be to use a protocol like NTML oder Kerberos. Applications are generally advised not to use NTLM, although there are enterprises still using NTML (and jCIFS) for SSO.

A quick search on Kerberos and Java showed this article. It seems to depend on the Java EE stack (JAAS).

For a more stripped down approach: Usually, you cannot sent the username in a http request in a portable way. With ActivX you could do:

var wshshell=new ActiveXObject("wscript.shell");
var username=wshshell.ExpandEnvironmentStrings("%username%");

On the server side, you can parse the http header and extract the username with your technology of choice.

Well, security doesn't matter in your playframework application? Why don't you use long-living cookies?

Hope it helps!

like image 130
remipod Avatar answered Sep 24 '22 02:09

remipod


In an intranet context with ActiveDirectory and workstations registered in the domain, the HTTP SPNEGO Negotiation support is the best option. But it requires specific skills around ActiveDirectory and Java Kerberos implementation.

Spring Security provides implementation and documentation to set it up. But Secure.Security is not designed to support token-based authentication like HTTP Negotiation. So using Spring Security will require a specific integration module.

Other options are OpenID and shibboleth but both requires a dedicated server, which can be configured to do SPNEGO itself. Thanks to available Play modules, integration in your application will be easier.

The only way to get the username in an HTTP header without client-side complex and unsecure/unreliable tweaks is to use an authentication proxy between browsers and your application server. Most of these proxies also support Kerberos SPNEGO as authentication mean.

like image 32
Yves Martin Avatar answered Sep 26 '22 02:09

Yves Martin