[英]Spring session management in mvc, Spring security session vs http session
成功登錄后,我要繼續使用新網址進行進一步的請求處理。 但是該URL正在調用Spring MVC中的公開服務,其中安全配置不檢查即將到來的URL的會話身份驗證。請看下面的代碼。
<http auto-config="true" use-expressions="true">
<!-- <intercept-url pattern="/**" access="isAuthenticated()" /> -->
<intercept-url pattern="/home*" access="isAuthenticated()" />
<intercept-url pattern="/admin*" access="isAuthenticated()" />
<form-login login-page="/" default-target-url="/home"
authentication-failure-url="/accessdenied" always-use-default-target="false"/>
<logout logout-success-url="/" />
<anonymous username="guest" granted-authority="ROLE_GUEST" />
<session-management invalid-session-url="/" session-authentication-error-url="/login.jsp?error=alreadyLogin">
<concurrency-control max-sessions="1" expired-url="/login.jsp?error=sessionExpiredDuplicateLogin" error-if-maximum-exceeded="false"/>
</session-management>
<remember-me />
</http>
當jsp頁面提交登錄身份驗證J_security_check時,調用的目標url隨后將調用攔截器模式/ home *並驗證登錄憑據。
如果我在登錄“ / address / userid /”之前調用公開的服務,它將直接調用服務方法以使其綁定會話,如果會話存在則獲取數據,否則不獲取數據。
Spring安全會話與http會話有何不同,如何在Spring MVC中像http會話一樣維護Spring安全會話。
如果我添加的<intercept-url pattern="/**" access="isAuthenticated()" />
不起作用,它也不會顯示登錄jsp。如果我做錯了,請澄清一下。
如何在下面的身份驗證管理器中將userid / pwd區分為單個? 采用第一個參數。
<authentication-manager>
<authentication-provider>
<!-- <user-service> <user name="admin" password="secret" authorities="ROLE_ADMIN,ROLE_USER"/>
</user-service> -->
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="SELECT USER_NAME,USER_PWD, 'true' as enabled from LOGIN_USER where USER_NAME=?"
authorities-by-username-query="select LOGIN_USER.USER_NAME , LOGIN_USER.ROLE_ID as authorities from LOGIN_USER
where LOGIN_USER.USER_NAME =?" />
</authentication-provider>
</authentication-manager>
我遇到過幾個站點,它僅描述了春季登錄安全性會話管理。我不清楚,謝謝。
我實現了使用攔截器處理程序來檢查URI和會話屬性,該方法工作正常,但正在spring框架中尋找更好的選項。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.