अभिवादन सब, मैं वसंत सुरक्षा 3.0.2, urlRewrite 3.1.0 उपयोग कर रहा हूँ, और मैं वसंत सुरक्षा मैं एक नियम है कि एप्लिकेशन में सभी पृष्ठों कुछ पृष्ठों तो मेरी सुरक्षा के लिए छोड़कर प्रमाणीकरण की आवश्यकता है के साथ एक समस्या है। एक्सएमएल है:404 त्रुटि के साथ वसंत सुरक्षा समस्या?
<http use-expressions="true" >
<intercept-url pattern="/" access="permitAll" />
<intercept-url pattern="/error" filter="none" />
<intercept-url pattern="/**" access="isAuthenticated()" />
.
.
.</http>
web.xml में मैं त्रुटि पृष्ठ
<error-page>
<error-code>404</error-code>
<location>/p/error</location>
</error-page>
को परिभाषित किया है और मुद्दा यह है कि अगर मैं नहीं कर रहा हूँ एक उपयोगकर्ता में लॉग इन किया है, और जो ऐसा नहीं करता कुछ यूआरएल टाइप किया ऐप में मौजूद नहीं है/नहींफउंड यूआरएल वसंत सुरक्षा इस पृष्ठ से पैटर्न/** पर मेल खाती है जिसके लिए प्रमाणीकरण की आवश्यकता होती है, इसलिए टी वह उपयोगकर्ता को अपेक्षित रूप से त्रुटि पृष्ठ पर रीडायरेक्ट नहीं किया गया है, लेकिन लॉगिन पृष्ठ पर रीडायरेक्ट किया गया है और उसके बाद, त्रुटि पृष्ठ
पर रीडायरेक्ट किया गया है और मैं चाहता हूं कि यदि उपयोगकर्ता लॉग इन करता है या नहीं, तो उपयोगकर्ता खराब यूआरएल टाइप करता है, तो वह सीधे त्रुटि पृष्ठ पर रीडायरेक्ट किया गया।
मुझे लगता है कि है कि समस्या web.xml से संबंधित है, यहाँ यह है:
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<!-- Beans in these files will makeup the configuration of the root web application context -->
<!-- Bootstraps the root web application context before servlet initialization-->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Deploys the 'projects' dispatcher servlet whose configuration resides in /WEB-INF/servlet-config.xml-->
<servlet>
<servlet-name>p</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/servlet-config.xml
</param-value>
</init-param>
</servlet>
<!-- Maps all /p URLs to the 'p' servlet -->
<servlet-mapping>
<servlet-name>p</servlet-name>
<url-pattern>/p/*</url-pattern>
</servlet-mapping>
<error-page>
<error-code>404</error-code>
<location>/p/error</location>
</error-page>
<!-- force encoding on the requests -->
<filter>
<filter-name>encoding-filter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encoding-filter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Security -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/application-config.xml
/WEB-INF/app-security.xml
/WEB-INF/mvc-config.xml
</param-value>
</context-param>
<session-config>
<session-timeout>1</session-timeout>
</session-config>
</web-app>
किसी भी विचार
इस समस्या को हल करने के लिए?
"आम तौर पर हमें आवश्यक संसाधनों को सुरक्षित करने के बजाय डिफ़ॉल्ट रूप से पहुंच से इनकार करना अच्छा अभ्यास है।" - [स्प्रिंग सिक्योरिटी ट्यूटोरियल] से उद्धृत (http://static.springsource.org/spring-security/site/tutorial.html) –