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)   


  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?

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:



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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy