Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I currently have an MVC website that uses forms authentication using the default SqlMembershipProvider.

In this website I can automatically log a user in by simply having a GUID that corresponds to their UserId in the aspnet_Membership table. All I do is query the table, then using their username I simply have forms authentication set the auth cookie.

I currently use:

FormsAuthentication.RedirectFromLoginPage(username, false)

But can optionally also use:

FormsAuthentication.SetAuthCookie(username, false, "/")

Now, I need to do something similar to this, but on SharePoint. SP does have access to my membership tables.

However, it seems that SP uses SecurityTokens for the validation:

        SecurityToken token = SPSecurityContext.SecurityTokenForFormsAuthentication(new Uri(SPContext.Current.Web.Url), formsClaimsAuthenticationProvider.MembershipProvider, formsClaimsAuthenticationProvider.RoleProvider, strUsername, strPassword);   

        if (null != token)   
        {   
            EstablishSessionWithToken(token);   
            Response.Redirect(strSource);
        }

Questions:

  1. Is there a way to get this token by simply providing the username, without the password?
  2. Or, can I manually create the SecurityToken to provide to SetPrincipalAndWriteSessionToken()?
  3. Or, can I manually set the authentication cookies myself?
share|improve this question
add comment

2 Answers

Since its forms authentication,

configure it with your existing membership database.

Have a custom login form where you can have user ID alone & follow the below article to proceed further:

[1]http://www.codeproject.com/Articles/165159/Custom-Membership-Providers

share|improve this answer
add comment

It is Forms Authentication and readily supports extension. Simply write a custom membership provider (or even use your current provider) and wire it into SharePoint

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.