/// <summary></summary> /// <param name="context"></param> /// <param name="authenticationType"> </param> /// <param name="claims"></param> /// <param name="nameClaimType"></param> /// <param name="roleClaimType"></param> /// <param name="isPersistent"></param> /// <exception cref="ArgumentNullException"></exception> public static void SignIn(this HttpContextBase context, string authenticationType, IEnumerable <Claim> claims, string nameClaimType, string roleClaimType, bool isPersistent) { if (authenticationType == null) { throw new ArgumentNullException("authenticationType"); } if (claims == null) { throw new ArgumentNullException("claims"); } if (nameClaimType == null) { throw new ArgumentNullException("nameClaimType"); } if (roleClaimType == null) { throw new ArgumentNullException("roleClaimType"); } var extra = new AuthenticationExtra { IsPersistent = isPersistent }; context.SignIn(new ClaimsPrincipal(new ClaimsIdentity(claims, authenticationType, nameClaimType, roleClaimType)), extra); }
public static void SignIn(HttpContextBase context, IEnumerable<Claim> userClaims, bool isPersistent) { context.SignIn(userClaims, ClaimTypes.Name, RoleClaimType, isPersistent); }