1
0
mirror of synced 2026-08-05 09:47:05 +00:00

Add authenticated().withAuthentication(Consumer<Authentication>)

This allows arbitrary assertions of the authenticated user

Fixes: gh-4996
This commit is contained in:
Rob Winch
2018-02-02 16:40:43 -06:00
parent 1cb581a0c6
commit e1a8d250de
3 changed files with 42 additions and 0 deletions
@@ -694,6 +694,16 @@ mvc
.andExpect(authenticated().withUsername("admin"));
----
We can also make arbitrary assertions on the authentication
[source,java]
----
mvc
.perform(formLogin())
.andExpect(authenticated().withAuthentication(auth ->
assertThat(auth).isInstanceOf(UsernamePasswordAuthenticationToken.class)));
----
[[test-webflux]]
== WebFlux Support