日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

Websphere5.1.x JAAS LDAP配置全攻略(1)

 hostler 2006-09-14
Websphere5.1.x+JAAS+LDAP配置全攻略(1)
作者:未知 時(shí)間:2005-07-27 22:20 出處:CSDN 責(zé)編:chinaitpower
              摘要:Websphere5.1.x+JAAS+LDAP配置全攻略(1)

Advertise on this site


前言:
前些日子寫(xiě)了一篇關(guān)于JAAS+LDAP在JBOSS上的配置:
http://blog.csdn.net/oicqren/archive/2004/11/27/195803.aspx
現(xiàn)將其移植到Websphere上,這個(gè)過(guò)程比JBOSS復(fù)雜。同樣是整天在網(wǎng)上搜啊、試啊、問(wèn)啊,打電話騷擾IBM工程師啊!說(shuō)來(lái)奇怪,就是沒(méi)人能給一準(zhǔn)確答案。也許是老婆來(lái)深圳看我,帶來(lái)很多支持與運(yùn)氣。今天解決了這個(gè)問(wèn)題,貼出來(lái)。
ps.更多安全信息請(qǐng)參考紅皮書(shū):sg246573

目標(biāo):
使用JAAS框架,使用LDAP Server,使用Websphere,做用戶(hù)的驗(yàn)證和授權(quán)
(驗(yàn)證的含義是用戶(hù)有效,即用戶(hù)名、密碼輸入正確;授權(quán)的含義是用戶(hù)被授予某種角色)

基礎(chǔ)要求:
精通J2EE框架
熟悉iPlanet Directory Server配置
熟悉Websphere配置
熟悉JAAS框架

準(zhǔn)備:
windows 2k (要加入域)
j2sdk1.4.2 installed
Websphere 5.1.x Or Webphsere installed
iPlanet Directory Server 5.1 Service Pack 2 installed

假設(shè):
應(yīng)用名稱(chēng)為myApp

應(yīng)用中需要配置的point-list:
web.xml
application.xml
ibm-application-bnd.xmi
iPlanet Directory Server用戶(hù)和角色
websphere admin console:安全性>JAAS 配置>應(yīng)用程序登錄
websphere admin console:安全性>用戶(hù)注冊(cè)表>LDAP
websphere admin console:安全性>全局安全性
websphere admin console:應(yīng)用程序>企業(yè)應(yīng)用程序>myApp>映射安全性角色到用戶(hù)/組
可選配置點(diǎn):
websphere admin console:安全性>認(rèn)證機(jī)制>LTPA

另外:
可以通過(guò)WAS AAT工具、或者WSAD開(kāi)發(fā)工具、文本編輯器來(lái)修改下面的配置。但要做到配置相同。
我用UltraEdit修改的。所以下面的方法沒(méi)有工具的介紹。

[web.xml]
---------------------------------------------------------------------------------------------
是什么我不用說(shuō)了吧!在</web-app></web-app>標(biāo)簽中增加下面一段。
<security-constraint>:安全約束的表述
<url-pattern>:        被限定在安全約束中的資源文件名模式*.jsp代表所有jsp文件,*.do代表struts的所有Action
<http-method>:        被限定在安全約束中的訪問(wèn)方法
<auth-constraint>:    那一種角色可以認(rèn)為有權(quán)限訪問(wèn)資源
<auth-method>:        驗(yàn)證授權(quán)的方式,此處必須是FORM類(lèi)型
</realm-name>:        安全域名稱(chēng)
<form-login-page>:    如果還沒(méi)有做驗(yàn)證,將轉(zhuǎn)向到此頁(yè)面
<form-error-page>:    如果驗(yàn)證未通過(guò),將轉(zhuǎn)向到此頁(yè)面
<security-role>:      描述一下上面用到的角色
    <security-constraint>
        <web-resource-collection>
            <web-resource-name>Restricted</web-resource-name>
            <description>Declarative security tests</description>
            <url-pattern>*.do</url-pattern>
            <url-pattern>*.jsp</url-pattern>
            <http-method>HEAD</http-method>
            <http-method>GET</http-method>
            <http-method>POST</http-method>
            <http-method>PUT</http-method>
            <http-method>DELETE</http-method>
        </web-resource-collection>
        <auth-constraint>
            <role-name>icpuser</role-name>
        </auth-constraint>
        <user-data-constraint>
            <description>no description</description>
            <transport-guarantee>NONE</transport-guarantee>
        </user-data-constraint>
    </security-constraint>
    <login-config>
        <auth-method>FORM</auth-method>
        <realm-name>icprealm</realm-name>
        <form-login-config>
            <form-login-page>/login.do</form-login-page>
            <form-error-page>/LogError.do</form-error-page>
        </form-login-config>
    </login-config>
    <security-role>
        <description>A user allowed to login</description>
        <role-name>icpuser</role-name>
    </security-role>
---------------------------------------------------------------------------------------------

[application.xml]
---------------------------------------------------------------------------------------------
不說(shuō)了,J2EE開(kāi)發(fā)人員都應(yīng)該認(rèn)識(shí)它。
修改<display-name>myApp</display-name>
在<application></application>標(biāo)簽中增加下面一段。id="......"很重要不能省略。
      <security-role id="SecurityRole_1">
         <description>role-icpuser</description>
         <role-name>icpuser</role-name>
      </security-role>
---------------------------------------------------------------------------------------------


[ibm-application-bnd.xmi]
---------------------------------------------------------------------------------------------
在"應(yīng)用程序>安裝新的應(yīng)用程序"功能中將自己的程序成功發(fā)布之后。
檢查$WAS_HOME\config\cells\zkf5011\applications\myApp.ear\deployments\myApp\META-INF\ibm-application-bnd.xmi文件是否存在下面配置,如果沒(méi)有請(qǐng)?zhí)砑?。這里的<role href="META-INF/application.xml#......"/>很重要,必須和application.xml的<security-role id="......">相同,都為"SecurityRole_1"
<authorizationTable>
    <authorizations xmi:id="RoleAssignment_1">
      <role href="META-INF/application.xml#SecurityRole_1"/>
    </authorizations>
<authorizationTable>

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶(hù)發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶(hù) 評(píng)論公約

    類(lèi)似文章 更多