Hello,
I am new to SpringMVC and Spring Security and i just can't get @PreAuthorize to work correctly (3rd day i'm looking for a solution). The normal Authentification (over web.xml) is working well.
I have added following to my security xml:
And following before my function in the controller:Code:<global-method-security pre-post-annotations="enabled" />
I also added the Dependencies (i hope the right ones!?) to pom.xml:Code:@PreAuthorize("hasRole('normalo')")
I am using the Spring Tool Suite 3.1.0.Code:<dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-config</artifactId> <version>${org.springframework-version}</version> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-core</artifactId> <version>${org.springframework-version}</version> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-web</artifactId> <version>${org.springframework-version}</version> </dependency>
I've packed an example project to better show you my problem. You can test the normal authentification with /auth and the PreAuthorize with /preauth. User: test - Password: 123
Hope you can help me and thanks in advance.
Regards


Reply With Quote