2017-11-29 19 views
1

Spring Securityに問題があります。 (アクティブなセッションをタイムアウトするのに十分な)いくつかの時間 Springセキュリティ:セッションがタイムアウトしてもデータを保存できます

  • のために、私は
  • 戻ってコンピュータに来る私はコンピュータを離れ
  • formularにいくつかのデータを変更する

    1. 私はクリックしてください:それはこのようになりますウェブアプリケーションの「保存」ボタン

    今、データがデータベースに保存されてから、セッションがタイムアウトしたことをアプリからログアウトします。この動作は不適切です。タイムアウト後にデータを保存する可能性なしに、定義済みまたはデフォルトの時間の後に完全にログアウトしていることを確認する方法はありますか?

    マイセキュリティ-context.xmlには、次のようになります。あなたはあなたの<security:logoutタグ内のXML属性が欠落している

    <?xml version="1.0" encoding="UTF-8"?> 
    <beans xmlns="http://www.springframework.org/schema/beans" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" 
        xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:security="http://www.springframework.org/schema/security" 
        xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd 
         http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd 
         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd"> 
    
        <import resource="spring-database.xml" /> 
    
        <security:http pattern="/login" security="none" /> 
        <security:http pattern="/loginfailed" security="none" /> 
        <security:http pattern="/403" security="none" /> 
    
        <security:http auto-config="true"> 
         <security:intercept-url pattern="/*" access="ROLE_ADMIN" /> 
         <security:form-login login-page="/login" 
          default-target-url="/" authentication-failure-url="/loginfailed" /> 
         <security:logout logout-success-url="/login" /> 
         <security:access-denied-handler 
          error-page="/403" /> 
        </security:http> 
    
        <security:authentication-manager> 
         <security:authentication-provider> 
          <security:jdbc-user-service 
           data-source-ref="dataSource" 
           users-by-username-query="select username,password, enabled from users where username= ?" 
           authorities-by-username-query="select username,role from user_roles where username= ?" /> 
         </security:authentication-provider> 
        </security:authentication-manager> 
    
    </beans> 
    
  • 答えて

    1

    。このタグにinvalidate-session="true"を追加するだけです。このようにして、無効なセッションが発生するたびに、ユーザーは再度ログインする必要があります。あなたはthisスレッドのSpring Secutityのこの機能に関する詳細を読むことができます。

    上記の属性を含むXMLの一部が見つからないことがあります。

    ... 
    
    <security:http auto-config="true"> 
         <security:intercept-url pattern="/*" access="ROLE_ADMIN" /> 
         <security:form-login login-page="/login" 
          default-target-url="/" authentication-failure-url="/loginfailed" /> 
         <security:logout logout-success-url="/login" invalidate-session="true"/> 
         <security:access-denied-handler 
          error-page="/403" /> 
    </security:http> 
    
    ... 
    
    関連する問題