Copied to clipboard

Flag this post as spam?

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


  • Jason Cubic 4 posts 74 karma points
    May 08, 2017 @ 22:43
    Jason Cubic
    0

    Need help trying to get MS AD windows authentication working

    I am trying to get MS AD windows authentication working.

    Here is the only thing that kind of / sort of worked:

    If you turn on Windows Authentication for Umbraco in IIS (and set the /Umbraco/Webservices folder to anonymous) then you can get the username in Razor with this command:

    @Context.User.Identity.Name
    

    This also works:

    @Context.User.Identity.IsAuthenticated  (returns true even though this seems useless because users can’t get to site if it were false?).
    

    This does nothing to make Umbraco recognize the user though. We only have the user’s name and the fact that IIS successfully authenticated them. We do not know their email address. Umbraco does not add them as a known member.

    So after tons and tons of research I figured out that the newest version of Umbraco uses standard ASP.net authentication. Which I know nothing about and it’s super confusing. It seems to mean that you have to write an asp.net “membership provider” and an asp.net “role provider”. There are default Umbraco ones setup in the web.config already. I do not know how to write custom ones of those or even where to even put code to do that. Umbraco or maybe ASP.net make a clear distinction that a user is someone with access to the backoffice and a member is someone who visits the site.

    I believe when the system is setup correctly we will see the following:

    • member gets added into the Umbraco database in the “cmsMember” table
    • The razor value @Members.CurrentUserName will be populated
    • The razor value @Members.GetCurrentMember() will return the current member object
    • The razor value @Members.GetCurrentMemberId() will return the current members ID

    I spent tons of time trying to figure out how to get this working. I got the Umbraco plugin “Active Directory Providers” working but it’s useless as far as I can tell. After the plugin is installed It DOES return a value for the razor value @Members.CurrentUserName but it does not populate the cmsMember table, and it does not get the user’s email, and it does not populate a MemberID. I have no idea why it needs information about an LDAP server, it doesn’t get ANY information from the ldap server. I would expect it to at least get the users email address from the ldap server.

    Are there any guides or anything that can help me out here?

    Thank You,

Please Sign in or register to post replies

Write your reply to:

Draft