Skip to content

Tag: spring-security

Spring Security – multiple logged users

I have a problem with Spring Security configuration. When I log in on one computer as a user1 and then I will log in as a user2 on another computer, the first computer after refresh sees everything as a user2. In other words, it is impossible to have two sessions with different users at the same time. Configuration: Spring Security

Spring Boot ConflictingBeanDefinitionException: Annotation-specified bean name for @Controller class

I keep getting the ConflictingBeanDefinitionException error in my Spring boot application. I am not entirely sure as to how to address it, I have several @Configuration annotated classes helping to set up Thymeleaf, Spring Security and Web. Why is the application trying to setup the homeController twice? (and where is it trying to do this?) The error is: My spring

How do I unit test spring security @PreAuthorize(hasRole)?

What do I need in order to unit test the hasRole part of a PreAuthorize annotation on a controller method? My test should succeed because the logged in user only has one of the two roles, but instead it fails with the following assertion error: java.lang.AssertionError: Status Expected :401 Actual :200 I have the following method in MyController: I created