Skip to content

Instantly share code, notes, and snippets.

@rponte
Last active March 19, 2022 22:06
Show Gist options
  • Save rponte/3167731 to your computer and use it in GitHub Desktop.
Save rponte/3167731 to your computer and use it in GitHub Desktop.
Setting up Spring Security current user into integration tests
@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