Answer the question
In order to leave comments, you need to log in
Arrow function?
Hello.
Please help me get rid of the lambda expression.
@Controller
class RunAsController {
@Autowired
RunAsService runAsService;
@Secured({ "ROLE_USER", "RUN_AS_REPORTER" })
@ResponseBody
@GetMapping("/runs")
public String tryRunAs() {
Authentication auth = runAsService.getCurrentUser();
auth.getAuthorities().forEach(a -> System.out.println(a.getAuthority()));
return "Current User Authorities inside this RunAS method only " + auth.getAuthorities().toString();
}
}
Answer the question
In order to leave comments, you need to log in
auth.getAuthorities().forEach(a -> System.out.println(a.getAuthority()));
for (Authority a : auth.getAuthorities()) {
System.out.println(a.getAuthority());
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question