Vaadin 7 beta 10 + spring security

Maybe someone can give me a hand. I’m using Spring Integration ( addon, and followed this blog ( to set spring security.
My app does the following:

  • “login view” is shown
  • shows the login screen: that’s fine.
  • user inputs login info and gets authenticated: that’s fine
  • the security context is set with the authentication data
  • the “main view” is shown: that’s fine

However, if I do something as simple as add a button to the main view and show"auth " + SecurityContextHolder.getContext().getAuthentication());

The authentication is null. But the same Notification in the “enter(ViewChangeEvent)” of the same view is working fine.

I’m guessing something is wrong with my web.xml config o my spring-security.xml but I’ve been reading everywhere and I can’t find the problem.

Here’s my web.xml:

		<servlet-name>Vaadin Sample Application</servlet-name>
		<servlet-name>Vaadin Sample Application</servlet-name>
		<servlet-name>Vaadin Sample Application</servlet-name>
		<description>Vaadin production mode</description>

and my security.xml

	<global-method-security secured-annotations="enabled" />

	<http pattern="/VAADIN/**" security="none" />
	<http pattern="/static/**" security="none" />

	<http auto-config='true'>
		<intercept-url pattern="/" access="IS_AUTHENTICATED_ANONYMOUSLY" />

				<user name="admin" authorities="ROLE_USER, ROLE_ADMIN"
					password="admin" />

I’m guessing it has something to do with the interceptors that populate the security context but I don’t know how to fix it.
I’d appreciate any help! Thanks in advanced!!

Hi, im stuck with the same problem! Could someone help us?


needs to be stored somewhere between each requests, in fact, that’s what is lacking in the
morevaadin example
. If you have a look at the Spring Security documentation
, the
can do this job for you.

On another hand, you can also write some code in your application servlet to store and retrieve the SecurityContext from the HttpSession, but I don’t think it’s a good approach.

You already have declared your DelegatingFilterProxy in your web.xml, so just add the following in your security.xml :

<beans:bean id="springSecurityFilterChain" class="">
	    <filter-chain-map path-type="ant">
	        <filter-chain pattern="/**" filters="securityContextPersistenceFilter"/>

	<beans:bean id="securityContextPersistenceFilter" class=""/>

Hope this helps.

I just upload the same Alexander Federov’s spring security project example, with the only changed that I put all the dependecies in the pom.xml, I’m run it in a tomcat 7 and I use STS IDE.

The login page load fine.
When I complete the username and the password and click in the login button, the next error show up

Estado HTTP 404 - /j_spring_security_check

and the url in the browser show like this


I think that error show up because in tht url I don’t see the context path of my project (“vaadin-spring-security”)

this is the project

any idea??