File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
src/main/java/com/somemore/global/auth/oauth/domain Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .somemore .global .auth .oauth .domain ;
2+
3+ import lombok .Getter ;
4+ import lombok .RequiredArgsConstructor ;
5+ import org .springframework .security .core .GrantedAuthority ;
6+ import org .springframework .security .oauth2 .core .user .OAuth2User ;
7+
8+ import java .util .Collection ;
9+ import java .util .Map ;
10+
11+ @ RequiredArgsConstructor
12+ @ Getter
13+ public class CustomOAuth2User implements OAuth2User {
14+
15+ private final OAuth2User oAuth2User ;
16+ private final OAuthProvider provider ;
17+
18+ @ Override
19+ public Map <String , Object > getAttributes () {
20+ return oAuth2User .getAttributes ();
21+ }
22+
23+ @ Override
24+ public Collection <? extends GrantedAuthority > getAuthorities () {
25+ return oAuth2User .getAuthorities ();
26+ }
27+
28+ @ Override
29+ public String getName () {
30+ return oAuth2User .getName ();
31+ }
32+
33+ public static CustomOAuth2User of (OAuth2User oAuth2User , OAuthProvider oAuthProvider ) {
34+ return new CustomOAuth2User (oAuth2User , oAuthProvider );
35+ }
36+ }
You can’t perform that action at this time.
0 commit comments