use*_*456 2 forms asp.net asp.net-mvc forms-authentication owin
我想使用OWIN管道向客户端发出身份验证cookie,当用户注销时清除cookie但我不想使用恼人的aspnet身份提供者.它只是不适合项目,我试了很长时间,它只是不适合.所以我决定不使用它.我只想使用OWIN管道.
这是可能的还是我应该回到旧的表单身份验证?
像这样?
var claims = new List<Claim>();
claims.Add(new Claim(ClaimTypes.Name, "Brock"));
claims.Add(new Claim(ClaimTypes.Email, "brockallen@gmail.com"));
var id = new ClaimsIdentity(claims,
DefaultAuthenticationTypes.ApplicationCookie);
var ctx = Request.GetOwinContext();
var authenticationManager = ctx.Authentication;
authenticationManager.SignIn(id);
Run Code Online (Sandbox Code Playgroud)
取自这里.
归档时间: |
|
查看次数: |
3765 次 |
最近记录: |