Я использую Aouth2 с пружинной загрузкой.
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
//I want to get current user object inside this method in order to get the user name from it.
}
Я пытался: использовать
Authentication userByContext = SecurityContextHolder.getContext().getAuthentication();
, но объект userByContest имеет значение null