Skip to content

Commit

Permalink
[mod] #5 매개변수(role) 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
seokjun01 committed Jan 3, 2025
1 parent 74ad937 commit c91b96a
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@
//Spring Security의 DefaultOAuth2User를 상속받아, 사용자 정보를 커스터마이징.

@Getter
public class CustomOAuth2User extends DefaultOAuth2User { // 역할이나 권한 나타냄 즉, 사용자 속성 저장
public class CustomOAuth2User extends DefaultOAuth2User {

private String email;
private Role role;

public CustomOAuth2User(Collection<? extends GrantedAuthority> authorities,
Map<String, Object> attributes,
String nameAttributeKey) {
super(authorities, attributes, nameAttributeKey); // 부모 클래스의 생성자 호출
this.email = attributes.get("email").toString(); // attributes에서 이메일 추출
this.role = Role.USER; // 기본 Role 설정
String nameAttributeKey,
Role role) {
super(authorities, attributes, nameAttributeKey);
this.email = attributes.get("email").toString();
this.role = role; // DB에서 전달된 Role 값을 사용
}

}

0 comments on commit c91b96a

Please sign in to comment.