applicationContext-security.xml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. - Namespace-based OpenID configuration
  4. -->
  5. <b:beans xmlns="http://www.springframework.org/schema/security"
  6. xmlns:b="http://www.springframework.org/schema/beans"
  7. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  8. xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
  9. http://www.springframework.org/schema/security https://www.springframework.org/schema/security/spring-security.xsd">
  10. <http>
  11. <intercept-url pattern="/openidlogin.jsp*" access="permitAll"/>
  12. <intercept-url pattern="/images/*" access="permitAll"/>
  13. <intercept-url pattern="/css/*" access="permitAll"/>
  14. <intercept-url pattern="/js/*" access="permitAll"/>
  15. <intercept-url pattern="/**" access="authenticated"/>
  16. <logout/>
  17. <openid-login login-page="/openidlogin.jsp" user-service-ref="registeringUserService"
  18. authentication-failure-url="/openidlogin.jsp?login_error=true">
  19. <attribute-exchange identifier-match="https://www.google.com/.*">
  20. <openid-attribute name="email" type="https://axschema.org/contact/email" required="true" count="1"/>
  21. <openid-attribute name="firstname" type="https://axschema.org/namePerson/first" required="true" />
  22. <openid-attribute name="lastname" type="https://axschema.org/namePerson/last" required="true" />
  23. </attribute-exchange>
  24. <attribute-exchange identifier-match=".*yahoo.com.*">
  25. <openid-attribute name="email" type="https://axschema.org/contact/email" required="true"/>
  26. <openid-attribute name="fullname" type="https://axschema.org/namePerson" required="true" />
  27. </attribute-exchange>
  28. <attribute-exchange identifier-match=".*myopenid.com.*">
  29. <openid-attribute name="email" type="https://schema.openid.net/contact/email" required="true"/>
  30. <openid-attribute name="fullname" type="https://schema.openid.net/namePerson" required="true" />
  31. </attribute-exchange>
  32. </openid-login>
  33. <remember-me token-repository-ref="tokenRepo"/>
  34. </http>
  35. <b:bean id="tokenRepo"
  36. class="org.springframework.security.web.authentication.rememberme.InMemoryTokenRepositoryImpl" />
  37. <authentication-manager alias="authenticationManager"/>
  38. <!--
  39. A custom UserDetailsService which will allow any user to authenticate and "register" their IDs in an internal map
  40. for use if they return to the site. This is the most common usage pattern for sites which use OpenID.
  41. -->
  42. <b:bean id="registeringUserService" class="org.springframework.security.samples.openid.CustomUserDetailsService" />
  43. <!--
  44. A namespace-based UserDetailsService which will reject users who are not already defined.
  45. This can be used as an alternative.
  46. -->
  47. <!--
  48. <user-service id="userService">
  49. <user name="https://luke.taylor.myopenid.com/" authorities="ROLE_SUPERVISOR,ROLE_USER" />
  50. <user name="https://raykrueger.blogspot.com/" authorities="ROLE_SUPERVISOR,ROLE_USER" />
  51. <user name="https://spring.security.test.myopenid.com/" authorities="ROLE_SUPERVISOR,ROLE_USER" />
  52. </user-service>
  53. -->
  54. </b:beans>