Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,10 @@ void shouldPreserveAuthorities() throws Exception {

WebAuthnAuthentication webAuthnAuth = new WebAuthnAuthentication(userEntity, authorities);

DSUserDetails dsUserDetails = new DSUserDetails(testUser, authorities);
// The handler must read authorities off the incoming authentication, not off the UserDetails it loads.
// Giving the loaded principal a narrower set is what makes the assertion below discriminating: ROLE_ADMIN
// can only have come from the WebAuthnAuthentication.
DSUserDetails dsUserDetails = new DSUserDetails(testUser, Set.of(new SimpleGrantedAuthority("ROLE_USER")));
when(userDetailsService.loadUserByUsername(testUser.getEmail())).thenReturn(dsUserDetails);

// When
Expand Down
Loading
Loading