Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

스프링시큐리티-타임리프에서 <span sec:authentication="name"></span> #63

Open
kyupid opened this issue Jan 11, 2022 · 0 comments

Comments

@kyupid
Copy link
Owner

kyupid commented Jan 11, 2022

맨 밑에 이미지를 보면 로그인하면 마지막에
loadUserByUsername()에 의해서
스프링시큐리티의 User를 반환한다.

이때 뷰에서 타임리프로 <span sec:authentication="name"></span> 불러오면
(아마도 세션 혹은 쿠키)에 저장되어있던 스프링시큐리티에서 반환한 UserId가 나온다.

그리고 OAuth2 로 로그인한 사용자도 아마도..
OAuth2UserService<OAuth2UserRequest, OAuth2User> 를 구현한 서비스에서
loadUser()를 오버라이드해야하는데 이때 리턴하는 DefaultOAuth2User(Collection<? extends GrantedAuthority> authorities, Map<String, Object> attributes, String nameAttributeKey) 에서 id를 저장해주는거 같아보이긴하는데,,,음 잘 모르겠다.

이미지출처: https://kimchanjung.github.io/programming/2020/07/01/spring-security-01/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant