Copied to clipboard

Flag this post as spam?

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


  • Adam Nash 3 posts 23 karma points
    Apr 24, 2012 @ 02:59
    Adam Nash
    0

    Automatically logging into Ubraco using Windows Authentication

    I am working away at a Umbraco project, with the goal to be that the user is automatically logged into Umbraco based on their domain username. These are the steps I have so far:

    • I am hosting a test Umbraco site on IIS 7
    • The site settings have windows Authentication, meaning that you have to be logged into the domain to access the site
    • I have created a macro that identifies the current user from Active Directory as soon as someone accesses the page. If the user does not have a matching Umbraco Member Account, then one is automatically created, based on their domain user.

    As it stands now, if someone on the domain accesses the Umbraco site, then they will have a Member with a matching username automatically created in Umbraco if it doesn't exist. This is done passively.

    The last stage however is that I require that user to become the registered logged in Member in Umbraco. I know who the Umbraco Member is, I just need to have that member automatically logged into Umbraco.

    Does anyone know how I can do this?

    I'm coding in C#, but any form of documentation would be appreciated.

    Many thanks and best regards

  • Bex 444 posts 555 karma points
    Apr 24, 2012 @ 18:17
    Bex
    0

    This is the code to automatically login:

     

        User u = new User(userName);
        doLogin(u);

    you need these usings:

    using umbraco.BasePages;
    using umbraco.BusinessLogic;

    You just need to put it somewhere..

    Does that help?

  • ShifterBits 5 posts 76 karma points
    Feb 02, 2016 @ 00:00
    ShifterBits
    0

    This is something I need to do currently w/v7
    Can someone point me to an example? I dont want to use the Active Directory provider.

    • Get the user identity
    • Check if the user exists and if not, create an Umbraco user (what to use as their password?)
    • Log them in

    This will then allow me to go into the the Umbraco management area and configure specific users for special group access.

Please Sign in or register to post replies

Write your reply to:

Draft