Try Now
More in this section

Forums / Sitefinity SDK / Custom Authentication

Custom Authentication

2 posts, 0 answered
  1. KK
    KK avatar
    1 posts
    07 Oct 2015
    14 Dec 2015
    Link to this post

    We have implemented the Membership and Role providers to use our database for user and role management.

    The site is going to be used to host pages for multiple customers identified by their organisation. The user will be unique for an organisation. We want the user to select the organisation when logging in and the organisation along with the user credentials will be used to authenticate the user. Any suggestions on how we could achieve this?

  2. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    24 Oct 2016
    17 Dec 2015
    Link to this post

    What I can suggest is that you add a custom field to the user profile to hold the information about the organization. This way, each user will have the name of the organization in this field.

    Then you can create custom Login control where you can add a dropdown that lists all the organizations and the user will be able to select an organization when logging in Sitefinity using this control. You can add textboxes for the username and the passwords as well.

    Then when the user selects the organization name from the dropdown and then enters the username and the password and clicks submit button, in the code behind of the custom login control you can get the selected value for the organization, the username and the password. Then you can use the API to get the user which has the specified username and the specified company name. If you can find this user, you can authenticate the user using the API as shown in the sample in this article.


    Here is also an article with samples on how to query users in Sitefinity:

    Since you are using custom membership provider, please note to get the user manager by passing the name of your custom membership provider:

    var userManager = UserManager.GetManager("YourCustomMembershipProviderName");

    Sabrie Nedzhip
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
2 posts, 0 answered