0

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?
1

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

| improve this answer | |
0

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

| improve this answer | |

Your Answer

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

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