ログインが成功したら、春にログオンしたユーザーを取得する方法RestController
?春のセキュリティ(angularjs)を使用してログに記録されたユーザーを取得する正しい方法は何ですか
私は以下の方法/原理を使用してログに記録されたユーザーを取得しますが、ログに記録されたユーザーの代わりにanonymousUserを取得します。
Principal principal = SecurityContextHolder.getContext().getAuthentication();
または
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
ここで私のプリントコンソールには何が入っていますか? 'org.sprin[email protected]905571d8:プリンシパル:anonymousUser;資格:[プロテクト];認証済み:真;詳細:org.sprin[email protected]0:RemoteIpAddress:127.0.0.1; SessionId:0125899A0DC1CF4F5C5A5416E1D1E49C;許可された権限:ROLE_ANONYMOUS' – Sadun89