I was wondering if anybody could give advice on a secure way to implement a global login. I have an admin page that accesses active directory admin groups after typing in your username and password.
- current logged in account (on computer) does not matter
- user in web browser goes to web app, redirects to global login page with query string of app name
- types user name and password of an account in AD (not necessarily current computers logged in user)
- authenticates (looks up user, pass etc and authentication is valid)
- redirects back to original web app.
Once redirection happens, how do I securely tell the original web app that this user is ok until the original web session dies?
The way I’m thinking of implementing it:
My original thought was to pass the session ID of original app to the login page as well as the app
name. Store that session in a DB once authentication is checked. Master page of the other app validates on page load that the session ID matches. On session close, remove current session ID from DB.
You cannot depend on
sessionIDaccurately in some cases.SessionIDonly becomes a constant value after a (any) page makes a request for a session variable, if you dont haveSession_Startnot defined inglobal.asax. If you log the user in and the default page does not access session, you will end up with a different session id for the subsequent requests until a request to session is made. Usually it is always constant as there is a default emptysession_startevent inglobal.asax.But similar to your model, you could generate a
GUID(or make sure you access session on login/authentication) and store it in the user table with an expiration. Your web sites can check this key and if currently valid, auto sign the user in.You also cannot depend on
session_endevent since there is no real accurate way of detecting it (eg: user closing browser). So, you should store this ID with an expiration time along with it, preferably the same as session timeout. Just like session, you will need to extend this, something like a sliding expiration. This way, this id will be expired after a period of inactivity.also, this Claims-Based Single Sign-On for the Web may be of interest to you.