-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
src/main/java/com/api/TaveShot/global/oauth2/GithubUserInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.api.TaveShot.global.oauth2; | ||
|
||
import java.util.Map; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@Builder | ||
@AllArgsConstructor | ||
public record GithubUserInfo(Map<String, Object> userInfo) { | ||
|
||
private static final String AVATAR_URL_PATTERN = "avatar_url"; | ||
private static final String LOGIN_PATTERN = "login"; | ||
private static final String NAME_PATTERN = "name"; | ||
private static final String EMAIL_PATTERN = "email"; | ||
|
||
public String getProfileImageUrl() { | ||
return (String) userInfo.get(AVATAR_URL_PATTERN); | ||
} | ||
|
||
public String getLoginId() { | ||
return (String) userInfo.get(LOGIN_PATTERN); | ||
} | ||
|
||
public String getName() { | ||
return (String) userInfo.get(NAME_PATTERN); | ||
} | ||
|
||
public String getMail() { | ||
return (String) userInfo.get(EMAIL_PATTERN); | ||
} | ||
} |