मैं स्प्रिंग सुरक्षा का उपयोग कर वसंत एमवीसी अनुप्रयोग को निम्नलिखित तरीके से कॉन्फ़िगर करना चाहता हूं।वसंत सुरक्षा बुनियादी विन्यास
- केवल एक समवर्ती लॉगिन की अनुमति है।
- जब HTTP सत्र समाप्त हो जाता है तो उपयोगकर्ता को /security/sessionTimeout.html
- पर रीडायरेक्ट किया जाएगा जब उपयोगकर्ता सफलता पर लॉग इन करेगा तो उसे फ़ोल्डर में रीडायरेक्ट किया जाएगा।
- जब उपयोगकर्ता लॉग आउट करते हैं, तो उन्हें "/" पर भी रीडायरेक्ट किया जाएगा।
मैं इसे निम्नलिखित तरीके से कॉन्फ़िगर किया गया:
<security:http>
<security:form-login login-page="/security/login.html" login-processing-url="/login" authentication-failure-url="/login.jsp?login_error=1" default-target-url="/"/>
<security:session-management invalid-session-url="/security/sessionTimeout.html">
<security:concurrency-control max-sessions="1" />
</security:session-management>
<security:logout logout-url="/logout" logout-success-url="/"/>
</security:http>
और मैं निम्नलिखित मुद्दे हैं:
- मैं 2 विभिन्न ब्राउज़रों पर उसी खाते से प्रवेश करने में सक्षम हूँ (कोई संगामिति नियंत्रण काम कर रहा है)
- जब मैं लॉग आउट पर क्लिक करता हूं तो मुझे "/security/sessionTimeout.html" के बजाय "/" पर रीडायरेक्ट किया जाता है।
मैंने वसंत सुरक्षा संदर्भ मार्गदर्शिका का पालन किया है। मैं क्या गलत कर रहा हूँ?
अपडेटेडः इस प्रकार मेरा वेब.एक्सएमएल दिखता है।
अद्यतन 2: बस डिबग मोड में log4j चलाने के लिए और इस मैं क्या हो गया, जब लॉगआउट पर क्लिक है:
DEBUG [http-8080-2] (FilterChainProxy.java:375) - /index.html at position 1 of 11 in additional filter chain; firing Filter: 'ConcurrentSessionFilter'
DEBUG [http-8080-2] (FilterChainProxy.java:375) - /index.html at position 2 of 11 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'
DEBUG [http-8080-2] (HttpSessionSecurityContextRepository.java:130) - No HttpSession currently exists
DEBUG [http-8080-2] (HttpSessionSecurityContextRepository.java:88) - No SecurityContext was available from the HttpSession: null. A new one will be created.
DEBUG [http-8080-2] (FilterChainProxy.java:375) - /index.html at position 3 of 11 in additional filter chain; firing Filter: 'LogoutFilter'
DEBUG [http-8080-2] (FilterChainProxy.java:375) - /index.html at position 4 of 11 in additional filter chain; firing Filter: 'UsernamePasswordAuthenticationFilter'
DEBUG [http-8080-2] (FilterChainProxy.java:375) - /index.html at position 5 of 11 in additional filter chain; firing Filter: 'BasicAuthenticationFilter'
DEBUG [http-8080-2] (FilterChainProxy.java:375) - /index.html at position 6 of 11 in additional filter chain; firing Filter: 'RequestCacheAwareFilter'
DEBUG [http-8080-2] (FilterChainProxy.java:375) - /index.html at position 7 of 11 in additional filter chain; firing Filter: 'SecurityContextHolderAwareRequestFilter'
DEBUG [http-8080-2] (FilterChainProxy.java:375) - /index.html at position 8 of 11 in additional filter chain; firing Filter: 'AnonymousAuthenticationFilter'
DEBUG [http-8080-2] (AnonymousAuthenticationFilter.java:67) - Populated SecurityContextHolder with anonymous token: 'org.sprin[email protected]9055c2bc: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.sprin[email protected]b364: RemoteIpAddress: 0:0:0:0:0:0:0:1; SessionId: null; Granted Authorities: ROLE_ANONYMOUS'
DEBUG [http-8080-2] (FilterChainProxy.java:375) - /index.html at position 9 of 11 in additional filter chain; firing Filter: 'SessionManagementFilter'
DEBUG [http-8080-2] (SessionManagementFilter.java:87) - Requested session IDD8429BBAAA9561A97E1D2350ED63BC35 is invalid.
DEBUG [http-8080-2] (SessionManagementFilter.java:90) - Starting new session (if required) and redirecting to '/security/sessionTimeout.html'
यह लगता है जैसे मैं सत्र प्रबंधन फिल्टर /index.html
और फिर पर लागू किया है कोई सत्र मौजूद नहीं है। मैं इसे कैसे सुलझाऊं?
आइटम बी) शायद इसलिए हो रहा है क्योंकि आपने किसी भी उपयोगकर्ता द्वारा यूआरएल '/' तक पहुंचने की अनुमति नहीं दी है। – bluefoot
आप किस वसंत संस्करण का उपयोग कर रहे हैं? – Simeon
@ शिमोन, 3.0.5 और वसंत 3.0.4 –