Skip to content

Add SecurityMockMvcResultMatchers.withAuthorities(String...) #17974

@rwinch

Description

@rwinch

There should be a SecurityMockMvcResultMatchers.withAuthorities(String...) method which does not care about the GrantedAuthority implementation.

If the currently authenticated user has a custom GrantedAuthority implementation with the GrantedAuthority#getAuthority() of CUSTOM, then the following should work:

this.mockMvc.perform(formLogin().user("custom"))
			.andExpect(authenticated().withAuthorities("CUSTOM"));

Metadata

Metadata

Assignees

Labels

in: testAn issue in spring-security-testtype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions