Trying to add Security to my Spring Web Flow2 Project

I have a web flow project I been working on and now its time to add some security to it. I have the login screen working for the demo but I want to add:

@PreAuthorize(isAuthenticated());

To some of my functions in the control, service and dao so I know only signed in users are access the functions. @PreAuthorize(isAuthenticated()) does not work and I really dont want to use @PreAuthorize("hasRole('ROLE_USER')").

Can someone please tell me how to lock down my code better

here is my security.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans 
    xmlns="http://www.springframework.org/schema/security"
    xmlns:beans="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
                        http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
                        http://www.springframework.org/schema/security
                        http://www.springframework.org/schema/security/spring-security-3.1.xsd">


    <global-method-security pre-post-annotations="enabled"/>

    <http use-expressions="true">
        <intercept-url access="hasRole('ROLE_USER')"    pattern="/visit**" />
        <intercept-url pattern='/*' access='permitAll' />
        <form-login   default-target-url="/visit" />

        <logout logout-success-url="/" />
    </http>

    <authentication-manager>
        <authentication-provider>
            <user-service>
                <user name="user" password="user" authorities="ROLE_USER" />
            </user-service>

        </authentication-provider>
    </authentication-manager>
</beans:beans>

Answers


Try putting isAuthenticated() in quotes.

As in

@PreAuthorize("isAuthenticated()");

Need Your Help

Code-first always working with SQL Server Express or SQL Server CE

asp.net-mvc asp.net-mvc-3 entity-framework entity-framework-4 ef-code-first

I'm building a MVC 3 application and use Entity Framework 4.3 code-first. My context is becoming complex so I've decided to working with SQL Server 2008 R2. Then I changed my connection string in

PHP or Regex for unique matching ID's

php html regex

Here's some stuff stored in a database table:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.