Jersey(1.19.1) - Security
2016-04-16 23:34
441 查看
Security information is available by obtaining the SecurityContext using @Context, which is essentially the equivalent functionality available on the HttpServletRequest.
SecurityContext can be used in conjunction with sub-resource locators to return different resources if the user principle is included in a certain role. For example, a sub-resource locator could return a different resource if a user is a preferred customer:
SecurityContext can be used in conjunction with sub-resource locators to return different resources if the user principle is included in a certain role. For example, a sub-resource locator could return a different resource if a user is a preferred customer:
@Path("basket") public ShoppingBasketResource get(@Context SecurityContext sc) { if (sc.isUserInRole("PreferredCustomer") { return new PreferredCustomerShoppingBaskestResource(); } else { return new ShoppingBasketResource(); } }
相关文章推荐
- Linux防止“rm -rf /”误操作的方法
- Merge OUTPUT 高级用法综合写的一个MergeTab的存储过程
- POJ-1655 Balancing Act
- 数据平台的简单使用
- SLAM学习
- Django:之ORM、CMS和二维码生成
- Windows server 2012R2安装活动目录
- 方便学习的一些经典网站
- HDU 5665
- 使用 PDO 方式将 Session 保存到 MySQL 数据中
- 抛砖微信公众号应用开发
- mysql 下载及安装方法
- 【ATF】钱正平:大规模实时计算及其在阿里的应用与创新
- ubuntu下使用VNC连接树莓派raspberry
- ubuntu14.04配opencv2.4.11
- [LeetCode]70. Climbing Stairs
- 20160416
- Instruments检查视图卡顿和优化
- Eclipse中的常用快捷键
- POJ 3618 - Exploration 不一样的排序解决办法