var formsAuthOption = SPFormsAuthenticationOption.None;
var tokenType = SPSessionTokenWriteType.WriteSessionCookie;
if (rememberme)
{
formsAuthOption = SPFormsAuthenticationOption.PersistentSignInRequest;
tokenType = SPSessionTokenWriteType.WritePersistentCookie;
}
var settings = SPContext.Current.Site.WebApplication.IisSettings[SPContext.Current.Site.Zone];
var authProvider = settings.FormsClaimsAuthenticationProvider;
var securityToken = SPSecurityContext.SecurityTokenForFormsAuthentication(new Uri(SPContext.Current.Web.Url), authProvider.MembershipProvider,authProvider.RoleProvider, "test123", "password", formsAuthOption);
var fam = SPFederationAuthenticationModule.Current;
fam.SetPrincipalAndWriteSessionToken(securityToken, tokenType);
var tokenType = SPSessionTokenWriteType.WriteSessionCookie;
if (rememberme)
{
formsAuthOption = SPFormsAuthenticationOption.PersistentSignInRequest;
tokenType = SPSessionTokenWriteType.WritePersistentCookie;
}
var settings = SPContext.Current.Site.WebApplication.IisSettings[SPContext.Current.Site.Zone];
var authProvider = settings.FormsClaimsAuthenticationProvider;
var securityToken = SPSecurityContext.SecurityTokenForFormsAuthentication(new Uri(SPContext.Current.Web.Url), authProvider.MembershipProvider,authProvider.RoleProvider, "test123", "password", formsAuthOption);
var fam = SPFederationAuthenticationModule.Current;
fam.SetPrincipalAndWriteSessionToken(securityToken, tokenType);
No comments:
Post a Comment