I know there are already other posts similar to my doubt, but the problem is that I could not solve the problem. I have a servlet that must be mapped with the name "passport.jsp", because an external application (can not change the call) makes a request through a URL http://myipserver:portserver/nameApplication/passport.jsp?xxx My web.xml in this point is here:
<servlet-mapping>
<servlet-name>PortalServlet</servlet-name>
<url-pattern>/passport.jsp</url-pattern>
</servlet-mapping>
The problem is that the mapping of my security-constraint overrides the definition of the servlet passport.jsp, because is mapping "*.jsp".
<security-constraint>
<display-name>EsconderJSP</display-name>
<web-resource-collection>
<web-resource-name>JSP</web-resource-name>
<description/>
<url-pattern>*.jsp</url-pattern>
<http-method>GET</http-method>
<http-method>POST</http-method>
</web-resource-collection>
<auth-constraint>
<description/>
<role-name>jsps</role-name>
</auth-constraint>
</security-constraint>
Does anyone know how to solve this? You can add the servlet "/passport.jsp" as an exception.
Thank you for your attention.
You can add another security-constraint above it that has no protection
<security-constraint>
<web-resource-collection>
<url-pattern>/passport.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>*</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
Or you can change the application requests to start with something different to be protected. This will leave the passport request unprotected.
http://myipserver:portserver/nameApplication/otherRequests/foobar.jsp
http://myipserver:portserver/nameApplication/passport.jsp
then only protect /otherRequests/*
<url-pattern>/otherRequests/*</url-pattern>
I solve just adding a new tag in my web.xml (other security-constraint)
<security-constraint>
<web-resource-collection>
<web-resource-name>free pages</web-resource-name>
<url-pattern>/passport.jsp</url-pattern>
</web-resource-collection>
</security-constraint>
Ann it's working. Thanks
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.