国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

jboss4+ejb3下使用JAAS

2019-11-18 16:04:56
字體:
來源:轉載
供稿:網友

  我們知道,JAAS包括了Authentication和Authorization,下面我們分別看看:

Authentication分析如下:

1)類的annotate如下
@SecurityDomain("other")
public class CalculatorBean implements Calculator
這樣將從users.PRoperties中讀取Authentication信息:
kabir=validpassWord

2)使用的jboss類如下:
import org.jboss.security.SecurityAssociation;
import org.jboss.security.SimplePrincipal;

3)SimplePrincipal用來設置驗證原則:
SecurityAssociation.setPrincipal(new SimplePrincipal("kabir"));

4)SecurityAssociation用來根據原則進行驗證:
SecurityAssociation.setCredential("invalidpassword".toCharArray());

5)驗證不通過,會拋exception

Authorization分析如下:

1)方法中指明角色
@MethodPermissions({"teacher"})
public int divide(int x, int y)
{
return x / y;
}

2)roles.properties中設置角色
kabir=student

3)運行中判斷權限,并提示:
[java] Insufficient method permissions, principal=kabir, interface=org.jboss.ejb3.EJBContainerInvocation, requiredR
oles=[teacher], principalRoles=[student]

(出處:http://m.survivalescaperooms.com)



發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 红原县| 龙山县| 德昌县| 岳池县| 习水县| 铜梁县| 常州市| 民勤县| 通渭县| 顺昌县| 长宁县| 平凉市| 冷水江市| 富平县| 萨嘎县| 苍梧县| 濮阳市| 双鸭山市| 敦化市| 灵寿县| 定襄县| 宿迁市| 田阳县| 陈巴尔虎旗| 伊金霍洛旗| 兴山县| 西贡区| 尉氏县| 天水市| 黑山县| 周宁县| 类乌齐县| 博乐市| 仲巴县| 肇庆市| 天津市| 霞浦县| 绥滨县| 鄂州市| 广昌县| 淮南市|