![spring_security開(kāi)發(fā)指引-實(shí)例_第1頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2021-12/22/95c161df-3430-42b5-b259-44b559003c69/95c161df-3430-42b5-b259-44b559003c691.gif)
![spring_security開(kāi)發(fā)指引-實(shí)例_第2頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2021-12/22/95c161df-3430-42b5-b259-44b559003c69/95c161df-3430-42b5-b259-44b559003c692.gif)
![spring_security開(kāi)發(fā)指引-實(shí)例_第3頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2021-12/22/95c161df-3430-42b5-b259-44b559003c69/95c161df-3430-42b5-b259-44b559003c693.gif)
![spring_security開(kāi)發(fā)指引-實(shí)例_第4頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2021-12/22/95c161df-3430-42b5-b259-44b559003c69/95c161df-3430-42b5-b259-44b559003c694.gif)
![spring_security開(kāi)發(fā)指引-實(shí)例_第5頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2021-12/22/95c161df-3430-42b5-b259-44b559003c69/95c161df-3430-42b5-b259-44b559003c695.gif)
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、Spring Security 3E置說(shuō)明:項(xiàng)目的總體結(jié)構(gòu),如下圖 .3斯J擊com,azt出beanl jj Documentjava,磁service(I8 implJ.| DoturnentServicelmplJavE,J | HelloServiceImplJava| J | Do cu me ntSe rvic e J a va-2) HelioServicejava 2) DBUtiljava; applicationConteKt.xml窗message5_zh_CNpropertie5J RE System Library : iur JZ .K Java EE 5 Libr
2、aries呂Referenced Libr就 %Webftoot0昌META-INFE&4NIjf indexjtp- 廨效的3/ S e $ s i o nTi m eo htm FZ?1.下載Spring Security 3下載地址:/spring-security/site/downloads.html2.搭建Spring Security 3的環(huán)境解壓后,如下圖:夠鼻晉 yaccesDenied jspadminjspdistdocsclas5_mapping_from_2.0.x.txtlicense.txt. no
3、ticentwtdist文件夾中, 是項(xiàng)目中所需要的jar文件, 和兩個(gè)Dem則子,DemoM子 是用.war格式的文件給我們的。如圖:俱spring-security-acl-3.0.5. RELEASE Jar,_ spring-security-acl-S.OnS-RELEASE-sourcesJar黃springreErity-aspectAOERELEASE,jar邑spring-gecLinty-aspects-3.0,5fRELEASE-5Oijrce5jrI土spring-secunty-ca5-client-3,0,5KRELEASE.jarLspring-5ecurity-
4、ca5-dient3.0.5.RELEASE-sources.jar, spring *s?curity-config-3,0,5.RELEASE Jarh*T, spring-security-config3,0,5.RELEASE-ourte.jar1山,$pring-ecurity-core-3f0.5.RELEASEjairl-H spring-security-core-3H05HRELEASE-soijrcesjarspring-5&curity-ldap-3.0.5.RELEASEjar,_ springrpcurityddmp-MQSRELEASEfourtesjarh
5、*T, spring-security-openid-SnO.S.RELEASE Jar,-ujspring-security-openid-S.O.S.RELEASE-sQurces.jarI spring-security-sannples-contacts-3H0.5.RELEASEHVvarspring-5?curit)-samp les-tutori il-3.0.5.RELEASE.warP spring*$ecunty-taglibs*3,0.5.RELEASE.jar spring-security-taglibs-O.S.RELEASE-sourceJarIJJJspring
6、 -security-web-3.0.5. RELEASE ar旦spring-security-web-SHO.SnRELEASE-sourcesJardocs文件夾中,是Spring Security 3的API和reference文檔。2.1建立數(shù)據(jù)庫(kù)和表(這里使用MySQL數(shù)據(jù)庫(kù)名demO+十usernane-;aLithorit!IM! radmin: BOLE_ADMIN:manager! ROLEJ1ANAGER!uer! BOLE_USEfi!- *-+rows in set isql select * fi*on users;usernane ! pass toold ! e
7、nab led !- +, +admin!21232f297a57a5a743894A0e4a801fc3!1!manager:21232F297a57a5a743894a0e4a801Fc3 : 1 I user ! 21232F297aS7a5a743894a0e4a801fc3 ! 1 !Create table users (username varchar(50),password varchar(50),enabled boolean)注:密碼是經(jīng)過(guò)了md5加密的,插入數(shù)據(jù)的時(shí)候要注意Create table authority(username varchar(50),autho
8、rity varchar(50)【建表語(yǔ)句丟了,這個(gè)肯定有問(wèn)題,但是字段都是沒(méi)問(wèn)題的】2.2導(dǎo)入需要的jar包1.在MyEclipse中加入Spring的支持,版本什么都可以2.把剛剛加入的Spring的jar包都刪掉,只保留applicationContext.xml文件3.找到剛剛解壓的Spring Security3的包,在dist文件夾中找到那兩 個(gè).war的文件,隨便找一個(gè),把后綴名改為.rar然后,然后解壓出 來(lái),找到WEN-INF lib文件火, 把其中所有的jar包都拷貝到Myeclipse的工程中。2.3配置web.xml文件3. 4. contextConfigLocati
9、onclasspath:applicationContext*.xml_8. springSecurityFilterChainorg.springframework.web.filter.DelegatingFilterProxy 1.32.springSecurityFilterChain/* org.springframework.web.context.ContextLoaderListener org.springframework.security.web.session.HttpSess
10、ionEventPublisher HelloS.azt.servlet.HelloServletDocumentS.azt.servlet.DocumentServlet/ servlet-class2.HelloServlet43./HelloServlet44.45.46. DocumentServlet47./DocumentServlet1.52.index.jsp .4配置Spring的applicationcontext.xmlsecured-annotations=enabledjsr250-annotations=e
11、nabled-security:global-method-securitysecurity:protect-pointcutaccess=ROLE_USER,ROLE_ADMINexpression=execution(* com.azt.service.*.sayHello(.)security:protect-pointcutaccess=ROLEADMINexpression=execution(* com.azt.service.*.say*(.)/ security:global-method-securitysecurity:httpsecurity:intercept-urla
12、ccess =ROLE_ADMIN,ROLE_MANAGER/ security:session-management/ security:form-login/-!-請(qǐng)求頁(yè)面可能帶一些參數(shù),所以后面加*號(hào),TIPS要注意前面一定要根目錄pattern =/login.jsp*pattern =/admin.jsp*/= /HelloServlet security:session-management=/SessionTimeout.htmlinvalid-session-urlpattern= truemax-sessions =1 bean id =helloServiceclass =
13、com.azt.service.impl.HelloServiceImpl配置login.jsp用戶登錄$sessionScope.SPRING_SECURITY_LAST_EXCEPTION.message 用戶名:密 碼: 配置index.jsp引入標(biāo)簽:Body部分首頁(yè)歡迎您進(jìn)入admin.jsp頁(yè)面!a href =DocumentServlet?method=adda href =DocumentServlet?method=updatea href =DocumentServlet?method=deleteproperty =name !新增文檔更新文檔刪除文檔進(jìn)入admin.jsp頁(yè)面!a href =DocumentServlet?method=updatea href = DocumentServlet?method=adda href = DocumentServlet?method=find 問(wèn)好 再見(jiàn)a href =j_spring_security_logoutSessinTimeout頁(yè)面您的會(huì)話超時(shí)了! ! ! !
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 冀教版數(shù)學(xué)九年級(jí)上冊(cè)27.2《反比例函數(shù)的圖象和性質(zhì)》聽(tīng)評(píng)課記錄
- 財(cái)務(wù)人員保密協(xié)議書(shū)范本
- 宿遷商務(wù)樓房屋租賃合同范本
- 購(gòu)房按揭貸款合同范本
- 2025年度電影演員主演合約中的票房分成及收益分配合同
- 印刷廠與設(shè)計(jì)師2025年度原創(chuàng)設(shè)計(jì)保密協(xié)議
- 2025房產(chǎn)合同解除及違約責(zé)任追究及賠償協(xié)議
- 2025年度員工自愿放棄社保及公積金協(xié)議示范文本
- 2025年度債權(quán)債務(wù)重組與債務(wù)重組合同
- 建筑大清包勞務(wù)合同范本
- m拱頂儲(chǔ)罐設(shè)計(jì)計(jì)算書(shū)
- 2023外貿(mào)業(yè)務(wù)協(xié)調(diào)期中試卷
- 新人教鄂教版(2017)五年級(jí)下冊(cè)科學(xué)全冊(cè)教學(xué)課件
- GB/T 29361-2012電子物證文件一致性檢驗(yàn)規(guī)程
- GB/T 16475-1996變形鋁及鋁合金狀態(tài)代號(hào)
- 無(wú)紙化會(huì)議系統(tǒng)解決方案
- 上海鐵路局勞動(dòng)安全“八防”考試題庫(kù)(含答案)
- 效率提升和品質(zhì)改善方案
- 義務(wù)教育學(xué)科作業(yè)設(shè)計(jì)與管理指南
- 物業(yè)客服培訓(xùn)PPT幻燈片課件(PPT 61頁(yè))
- 《汽車(chē)發(fā)展史》PPT課件(PPT 75頁(yè))
評(píng)論
0/150
提交評(píng)論