-
Notifications
You must be signed in to change notification settings - Fork 0
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
37 changed files
with
757 additions
and
110 deletions.
There are no files selected for viewing
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
21 changes: 21 additions & 0 deletions
21
...main/java/com/example/dreamvalutbackend/config/exception/JwtAuthenticationEntryPoint.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,21 @@ | ||
package com.example.dreamvalutbackend.config.exception; | ||
|
||
import java.io.IOException; | ||
|
||
import org.springframework.security.core.AuthenticationException; | ||
import org.springframework.security.web.AuthenticationEntryPoint; | ||
import org.springframework.stereotype.Component; | ||
|
||
import jakarta.servlet.http.HttpServletRequest; | ||
import jakarta.servlet.http.HttpServletResponse; | ||
|
||
@Component | ||
public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint { | ||
|
||
@Override | ||
public void commence(HttpServletRequest request, HttpServletResponse response, | ||
AuthenticationException authException) throws IOException { | ||
|
||
response.sendError(HttpServletResponse.SC_UNAUTHORIZED); | ||
} | ||
} |
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
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
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
33 changes: 33 additions & 0 deletions
33
src/main/java/com/example/dreamvalutbackend/config/oauth2/domain/GoogleUserInfo.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.example.dreamvalutbackend.config.oauth2.domain; | ||
|
||
import java.util.Map; | ||
|
||
public class GoogleUserInfo implements OAuth2UserInfo { | ||
private String socialId; | ||
private String email; | ||
private String name; | ||
private String image; | ||
|
||
public GoogleUserInfo(Map<String, Object> attributes) { | ||
this.socialId = String.valueOf(attributes.get("sub")); | ||
this.email = String.valueOf(attributes.get("email")); | ||
this.name = String.valueOf(attributes.get("name")); | ||
this.image = String.valueOf(attributes.get("picture")); | ||
} | ||
|
||
public String getSocialId() { | ||
return socialId; | ||
} | ||
|
||
public String getEmail() { | ||
return email; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getImage() { | ||
return image; | ||
} | ||
} |
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
29 changes: 29 additions & 0 deletions
29
src/main/java/com/example/dreamvalutbackend/config/oauth2/domain/NaverUserInfo.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,29 @@ | ||
package com.example.dreamvalutbackend.config.oauth2.domain; | ||
|
||
import java.util.Map; | ||
|
||
public class NaverUserInfo implements OAuth2UserInfo { | ||
public static String socialId; | ||
public static Map<String, Object> responseMap; | ||
public NaverUserInfo(Map<String, Object> attributes) { | ||
responseMap = (Map<String, Object>) attributes.get("response"); | ||
} | ||
|
||
public String getSocialId() { | ||
return String.valueOf(responseMap.get("id")); | ||
} | ||
|
||
public String getEmail() { | ||
return String.valueOf(responseMap.get("email")); | ||
} | ||
public String getName() { | ||
return String.valueOf(responseMap.get("name")); | ||
} | ||
public String getImage() { | ||
return String.valueOf(responseMap.get("profile_image")); | ||
} | ||
|
||
|
||
|
||
|
||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/com/example/dreamvalutbackend/config/oauth2/domain/OAuth2UserInfo.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,8 @@ | ||
package com.example.dreamvalutbackend.config.oauth2.domain; | ||
|
||
public interface OAuth2UserInfo { | ||
String getSocialId(); | ||
String getName(); | ||
String getEmail(); | ||
String getImage(); | ||
} |
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
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
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
Oops, something went wrong.