Windows Authentication without breaking existing umbraco authentication
Hi!
How to get the windows/ad username of the current user without breaking the existing forms authentication setup for Umbraco?
I've been fiddling with this for a while now and I'm about to go crazy.
To clarify, I'm making a intranet for a client, and they want users that is set up for it to be automatically logged in.
How I planned to do that was:
add a property field on the member ("adUsername")
on all pages: run check if user is logged in.
if user is not logged in, check windows AD username against stored "adUsername" on members.
if no match, redirect to login page (normal form)
if match, log that user in and continue to
load the page
I've enabled "Windows Authentication" and disabled "Anonymous Authentication" so I can grab the hold of the windows/ad username.
But then logging in won't work.
Probably due to the fact that Forms isn't used anymore and Umbraco tries to do FormsAuthentication.SetAuthCookie(username, false)?
Any pointers will help since I'm stuck at this moment :/
write a console app that will periodically get users from AD and add/update members into Umbraco; in this was I can extract useful properties and save them into the member (once I created a proper Member Type)
activate the windows authentication at the IIS level
At that point, once a user is browsing a page, you can use the member service to get the current member and its properties. Accordingly, you can implement a logic so that, if the current member is null, you can create it.
Windows Authentication without breaking existing umbraco authentication
Hi!
How to get the windows/ad username of the current user without breaking the existing forms authentication setup for Umbraco?
I've been fiddling with this for a while now and I'm about to go crazy.
To clarify, I'm making a intranet for a client, and they want users that is set up for it to be automatically logged in.
How I planned to do that was:
I've enabled "Windows Authentication" and disabled "Anonymous Authentication" so I can grab the hold of the windows/ad username.
But then logging in won't work. Probably due to the fact that Forms isn't used anymore and Umbraco tries to do FormsAuthentication.SetAuthCookie(username, false)?
Any pointers will help since I'm stuck at this moment :/
Or is this possible at all?
Maybe I have to go a totally different way, like having a separate login site.
E.g:
I had a similar problem and that's what I did:
write a console app that will periodically get users from AD and add/update members into Umbraco; in this was I can extract useful properties and save them into the member (once I created a proper Member Type)
activate the windows authentication at the IIS level
used this package: https://our.umbraco.org/projects/developer-tools/active-directory-providers/
At that point, once a user is browsing a page, you can use the member service to get the current member and its properties. Accordingly, you can implement a logic so that, if the current member is null, you can create it.
Hope this helps, M
Eventually I found some useful information on how to do this.
Tried to gather the stuff I found over at this github repo if anyone should be interested in it: https://github.com/ruant/MixedAuthWebApplication
Wasn't that hard actually, just had to know how.... ^^
is working on a reply...