Last active
March 19, 2022 22:06
-
-
Save rponte/3167731 to your computer and use it in GitHub Desktop.
Setting up Spring Security current user into integration tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Before | |
public void setup() { | |
SecurityContextHolder.getContext().setAuthentication( | |
new UsernamePasswordAuthenticationToken(username, password)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
More informations,
http://www.reverttoconsole.com/blog/spring/spring-security-3-unit-testing-example-with-dbunit/