diff --git a/.github/workflows/dev_deploy.yml b/.github/workflows/dev_deploy.yml index 0369c5a..f526bde 100644 --- a/.github/workflows/dev_deploy.yml +++ b/.github/workflows/dev_deploy.yml @@ -1,63 +1,63 @@ -#name: Travel Compass Dev CI/CD -# -#on: -# pull_request: -# types: -# - closed -# workflow_dispatch: -# -#jobs: -# build: -# runs-on: ubuntu-latest -# if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop' -# -# steps: -# - name: Checkout -# uses: actions/checkout@v4 -# -# - name: Set up JDK 17 -# uses: actions/setup-java@v4.0.0 -# with: -# java-version: '17' -# distribution: 'adopt' -# -# - name: Grant execute permission for gradlew -# run: chmod +x gradlew -# shell: bash -# -# - name: Build with Gradle -# run: ./gradlew clean build -x test -# shell: bash -# -# - name: Get current time -# uses: josStorer/get-current-time@v2 -# id: current-time -# with: -# format: 'YYYY-MM-DDTHH:mm:ss' -# utcOffset: '+09:00' -# -# - name: Show current time -# run: echo "${{ steps.current-time.outputs.formattedTime }}" -# shell: bash -# -# - name: Generate deployment package -# run: | -# mkdir -p deploy -# cp build/libs/*.jar deploy/application.jar -# cp Procfile deploy/Procfile -# cp -r .ebextensions_dev deploy/.ebextensions -# cp -r .platform deploy/.platform -# cd deploy && zip -r deploy.zip . -# -# - name: Deploy to Elastic Beanstalk -# uses: einaregilsson/beanstalk-deploy@v20 -# with: -# aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} -# aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} -# application_name: 'travel-compass-dev' -# environment_name: 'Travel-compass-dev-env' -# version_label: github-action-${{ steps.current-time.outputs.formattedTime }} -# region: 'ap-northeast-2' -# deployment_package: 'deploy/deploy.zip' -# wait_for_deployment: false -# +name: Travel Compass Dev CI/CD + +on: + pull_request: + types: + - closed + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'develop' + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4.0.0 + with: + java-version: '17' + distribution: 'adopt' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + shell: bash + + - name: Build with Gradle + run: ./gradlew clean build -x test + shell: bash + + - name: Get current time + uses: josStorer/get-current-time@v2 + id: current-time + with: + format: 'YYYY-MM-DDTHH:mm:ss' + utcOffset: '+09:00' + + - name: Show current time + run: echo "${{ steps.current-time.outputs.formattedTime }}" + shell: bash + + - name: Generate deployment package + run: | + mkdir -p deploy + cp build/libs/*.jar deploy/application.jar + cp Procfile deploy/Procfile + cp -r .ebextensions_dev deploy/.ebextensions + cp -r .platform deploy/.platform + cd deploy && zip -r deploy.zip . + + - name: Deploy to Elastic Beanstalk + uses: einaregilsson/beanstalk-deploy@v20 + with: + aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + application_name: 'travel-compass-dev' + environment_name: 'Travel-compass-dev-env' + version_label: github-action-${{ steps.current-time.outputs.formattedTime }} + region: 'ap-northeast-2' + deployment_package: 'deploy/deploy.zip' + wait_for_deployment: false + diff --git a/.platform/nginx/confid/client_max_body_size.conf b/.platform/nginx/confid/client_max_body_size.conf new file mode 100644 index 0000000..8e8277e --- /dev/null +++ b/.platform/nginx/confid/client_max_body_size.conf @@ -0,0 +1 @@ +client_max_body_size 200M; \ No newline at end of file diff --git a/src/main/java/com/travelcompass/api/global/config/SwaggerConfig.java b/src/main/java/com/travelcompass/api/global/config/SwaggerConfig.java index 048038d..cb2b0d9 100644 --- a/src/main/java/com/travelcompass/api/global/config/SwaggerConfig.java +++ b/src/main/java/com/travelcompass/api/global/config/SwaggerConfig.java @@ -39,6 +39,7 @@ public OpenAPI api() { .components(components); } + // 사용자 auth -> swagger 사용 가능 @Bean public GroupedOpenApi allGroup(){ return GroupedOpenApi.builder() diff --git a/src/main/java/com/travelcompass/api/global/config/WebSecurityConfig.java b/src/main/java/com/travelcompass/api/global/config/WebSecurityConfig.java index 9a57304..95c7bef 100644 --- a/src/main/java/com/travelcompass/api/global/config/WebSecurityConfig.java +++ b/src/main/java/com/travelcompass/api/global/config/WebSecurityConfig.java @@ -41,6 +41,10 @@ protected SecurityFilterChain securityFilterChain( "/token/**", // 로컬에게 토큰 반환 "/oauth/**", // 프론트에게 토큰 반환 + "/swagger-ui/**", // Swagger UI + "/v3/api-docs/**", // Swagger API docs + "/swagger-resources/**", // Swagger resources + "/locations/regions/**", // 지역별 장소 리스트 조회 "/locations/**", // 장소 상세 조회 diff --git a/src/main/java/com/travelcompass/api/oauth/OAuth2SuccessHandler.java b/src/main/java/com/travelcompass/api/oauth/OAuth2SuccessHandler.java index 118f67c..eb35a94 100644 --- a/src/main/java/com/travelcompass/api/oauth/OAuth2SuccessHandler.java +++ b/src/main/java/com/travelcompass/api/oauth/OAuth2SuccessHandler.java @@ -29,18 +29,15 @@ public class OAuth2SuccessHandler extends SimpleUrlAuthenticationSuccessHandler private final JwtTokenUtils tokenUtils; private final UserDetailsManager userDetailsManager; private final RefreshTokenRepository refreshTokenRepository; -// private final RefreshTokenRedisRepository; public OAuth2SuccessHandler( JwtTokenUtils tokenUtils, UserDetailsManager userDetailsManager, RefreshTokenRepository refreshTokenRepository -// RefreshTokenRedisRepository ) { this.tokenUtils = tokenUtils; this.userDetailsManager = userDetailsManager; this.refreshTokenRepository = refreshTokenRepository; -// this.refreshTokenRedisRepository = refreshTokenRedisRepository; } @Override @@ -102,9 +99,13 @@ public void onAuthenticationSuccess( // 목적지 URL 설정 - 토큰 던짐 String targetUrl = String.format( - "http://travel-compass.netlify.app/oauth/callback?access-token=%s&refresh-token=%s", - jwt.getAccessToken(), jwt.getRefreshToken() -// "http://localhost:8080/token/token?access-token=%s&refresh-token=%s", jwt.getAccessToken(), jwt.getRefreshToken() + // 로컬 + "http://localhost:8080/token/token?access-token=%s&refresh-token=%s", jwt.getAccessToken(), jwt.getRefreshToken() + // 프론트 도메인 +// "http://travel-compass.netlify.app/oauth/callback?access-token=%s&refresh-token=%s", jwt.getAccessToken(), jwt.getRefreshToken() + // 백 도메인 +// "http://umc.persi0815:8080/token/token?access-token=%s&refresh-token=%s", jwt.getAccessToken(), jwt.getRefreshToken() + ); // 실제 Redirect 응답 생성 getRedirectStrategy().sendRedirect(request, response, targetUrl); diff --git a/src/main/java/com/travelcompass/api/oauth/jwt/OAuthResponseDto.java b/src/main/java/com/travelcompass/api/oauth/jwt/OAuthResponseDto.java deleted file mode 100644 index 49f7232..0000000 --- a/src/main/java/com/travelcompass/api/oauth/jwt/OAuthResponseDto.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.travelcompass.api.oauth.jwt; - -import lombok.Builder; -import lombok.Getter; -import lombok.Setter; - - -@Builder -@Getter -@Setter -public class OAuthResponseDto { - private String accessToken; - private String refreshToken; - - public OAuthResponseDto(String accessToken, String refreshToken) { - this.accessToken = accessToken; - this.refreshToken = refreshToken; - } -} diff --git a/src/main/java/com/travelcompass/api/oauth/service/UserService.java b/src/main/java/com/travelcompass/api/oauth/service/UserService.java index 09299d9..af03e7d 100644 --- a/src/main/java/com/travelcompass/api/oauth/service/UserService.java +++ b/src/main/java/com/travelcompass/api/oauth/service/UserService.java @@ -22,7 +22,6 @@ public class UserService { private final UserRepository userRepository; private final RefreshTokenRepository refreshTokenRepository; -// private final RefreshTokenRedisRepository refreshTokenRedisRepository; private final PasswordEncoder passwordEncoder; private final JpaUserDetailsManager manager; diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index fa954e2..8aa7d5c 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -24,8 +24,8 @@ spring: # 서비스 제공자측에 저희가 어떤 서비스인지 인증하기 위한 값 client-id: 3tVKSO15tNGbkeZJf8eE #서비스 제공자측에 저희가 어떤 서비스인지 인증하기 위한 값 client-secret: zHvANLwWHH - redirect-uri: http://umc.persi0815.site:8080/login/oauth2/code/naver -# redirect-uri: http://localhost:8080/login/oauth2/code/naver +# redirect-uri: http://umc.persi0815.site:8080/login/oauth2/code/naver + redirect-uri: http://localhost:8080/login/oauth2/code/naver authorization-grant-type: authorization_code # 어떤 방식으로 access token을 받을지 정의 client-authentication-method: client_secret_post # Client Id, Client Secret를 요청의 어디에 포함할지 정의. Body client-name: Naver