Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
e4d83a6
feature: AI 탄소 검색 기능 구현
minsubyun1 Jun 15, 2025
bbbe7c8
Merge pull request #5 from 9room-b4after/feature/4/carbonAnalyze
minsubyun1 Jun 18, 2025
0b9a1c9
feature: 탄소 소비 기록 저장 기능
minsubyun1 Jun 18, 2025
6fe345c
Merge pull request #8 from 9room-b4after/feature/7/saveCarbonLog
minsubyun1 Jun 19, 2025
a36934f
refactor: OAuth 설정을 .env 기반으로 변경
yeonchaepark Jun 24, 2025
9f2746a
feature: 닉네임 수정 중간 커밋
yeonchaepark Jun 24, 2025
f7afc3b
refactor:env 파일 load 방식 수정
yeonchaepark Jun 24, 2025
24436d3
Merge branch 'dev' into feature/6/login
yeonchaepark Jun 25, 2025
2fa464a
[Feture] 구글/카카오 로그인 기능 구현
yeonchaepark Jun 25, 2025
1068e71
feature:닉네임 수정 기능 구현
yeonchaepark Jun 25, 2025
b3a1139
refactor: AI 탄소 검색 기능 수정
minsubyun1 Jun 26, 2025
9512b72
세팅chore: 세팅 파일 정리
minsubyun1 Jun 26, 2025
bc83ed7
chore: 세팅 파일 정리
minsubyun1 Jun 26, 2025
c080259
chore: 세팅 파일 정리
minsubyun1 Jun 26, 2025
6403526
chore: 세팅 파일 정리
minsubyun1 Jun 26, 2025
80fca7a
chore: 세팅 파일 정리
minsubyun1 Jun 26, 2025
cacbd38
Merge pull request #16 from 9room-b4after/feature/4/carbonAnalyze
minsubyun1 Jun 26, 2025
10a5249
refactor: 탄소 소비 기록 저장 기능 수정
minsubyun1 Jun 26, 2025
9c025b5
refactor: 탄소 소비 기록 저장 기능 수정
minsubyun1 Jun 26, 2025
98ab086
Merge pull request #17 from 9room-b4after/feature/7/saveCarbonLog
minsubyun1 Jun 27, 2025
cae6817
feature: Daily 탄소 소비 조회 기능
minsubyun1 Jun 27, 2025
797cda5
feature: Daily 탄소 소비 조회 기능
minsubyun1 Jun 27, 2025
6a2ff2b
feature: Daily 탄소 소비 조회 기능
minsubyun1 Jun 27, 2025
5e82db4
Merge pull request #19 from 9room-b4after/feature/18/getDailyLogs
minsubyun1 Jun 27, 2025
8d4a22d
test: trigger CI for PR status check
kimhyerim01 Jun 27, 2025
2e23a6c
refactor: 환경변수 설정 및 수정된 ERD반영하여 전체 Entity 수정
hardwoong Jun 28, 2025
0dcb789
Merge pull request #22 from 9room-b4after/refactor/21/setEnvironmentE…
hardwoong Jun 28, 2025
8554a54
refact: application.yml 파일 수정
hardwoong Jun 28, 2025
74f940a
Merge pull request #24 from 9room-b4after/refactor/23/updateYml
hardwoong Jun 28, 2025
cb4a783
feature: 사용자 나무 단계 조회 기능 구현
hardwoong Jun 28, 2025
385ec72
refactor: .gitignore 사항 추가
hardwoong Jun 28, 2025
8c0b1c4
Merge pull request #26 from 9room-b4after/feature/25/treeStage
hardwoong Jun 28, 2025
5268706
refactor: 나무 사진 주소 s3 객체 주소로 수정
hardwoong Jun 28, 2025
4626ff0
Merge pull request #28 from 9room-b4after/refactor/27/editTreeUrl
hardwoong Jun 28, 2025
007e9c6
feature: 사용자 히어로 등급 조회 기능 구현
hardwoong Jun 28, 2025
39861c3
Merge pull request #30 from 9room-b4after/feature/29/heroStage
hardwoong Jun 28, 2025
90b41de
feature: 아이템 조회 기능 구현
hardwoong Jun 28, 2025
22a3b05
Merge pull request #32 from 9room-b4after/feature/31/itemCheck
hardwoong Jun 28, 2025
8511815
feature: 유저별 인벤토리 조회 기능 구현
hardwoong Jun 28, 2025
96e834b
Merge pull request #34 from 9room-b4after/feature/33/inventoryCheck
hardwoong Jun 28, 2025
a0c673a
feature: 아이템 전시 여부 변경 기능 구현
hardwoong Jun 28, 2025
074c884
Merge pull request #36 from 9room-b4after/feature/35/editDisplayed
hardwoong Jun 28, 2025
0cdbb0c
refactor: carbon ë검색 반환 값 변경
minsubyun1 Jun 29, 2025
20c2ca1
Merge branch 'dev' into feature/13/nicknameChange
yeonchaepark Jun 29, 2025
eba3f31
[Feature] 닉네임 수정 기능 구현
yeonchaepark Jun 29, 2025
f80f558
refactor: ã로그ìJWT 인증 사용자 정보 활용(ãcarbon)
minsubyun1 Jun 30, 2025
7601646
refactor:jwtprovider 중복 코드 제거
yeonchaepark Jun 30, 2025
0bd257b
[Refactor] JwtProvider 중복 코드 제거
yeonchaepark Jun 30, 2025
96e0589
refactor: 탄소 소비 저장 시 유저 growthPoint에도 반영
minsubyun1 Jun 30, 2025
2883ee9
refactor: 탄소 소비 저장 시 유저 growthPoint에도 반영
minsubyun1 Jun 30, 2025
c422de5
Merge branch 'dev' into feature/7/saveCarbonLog
minsubyun1 Jun 30, 2025
08cb6d7
Merge pull request #43 from 9room-b4after/feature/7/saveCarbonLog
minsubyun1 Jun 30, 2025
1110050
refactor: JWT 인증 사용자 정보 활용(carbon)
minsubyun1 Jun 30, 2025
ad38fb8
refactor: 타 API 엔드포인트 userid 사용방식 수정
hardwoong Jul 1, 2025
c13f562
Merge pull request #44 from 9room-b4after/refactor/37/authUserContext
hardwoong Jul 1, 2025
6890a7e
test: retrigger CI after changing PR base to dev
kimhyerim01 Jul 1, 2025
9e46765
fix: resolve merge conflict in application.yml
kimhyerim01 Jul 1, 2025
7299ff1
test: retrigger CI after changing PR to dev
kimhyerim01 Jul 1, 2025
cf7bff2
Merge pull request #20 from 9room-b4after/test/cicd-check
kimhyerim01 Jul 1, 2025
d52b8c6
refactor: 사용자 성장 점수 증가 연산 수행 및 증가에따른 단계 최신화
hardwoong Jul 1, 2025
2f1ac11
Merge pull request #46 from 9room-b4after/refactor/45/updateStage
hardwoong Jul 1, 2025
87f3cfe
fix: 사용자 성장 점수 증가 연산 삭제 및 최신화 함수 호출 위치 변경
hardwoong Jul 1, 2025
e72251e
Merge pull request #48 from 9room-b4after/fix/47/cancleIncreasingGrow…
hardwoong Jul 1, 2025
9693bab
feature: 특정 시간 모든 사용자 성장 점수 증가
hardwoong Jul 1, 2025
09a2921
Merge pull request #50 from 9room-b4after/feature/49/increaseGrowthPo…
hardwoong Jul 1, 2025
a2ce07a
refactor: 로그인 리다이렉트 jwt토큰 포함으로 변경
yeonchaepark Jul 1, 2025
0aaed15
[Refactor] 로그인 리다이렉트 jwt토큰 포함으로 변경
yeonchaepark Jul 1, 2025
b6612a0
refactor: redirect-uri yml 하드코딩
yeonchaepark Jul 1, 2025
5376944
fix:redirect uri yml에서 받아오도록 수정
yeonchaepark Jul 1, 2025
7c91349
[Refactor] redirect-uri hardcoding 시도
yeonchaepark Jul 1, 2025
31b7106
fix: 사용자 단계 조회 초기화 오류 수정
hardwoong Jul 2, 2025
245d37e
refact: yml 파일 값 로컬환경 undo
hardwoong Jul 2, 2025
20cab34
Merge pull request #56 from 9room-b4after/fix/55/initializeUserStage
hardwoong Jul 2, 2025
1d82128
refactor:로그인 redirect 앱용 딥링크로 변경
yeonchaepark Jul 2, 2025
73bcc21
[Refactor] 로그인 redirect 앱용 딥링크로 변경
yeonchaepark Jul 2, 2025
7240f69
feature: AI Daily 챌린지 생성 및 조회
minsubyun1 Jul 2, 2025
2ec6527
feature: AI Daily 챌린지 생성 및 조회
minsubyun1 Jul 2, 2025
6719c94
Merge pull request #60 from 9room-b4after/feature/59/getTodayChallenge
minsubyun1 Jul 2, 2025
38107ee
feature: 챌린지 키워드 기반 AI 탄소 검색
minsubyun1 Jul 2, 2025
1a27128
feature: 챌린지 키워드 기반 AI 탄소 검색
minsubyun1 Jul 2, 2025
346e3e6
Merge pull request #62 from 9room-b4after/feature/61/analyzeByKeyword
minsubyun1 Jul 2, 2025
e4bee31
feature: 챌린지 키워드 기반 AI 탄소 검색
minsubyun1 Jul 2, 2025
8c8d88b
feature: 챌린지 / 일반 검색 로그 구분 저장
minsubyun1 Jul 2, 2025
461b33e
feature: 챌린지 / 일반 검색 로그 구분 저장
minsubyun1 Jul 2, 2025
9cf9c9c
Merge pull request #65 from 9room-b4after/feature/64/saveChallengeCar…
minsubyun1 Jul 2, 2025
a851bce
feature: 챌린지 완료 처리 기능
minsubyun1 Jul 2, 2025
054c13f
Merge pull request #67 from 9room-b4after/feature/66/completeChallenge
minsubyun1 Jul 2, 2025
7cd554f
chore: 불필요한 파일 삭제
minsubyun1 Jul 2, 2025
e9a7c7c
feature:챌린지 history 전체 조회
yeonchaepark Jul 2, 2025
2480593
[Feature] 챌린지 전체 수행 이력 조회
yeonchaepark Jul 2, 2025
b2a5fd4
feature:캘린더별 챌린지 조회
yeonchaepark Jul 2, 2025
2d0c534
[Feature] 챌린지 캘린더별 기록 조회
yeonchaepark Jul 2, 2025
ac728e4
refactor: 나무 단계 조회 반환값 수정
hardwoong Jul 3, 2025
d47d608
Merge pull request #73 from 9room-b4after/refactor/72/editTreeStage
hardwoong Jul 3, 2025
bea0ff5
refactor: 영웅단계 조회 반환값 수정
hardwoong Jul 3, 2025
1488663
Merge pull request #76 from 9room-b4after/refactor/74/editHeroStage
hardwoong Jul 3, 2025
a1efe3f
fix: 불필요한 코드 삭제
minsubyun1 Jul 3, 2025
d7d7be8
Merge branch 'dev' of https://github.com/9room-b4after/soopgyeol into…
minsubyun1 Jul 3, 2025
90ea578
feature: 임시토큰 생성 코드 추가 및 토큰 유효기간 설정 변경
yeonchaepark Jul 3, 2025
023503c
refactor: 아이템 카테고리별 인벤토리 조회
hardwoong Jul 3, 2025
c7ab705
[Feautre] backend 용 jwt토큰 생성 코드 추가 및 유효기간 설정 변경
yeonchaepark Jul 3, 2025
70ab2b7
Merge pull request #79 from 9room-b4after/refactor/77/selectInventory…
hardwoong Jul 3, 2025
d51c344
feature: 닉네임 조회 기능 추가
yeonchaepark Jul 3, 2025
7cf73ab
[Feature] 닉네임 조회 기능 추가
yeonchaepark Jul 3, 2025
1250101
feature: 총 탄소량도 응답에 포함
minsubyun1 Jul 3, 2025
3eb9702
Merge pull request #83 from 9room-b4after/feature/18/getDailyLogs
minsubyun1 Jul 3, 2025
00d3e88
feature: 회원 탈퇴 기능 구현
hardwoong Jul 3, 2025
ee3aa28
Merge pull request #84 from 9room-b4after/feature/82/userSignout
hardwoong Jul 3, 2025
5ce7667
[Feature] 상점 아이템 구매 기능
kimhyerim01 Jul 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
.idea/
*.iml
*.iml
### yml ###
application.yml


.env

.vscode
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
| <img src="https://avatars.githubusercontent.com/u/75060858?s=400&u=4917b902ce67c045926c2dcc84052a307ef7b615&v=4" width="200" /> | <img src="https://avatars.githubusercontent.com/u/163461154?v=4" width="160"> | <img src="https://avatars.githubusercontent.com/u/127640204?v=4" width="160" /> | <img src="https://avatars.githubusercontent.com/u/158552165?v=4" width="180" /> | <img src="https://avatars.githubusercontent.com/u/183798149?v=4" width="200" /> |
| 윤민섭 | 김혜림 | 박채연 | 박세웅 | 김민주 |
| [Minsub](https://github.com/minsubyun1) | [kimhyerim01](https://github.com/kimhyerim01) | [yeonchaepark](https://github.com/yeonchaepark) | [hardwoong](https://github.com/hardwoong) | [calla1102](https://github.com/calla1102) |

2 changes: 2 additions & 0 deletions retrigger.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// retrigger CI after base branch change
//ABCD CI after base branch change
4 changes: 4 additions & 0 deletions server/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ out/

### VS Code ###
.vscode/


### yml
application.yml
11 changes: 11 additions & 0 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,23 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client'
implementation("io.jsonwebtoken:jjwt-api:0.12.4")
implementation 'org.springframework.boot:spring-boot-starter-security'
runtimeOnly("io.jsonwebtoken:jjwt-impl:0.12.4")
runtimeOnly("io.jsonwebtoken:jjwt-jackson:0.12.4")
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

implementation 'io.jsonwebtoken:jjwt-api:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.5'
runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.5'
implementation 'io.github.cdimascio:dotenv-java:3.0.0'
implementation 'me.paulschwarz:spring-dotenv:4.0.0'
}

tasks.named('test') {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.soopgyeol.api.common.dto;

import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Getter;

@Getter
public class NicknameUpdateRequest {
@Size(min = 2, max = 12, message = "닉네임은 2자 이상 12자 이하로 입력해주세요.")
@Pattern(regexp = ".*[a-zA-Z가-힣]+.*", message = "닉네임에는 한글 또는 영문자가 최소 1자 이상 포함되어야 합니다.")
private String nickname;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.soopgyeol.api.common.dto;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class NicknameUpdateResponse {
private String nickname;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.soopgyeol.api.common.exception;

public class InsufficientBalanceException extends RuntimeException {
public InsufficientBalanceException(String message) {
super(message);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.soopgyeol.api.common.exception;

public class ItemAlreadyOwnedException extends RuntimeException {
public ItemAlreadyOwnedException(String message) {
super(message);
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.soopgyeol.api.config;

import com.soopgyeol.api.domain.user.Role;
import com.soopgyeol.api.domain.user.SocialLoginType;
import com.soopgyeol.api.domain.user.User;
import com.soopgyeol.api.repository.UserRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;
import org.springframework.boot.CommandLineRunner;

@Component
@RequiredArgsConstructor
public class DevDataInitializer implements CommandLineRunner{

private final UserRepository userRepository;

@Override
public void run(String... args) {
if(userRepository.count() == 0) {
User testUser = User.builder()
.nickname("테스트 유저")
.email("[email protected]")
.password("1234")
.role(Role.USER)
.provider(SocialLoginType.GOOGLE)
.build();

userRepository.save(testUser);

System.out.println("테스트 유저가 자동 등록되었습니다. ID: " + testUser.getId());
}
}
}
17 changes: 17 additions & 0 deletions server/src/main/java/com/soopgyeol/api/config/DotEnvConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.soopgyeol.api.config;

import io.github.cdimascio.dotenv.Dotenv;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DotEnvConfig {

@Bean
public Dotenv dotenv() {
return Dotenv.configure()
.directory(System.getProperty("user.dir")) // 👈 명확하게 루트 경로 지정
.ignoreIfMissing()
.load();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.soopgyeol.api.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

@Configuration
public class PasswordEncoderConfig {

@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
}
65 changes: 65 additions & 0 deletions server/src/main/java/com/soopgyeol/api/config/SecurityConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package com.soopgyeol.api.config;

import com.soopgyeol.api.service.jwt.JwtAuthFilter;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authorization.AuthorizationDecision;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.factory.PasswordEncoderFactories;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.access.IpAddressAuthorizationManager;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;


@Configuration
@EnableWebSecurity
@RequiredArgsConstructor
public class SecurityConfig {

private final JwtAuthFilter jwtAuthFilter;

@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {

http.csrf(csrf -> csrf.disable());


http.sessionManagement(sm -> sm
.sessionCreationPolicy(SessionCreationPolicy.STATELESS));

http.authorizeHttpRequests(auth -> auth
.requestMatchers("/api/v1/auth/dev-login").permitAll()
.requestMatchers(
"/oauth2/**",
"/login/oauth2/**",
"/login-success",
"/auth/oauth2/**",
"/favicon.ico",
"/auth/login",
"/oauth2/google/code-log",
"/api/v1/auth/oauth/oauth2/**",
"/api/v1/auth/oauth/**"
).permitAll()
.anyRequest().authenticated()
);





http.exceptionHandling(eh -> eh
.authenticationEntryPoint(
(req, res, ex) -> res.sendError(HttpServletResponse.SC_UNAUTHORIZED)));

http.addFilterBefore(jwtAuthFilter, UsernamePasswordAuthenticationFilter.class);

return http.build();
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.soopgyeol.api.config.auth;


import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;


public class CustomUserDetails implements UserDetails {
private final Long userId;
private final String username;
private final String password;
private final Collection<? extends GrantedAuthority> authorities;

public CustomUserDetails(Long userId, String username, String password, Collection<? extends GrantedAuthority> authorities) {
this.userId = userId;
this.username = username;
this.password = password;
this.authorities = authorities;
}

// userId getter
public Long getUserId() {
return userId;
}

@Override
public String getUsername() {
return username;
}

@Override
public String getPassword() {
return password;
}

@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return authorities;
}

@Override
public boolean isAccountNonExpired() {
return true;
}

@Override
public boolean isAccountNonLocked() {
return true;
}

@Override
public boolean isCredentialsNonExpired() {
return true;
}

@Override
public boolean isEnabled() {
return true;
}
}
103 changes: 103 additions & 0 deletions server/src/main/java/com/soopgyeol/api/controller/AuthController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
package com.soopgyeol.api.controller;

import com.soopgyeol.api.dto.oauth.OAuthLoginRequest;
import com.soopgyeol.api.dto.oauth.OAuthLoginResponse;
import com.soopgyeol.api.service.auth.GoogleOauth;
import com.soopgyeol.api.service.auth.KakaoOauth;
import com.soopgyeol.api.service.auth.OAuthService;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.io.IOException;
import java.util.Map;

//임시 토큰 코드 사용 시 활성화
//import com.soopgyeol.api.domain.user.User;
//import com.soopgyeol.api.repository.UserRepository;
//import com.soopgyeol.api.service.jwt.JwtProvider;
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v1/auth/oauth")
public class AuthController {

private final OAuthService oAuthService;
private final GoogleOauth googleOauth;
private final KakaoOauth kakaoOauth;

@PostMapping("/login")
public OAuthLoginResponse login(@RequestBody OAuthLoginRequest request) {
return oAuthService.login(request);
}

@GetMapping("/oauth2/google/url")
public ResponseEntity<Map<String, String>> getGoogleLoginUrl() {
String url = googleOauth.getOauthRedirectURL();
return ResponseEntity.ok(Map.of("url", url));
}

@GetMapping("/oauth2/kakao/url")
public ResponseEntity<Map<String, String>> getKakaoLoginUrl() {
String url = kakaoOauth.getOauthRedirectURL();
return ResponseEntity.ok(Map.of("url", url));
}


@GetMapping("/oauth2/google/code-log")
public void googleAutoLogin(@RequestParam String code, HttpServletResponse response) throws IOException {
// 기존 login() 재활용
OAuthLoginRequest loginRequest = OAuthLoginRequest.builder()
.provider("GOOGLE")
.code(code)
.build();

OAuthLoginResponse loginResponse = oAuthService.login(loginRequest);

// JWT 꺼내기
String jwtToken = loginResponse.getJwtToken();

// 앱용 딥링크로 변경
response.sendRedirect("soopgyeol://oauth-callback/google?token=" + jwtToken);

}




@GetMapping("/oauth2/kakao/code-log")
public void kakaoAutoLogin(@RequestParam String code, HttpServletResponse response) throws IOException {
OAuthLoginRequest loginRequest = OAuthLoginRequest.builder()
.provider("KAKAO")
.code(code)
.build();

OAuthLoginResponse loginResponse = oAuthService.login(loginRequest);

String jwtToken = loginResponse.getJwtToken();

// 앱 용 딥링크로 변경
response.sendRedirect("soopgyeol://oauth-callback/kakao?token=" + jwtToken);
}




// 임시 토큰 생성시 활성화
// private final UserRepository userRepository;
// private final JwtProvider jwtProvider;
// @PostMapping("/dev-login")
// public OAuthLoginResponse devLogin(@RequestParam Long userId) {
// User user = userRepository.findById(userId)
// .orElseThrow(() -> new IllegalArgumentException("유저 없음"));
//
// String jwt = jwtProvider.createToken(user.getId(), user.getRole());
//
// return OAuthLoginResponse.builder()
// .jwtToken(jwt)
// .isNewUser(false)
// .build();
// }


}
Loading