Guest User

Untitled

a guest
Apr 23rd, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.56 KB | None | 0 0
  1. Failed to load resource: the server responded with a status of 404 ()
  2. Refused to execute script from 'http://localhost:8080/web-resources/jquery.min.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
  3. :8080/favicon.ico Failed to load resource: the server responded with a status of 404 ()
  4.  
  5. <?xml version="1.0" encoding="UTF-8"?>
  6. <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
  7. xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
  8. version="3.0">
  9. <display-name>Archetype Created Web Application</display-name>
  10. <welcome-file-list>
  11. <welcome-file>login.jsp</welcome-file>
  12. </welcome-file-list>
  13. <!-- security config-->
  14. <filter>
  15. <filter-name>springSecurityFilterChain</filter-name>
  16. <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
  17. </filter>
  18. <filter-mapping>
  19. <filter-name>springSecurityFilterChain</filter-name>
  20. <url-pattern>/*</url-pattern>
  21. </filter-mapping>
  22. <servlet>
  23. <servlet-name>spring-mvc</servlet-name>
  24. <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  25. <load-on-startup>1</load-on-startup>
  26. </servlet>
  27. <servlet-mapping>
  28. <servlet-name>spring-mvc</servlet-name>
  29. <url-pattern>/</url-pattern>
  30. </servlet-mapping>
  31. <context-param>
  32. <param-name>contextConfigLocation</param-name>
  33. <param-value>
  34. /WEB-INF/spring-mvc-servlet.xml
  35. /WEB-INF/security.xml
  36. </param-value>
  37. </context-param>
  38. <listener>
  39. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  40. </listener>
  41. <jsp-config>
  42. <jsp-property-group>
  43. <url-pattern>*.jsp</url-pattern>
  44. <page-encoding>UTF-8</page-encoding>
  45. </jsp-property-group>
  46. </jsp-config>
  47. </web-app>
  48.  
  49. <?xml version="1.0" encoding="UTF-8"?>
  50. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"
  51. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
  52. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
  53. <context:annotation-config/>
  54. <context:component-scan base-package="java"/>
  55. <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  56. <property name="prefix" value="/"/>
  57. <property name="suffix" value=".jsp"/>
  58. </bean>
  59. <mvc:annotation-driven/>
  60. <mvc:resources mapping="/web-resources/**" location="/web-resources" cache-period="31556926"/>
  61. <mvc:resources mapping="/favicon.ico" location="/web-resources" cache-period="31556926"/>
  62. </beans>
  63.  
  64. <beans:beans xmlns="http://www.springframework.org/schema/security"
  65. xmlns:beans="http://www.springframework.org/schema/beans"
  66. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  67. xsi:schemaLocation="http://www.springframework.org/schema/beans
  68. http://www.springframework.org/schema/beans/spring-beans.xsd
  69. http://www.springframework.org/schema/security
  70. http://www.springframework.org/schema/security/spring-security.xsd">
  71. <http auto-config="true">
  72. <intercept-url pattern="/user**" access="ROLE_USER"/>
  73. <intercept-url pattern="/" access="permitAll"/>
  74. <intercept-url pattern="/web-resources**" access="permitAll"/>
  75. <form-login
  76. login-page="/login"
  77. default-target-url="/user/index"
  78. authentication-failure-url="/login?error"
  79. username-parameter="username"
  80. password-parameter="password"/>
  81. <logout logout-success-url="/login?logout"/>
  82. <!-- enable csrf protection -->
  83. <csrf/>
  84. </http>
  85. <authentication-manager>
  86. <authentication-provider>
  87. <user-service>
  88. <user name="abcd" password="123456" authorities="ROLE_USER"/>
  89. </user-service>
  90. </authentication-provider>
  91. </authentication-manager>
  92. </beans:beans>
  93.  
  94. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
  95. <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
  96. <%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
  97.  
  98. <html>
  99. <body>
  100. <h1 id="banner">Login to Security Demo</h1>
  101. <form name="f" action="<c:url value='j_spring_security_check'/>"
  102. method="POST">
  103. <table>
  104. <tr>
  105. <td>Username:</td>
  106. <td><input type='text' name='j_username'/></td>
  107. </tr>
  108. <tr>
  109. <td>Password:</td>
  110. <td><input type='password' name='j_password'></td>
  111. </tr>
  112. <tr>
  113. <td colspan="2">&nbsp;</td>
  114. </tr>
  115. <tr>
  116. <td colspan='2'><input name="submit" type="submit">&nbsp;<input name="reset" type="reset"></td>
  117. </tr>
  118. </table>
  119. </form>
  120. <script type="text/javascript" src="web-resources/jquery.min.js"></script>
  121. </body>
  122. </html>
  123.  
  124. <mvc:resources mapping="/web-resources/**" location="/web-resources" cache-period="31556926"/>
  125.  
  126. <mvc:resources mapping="/web-resources/**" location="/web-resources/" cache-period="31556926"/>
  127.  
  128. <http pattern="/web-resources/**" security="none"/>
Add Comment
Please, Sign In to add comment