Use ADMIN role

This commit is contained in:
Rob Winch
2021-04-28 11:39:47 -05:00
committed by Rob Winch
parent 2edc4c585a
commit 4b44f7a987
2 changed files with 5 additions and 3 deletions

View File

@@ -11,7 +11,7 @@ import java.math.BigDecimal;
public class SalaryService {
@PreAuthorize("hasRole('MANAGER')")
@PreAuthorize("hasRole('ADMIN')")
public Mono<BigDecimal> getSalaryForEmployee(Employee employee) {
return Mono.just(new BigDecimal("42"));
}

View File

@@ -13,6 +13,8 @@ import org.springframework.web.reactive.function.client.ExchangeFilterFunctions;
import java.util.Collections;
import static org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers.mockUser;
@SpringBootTest()
class EmployeeServiceApplicationTest {
@@ -76,8 +78,8 @@ class EmployeeServiceApplicationTest {
}
@Test
@WithMockUser(roles = "MANAGER")
void canQuerySalaryAsManager() {
@WithMockUser("hasRole('ADMIN')")
void canQuerySalaryAsAdmin() {
String query = "{" +
" employees{ " +
" name" +