Answers for "spring get role from authenticate user"

0

check authorities spring

@GetMapping("/users")
public String getUsers() {
    UserDetails details = userDetailsService.loadUserByUsername("mike");
    if (details != null && details.getAuthorities().stream()
      .anyMatch(a -> a.getAuthority().equals("ADMIN"))) {
        // ...
    }
}
Posted by: Guest on December-20-2020
0

check authorities spring

@GetMapping("/users")
public String getUsers() {
    UserDetails details = userDetailsService.loadUserByUsername("mike");
    if (details != null && details.getAuthorities().stream()
      .anyMatch(a -> a.getAuthority().equals("ADMIN"))) {
        // ...
    }
}
Posted by: Guest on December-20-2020

Code answers related to "spring get role from authenticate user"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language