Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Rune Antonsen 29 posts 145 karma points
    Jan 05, 2017 @ 13:41
    Rune Antonsen
    0

    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 :/

  • Rune Antonsen 29 posts 145 karma points
    Jan 06, 2017 @ 08:06
    Rune Antonsen
    0

    Or is this possible at all?

    Maybe I have to go a totally different way, like having a separate login site.

    E.g:

    • intranet.corp, that contains the intranet itself, with a totally normal umbraco installation
    • login.intranet.corp, that contains only the login stuff, Windows Authentication = Enabled, Anonymous Authentication = Disabled.
  • Michele 10 posts 90 karma points
    Jan 06, 2017 @ 14:25
    Michele
    0

    I had a similar problem and that's what I did:

    1. 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)

    2. activate the windows authentication at the IIS level

    3. 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

  • Rune Antonsen 29 posts 145 karma points
    Jan 06, 2017 @ 14:26
    Rune Antonsen
    100

    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.... ^^

Please Sign in or register to post replies

Write your reply to:

Draft