SharePoint: Provide Autologin Feature or Creating Custom Claim and Form Based Token

SharePoint: Provide Autologin Feature or Creating Custom Claim and Form Based Token

In order to support autologin feature in Sharepoint, you need to create FBA token explicity for that user id.
You just need userid to create the claim, no password.

 

SecurityToken tk = null;
  
 
string url = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority;
  
 
//Create claims based authentication token
 
tk = SPSecurityContext.SecurityTokenForFormsAuthentication(new Uri(url), membershipProvider, roleProvider, strUsername, String.Empty);
  
if (tk != null)
  
{
    SPFederationAuthenticationModule fam = SPFederationAuthenticationModule.Current;
    fam.SetPrincipalAndWriteSessionToken(tk);
}
You can read these articles for custom membership provider or role provider and FBA configuration.

http://msdn.microsoft.com/en-us/library/gg317440(v=office.14).aspx


http://msdn.microsoft.com/en-us/library/gg317440(v=office.14).aspx
Leave a Comment
  • Please add 8 and 4 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Naomi  N edited Revision 3. Comment: Needs more content

  • Richard Mueller edited Revision 1. Comment: Replaced RGB values with color names in HTML to restore colors

  • Richard Mueller edited Original. Comment: Modified title casing, added tags

Page 1 of 1 (3 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Richard Mueller edited Original. Comment: Modified title casing, added tags

  • Richard Mueller edited Revision 1. Comment: Replaced RGB values with color names in HTML to restore colors

  • Naomi  N edited Revision 3. Comment: Needs more content

Page 1 of 1 (3 items)