![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ō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(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用戶(hù)登錄$sessionScope.SPRING_SECURITY_LAST_EXCEPTION.message 用戶(hù)名:密 碼: 配置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ì)話(huà)超時(shí)了! ! ! !
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 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ì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2023八年級(jí)歷史上冊(cè) 第五單元 從國(guó)共合作到國(guó)共對(duì)立第17課 中國(guó)工農(nóng)紅軍長(zhǎng)征說(shuō)課稿 新人教版
- 3 歡歡喜喜慶國(guó)慶(說(shuō)課稿)-2024-2025學(xué)年統(tǒng)編版道德與法治二年級(jí)上冊(cè)
- Module 3 Unit 1 What are you doing?(說(shuō)課稿)-2024-2025學(xué)年外研版(三起)英語(yǔ)四年級(jí)上冊(cè)
- 11《趙州橋》說(shuō)課稿-2023-2024學(xué)年統(tǒng)編版語(yǔ)文三年級(jí)下冊(cè)
- 1學(xué)會(huì)尊重(說(shuō)課稿)-2023-2024學(xué)年道德與法治六年級(jí)下冊(cè)統(tǒng)編版001
- Unit 3 Festivals and Customs Extended reading 說(shuō)課稿-2024-2025學(xué)年高中英語(yǔ)譯林版(2020)必修第二冊(cè)
- 2023九年級(jí)物理下冊(cè) 專(zhuān)題六 材料、信息和能源B 能源學(xué)說(shuō)課稿 (新版)新人教版
- 2023二年級(jí)數(shù)學(xué)下冊(cè) 六 田園小衛(wèi)士-萬(wàn)以?xún)?nèi)的加減法(二)我學(xué)會(huì)了嗎說(shuō)課稿 青島版六三制
- 2024-2025學(xué)年高中化學(xué) 專(zhuān)題五 電化學(xué)問(wèn)題研究 5.1 原電池說(shuō)課稿 蘇教版選修6
- 《10 身邊的新聞?wù){(diào)查》(說(shuō)課稿)-2023-2024學(xué)年三年級(jí)上冊(cè)綜合實(shí)踐活動(dòng)吉美版
- 初級(jí)中學(xué)語(yǔ)文教師資格考試學(xué)科知識(shí)與教學(xué)能力試題及解答參考(2024年)
- 2024年高端裝備制造行業(yè)現(xiàn)狀分析:國(guó)家政策確保高端裝備制造行業(yè)有序發(fā)展
- 《帶一本書(shū)去讀研:研究生關(guān)鍵學(xué)術(shù)技能快速入門(mén)》筆記
- 知識(shí)圖譜智慧樹(shù)知到答案2024年浙江大學(xué)
- 2024年吉林省吉林市中考一模物理試題(解析版)
- Unit 2 Last weekend C Story time (教學(xué)設(shè)計(jì))人教PEP版英語(yǔ)六年級(jí)下冊(cè)
- 2024年上海市普通高中學(xué)業(yè)水平等級(jí)性考試化學(xué)試卷(含答案)
- DZ∕T 0153-2014 物化探工程測(cè)量規(guī)范(正式版)
- 2024年度-美團(tuán)新騎手入門(mén)培訓(xùn)
- 化妝品祛痘功效評(píng)價(jià)
- 高一數(shù)學(xué)寒假講義(新人教A專(zhuān)用)【復(fù)習(xí)】第05講 三角函數(shù)(學(xué)生卷)
評(píng)論
0/150
提交評(píng)論