You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Vaadin7SpringSecurityBaseAuthentification.asciidoc 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. ---
  2. title: Vaadin 7 Spring Security
  3. order: 44
  4. layout: page
  5. ---
  6. [[vaadin-7-spring-security-base-authentication]]
  7. = Vaadin 7 + Spring Security (base authentication)
  8. Vaadin 7 is easy to integrate with Spring Security. You should configure only
  9. 2 files. First - web.xml and second one spring-security.xml (user
  10. credentials and security settings). This is a small example on how to use
  11. base form for authentication.
  12. [[web.xml-configuration]]
  13. web.xml Configuration
  14. ^^^^^^^^^^^^^^^^^^^^^
  15. [source,xml]
  16. ....
  17. <?xml version="1.0" encoding="UTF-8"?>
  18. <web-app xmlns:xsi="[[http://www.w3.org/2001/XMLSchema-instance"xmlns="http://java.sun.com/xml/ns/javaee"xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"id="WebApp_ID|http://www.w3.org/2001/XMLSchema-instance"xmlns="http://java.sun.com/xml/ns/javaee"xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"id="WebApp_ID]]" version="3.0">
  19. <display-name>Vaadin7SpringSecurity</display-name>
  20. <context-param> <param-name>contextConfigLocation</param-name> <param-value> /WEB-INF/spring/spring-security.xml </param-value></context-param>
  21. <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></listener>
  22. <!-- filter declaration for Spring Security -->
  23. <filter>
  24. <filter-name>springSecurityFilterChain</filter-name>
  25. <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
  26. </filter>
  27. <filter-mapping>
  28. <filter-name>springSecurityFilterChain</filter-name>
  29. <url-pattern>/*</url-pattern>
  30. </filter-mapping>
  31. </web-app>
  32. ....
  33. [[spring-security.xml]]
  34. spring-security.xml
  35. ^^^^^^^^^^^^^^^^^^^
  36. [source,xml]
  37. ....
  38. <beans:beans xmlns="http://www.springframework.org/schema/security"
  39. xmlns:beans="http://www.springframework.org/schema/beans"
  40. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  41. xsi:schemaLocation="http://www.springframework.org/schema/beans
  42. http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
  43. http://www.springframework.org/schema/security
  44. http://www.springframework.org/schema/security/spring-security-3.1.xsd">
  45. <http auto-config='true'>
  46. <intercept-url pattern="/*" access="ROLE_USER" />
  47. </http>
  48. <authentication-manager>
  49. <authentication-provider>
  50. <user-service>
  51. <user name="user" password="password" authorities="ROLE_USER" />
  52. </user-service>
  53. </authentication-provider>
  54. </authentication-manager>
  55. </beans:beans>
  56. ....
  57. For more details, how to extend *spring-security.xml* configuration you
  58. can use
  59. http://docs.spring.io/autorepo/docs/spring-security/3.0.x/reference/ns-config.html[Spring
  60. resources].