ASP.NET MVC 5 Authentication Filters
2016-03-18 15:01
579 查看
The following are the differences in short:
Authentication: It is a process of verification that verifies “Who you are” (it confirms that you are a valid (or invalid) user).
Authorization: It is a process of verification that verifies “What to do” (It confirms you are permissible to do (or not to do) that).
接口IAuthenticationFilter的OnAuthentication()方法可以用于执行任何需要的身份验证,而OnAuthenticationChallenge方法基于已验证用户的身份限制其访问。
The OnAuthentication method is executed first and can be used to perform any needed authentication. The OnAuthenticationChallenge method is used to restrict access based upon the authenticated user's principal.
Authentication filters are applied prior to any Authorization filters.
For authenticating a user you can use one of the following two ways:
Thread.CurrentPrincipal.Identity.IsAuthenticated
HttpContext.Current.User.Identity.IsAuthenticated
Authentication: It is a process of verification that verifies “Who you are” (it confirms that you are a valid (or invalid) user).
Authorization: It is a process of verification that verifies “What to do” (It confirms you are permissible to do (or not to do) that).
接口IAuthenticationFilter的OnAuthentication()方法可以用于执行任何需要的身份验证,而OnAuthenticationChallenge方法基于已验证用户的身份限制其访问。
The OnAuthentication method is executed first and can be used to perform any needed authentication. The OnAuthenticationChallenge method is used to restrict access based upon the authenticated user's principal.
Authentication filters are applied prior to any Authorization filters.
For authenticating a user you can use one of the following two ways:
Thread.CurrentPrincipal.Identity.IsAuthenticated
HttpContext.Current.User.Identity.IsAuthenticated
相关文章推荐
- 【.Net码农】Asp.Net 加密解密
- ASP.NET获取微信客户端上传的图片
- ASP.NET WEBAPI实现微信JS-SDK接口注入权限验证配置
- ASP.NET WEBAPI实现微信接入验证
- asp:Button 事件,点击事件 html Button runat="sever"
- android和jak和aspx的关联
- ASP.NET跨页面传值技巧[总结]
- AOP中的@Aspect用法,用于监控程序的执行方法
- asp.net解决高并发的方案.
- 2016-AspNet-MVC教学-3-基于EntityFramework数据模型的控制台测试
- Asp.net SignalR 实现服务端消息推送到Web端
- asp.net小数点四舍五入的正确写法
- ASP.NET Web 配置指南
- asp.net教程:编译错误同时存在于不同dll中
- ASP.NET Core 1.0 中 EntityFramework 与 PostgreSQL 的使用
- ASP.net的指令
- ASP.net的文件扩展名
- 深入了解asp.net框架。生命周期以及事件处理机制
- asp.net UrI URL编码解码
- ASP.NET Web API的安全管道