Skip to content

Commit

Permalink
chore: 배포 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
SSung023 committed Apr 7, 2024
1 parent 0f58975 commit cb6d9fb
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 8 deletions.
26 changes: 23 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Build and Deploy to EC2

on:
push:
branches: [ "main" ]
branches: [ "chore/release-test-hey" ]
pull_request:
branches: [ "main" ]
branches: [ "chore/release-test-hey" ]

jobs:
deploy:
Expand All @@ -14,13 +14,33 @@ jobs:
packages: write
steps:
- uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: create yaml files
uses: actions/checkout@v4
- run: touch .src/main/resources/application.yml
- run: touch .src/main/resources/application-config.yml
- run: touch .src/main/resources/application-db.yml
- run: touch .src/main/resources/application-file.yml
- run: touch .src/main/resources/application-github.yml
- run: touch .src/main/resources/application-jwt.yml
- run: touch .src/main/resources/application-oauth.yml
- run: touch .src/main/resources/application-payment.yml
- run: echo "${{ secrets.APPLICATION }}" > ./src/main/resources/application.yml
- run: echo "${{ secrets.CONFIG }}" > ./src/main/resources/application-config.yml
- run: echo "${{ secrets.DB }}" > ./src/main/resources/application-db.yml
- run: echo "${{ secrets.FILE }}" > ./src/main/resources/application-file.yml
- run: echo "${{ secrets.GITHUB }}" > ./src/main/resources/application-github.yml
- run: echo "${{ secrets.JWT }}" > ./src/main/resources/application-jwt.yml
- run: echo "${{ secrets.OAUTH }}" > ./src/main/resources/application-oauth.yml
- run: echo "${{ secrets.PAYMENT }}" > ./src/main/resources/application-payment.yml


- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler;
import org.springframework.stereotype.Component;
import org.springframework.web.util.UriComponentsBuilder;

@Component
public class OAuth2FailureHandler extends SimpleUrlAuthenticationFailureHandler {
private final String REDIRECT_URL = "http://localhost:5173";
private final String REDIRECT_URL;
private final String ERROR_PARAM_PREFIX = "error";

public OAuth2FailureHandler(@Value("${url.base}") String REDIRECT_URL) {
this.REDIRECT_URL = REDIRECT_URL;
}

@Override
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
AuthenticationException exception) throws IOException, ServletException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,28 @@
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.Authentication;
import org.springframework.security.oauth2.core.user.OAuth2User;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;
import org.springframework.stereotype.Component;
import org.springframework.web.util.UriComponentsBuilder;

@Component
@RequiredArgsConstructor
public class OAuth2SuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
private final String SIGNUP_URL = "http://localhost:5173/login/signup";
private final String AUTH_URL = "http://localhost:5173/auth";
private final String SIGNUP_URL;
private final String AUTH_URL;
private final UserRepository userRepository;

public OAuth2SuccessHandler(@Value("${url.base}") String BASE_URL,
@Value("${url.path.signup}") String SIGN_UP_PATH,
@Value("${url.path.auth}") String AUTH_PATH,
UserRepository userRepository) {
this.userRepository = userRepository;
this.SIGNUP_URL = BASE_URL + SIGN_UP_PATH;
this.AUTH_URL = BASE_URL + AUTH_PATH;
}

@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws IOException, ServletException {
Expand Down

0 comments on commit cb6d9fb

Please sign in to comment.