Skip to content

Commit

Permalink
Merge branch 'develop' into feature/#146
Browse files Browse the repository at this point in the history
  • Loading branch information
Gyaak authored Aug 29, 2024
2 parents 5af87e3 + d2bf63c commit 9d717d4
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 42 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/gradle-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ jobs:
--port ${{ secrets.EC2_SSH_PORT }} \
--cidr ${{ steps.ip.outputs.ipv4 }}/32
- name: copy file via ssh key
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_KEY }}
port: ${{ secrets.EC2_SSH_PORT }}
source: "./docker-compose.yaml"
target: "./talkka/git/E2E2-TALKKA"

- name: Application Run
uses: appleboy/[email protected]
with:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ services:
ports:
- "8080:8080"
environment:
SPRING_DATASOURCE_URL: ${SPRING_DATASOURCE_URL}
SPRING_DATASOURCE_URL: ${MYSQL_URL}
SPRING_DATASOURCE_USERNAME: ${MYSQL_USERNAME}
SPRING_DATASOURCE_PASSWORD: ${MYSQL_PASSWORD}
env_file:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
Expand Down Expand Up @@ -39,6 +40,9 @@ public class SecurityConfig {
private static final Logger log = LoggerFactory.getLogger(SecurityConfig.class);
private final CustomOAuth2Service customOAuth2Service;

@Value("${base.url}")
private String baseUrl;

@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http
Expand Down Expand Up @@ -71,7 +75,7 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
)
.logout(logout -> logout
.logoutUrl("/api/auth/logout")
.logoutSuccessUrl("http://localhost:3000")
.logoutSuccessUrl(baseUrl)
.deleteCookies("JSESSIONID")
)
.exceptionHandling(exceptionHandling -> exceptionHandling
Expand All @@ -90,10 +94,10 @@ public AuthenticationSuccessHandler successHandler() {
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws IOException {
if (isUnregisteredUser(authentication)) {
response.sendRedirect("http://localhost:3000/register");
response.sendRedirect(baseUrl + "/register");
return;
}
response.sendRedirect("http://localhost:3000/login/ok");
response.sendRedirect(baseUrl + "/login/ok");
}

private boolean isUnregisteredUser(Authentication authentication) {
Expand All @@ -114,7 +118,7 @@ public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration config = new CorsConfiguration();

config.setAllowCredentials(true);
config.setAllowedOrigins(List.of("http://localhost:3000"));
config.setAllowedOrigins(List.of(baseUrl));
config.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"));
config.setAllowedHeaders(List.of("*"));
config.setExposedHeaders(List.of("*"));
Expand Down
124 changes: 87 additions & 37 deletions server/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1,54 +1,19 @@
spring:
application:
name: talkka-server
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: ${MYSQL_URL}
username: ${MYSQL_USERNAME}
password: ${MYSQL_PASSWORD}
sql:
init:
mode: never # schema.sql 실행시 always 키고 실행하시면 됩니다.
jpa:
hibernate:
ddl-auto: update
properties:
hibernate:
format_sql: true
dialect: org.hibernate.dialect.MySQL8Dialect
show-sql: true
security:
oauth2:
client:
registration:
naver:
client-id: ${NAVER_CLIENT_ID}
client-secret: ${NAVER_CLINET_SECRET}
redirect_uri: http://localhost:8080/api/auth/login/naver/code
client-name: Naver
authorization-grant-type: authorization_code
scope:
- name
- email
provider:
naver:
authorization-uri: https://nid.naver.com/oauth2.0/authorize
token-uri: https://nid.naver.com/oauth2.0/token
user-info-uri: https://openapi.naver.com/v1/nid/me
user-name-attribute: response
profiles:
active: prod # 개발 환경에 따라 변경할 것 (local | prod)
thymeleaf:
prefix: classpath:/templates/
suffix: .html


openapi:
public:
bus:
service-key:
keys:
- ${SERVICE_KEY_1}


bus:
location:
collect:
Expand Down Expand Up @@ -82,4 +47,89 @@ springdoc:
api-docs:
path: /api-docs
default-consumes-media-type: application/json
---
spring:
config:
activate:
on-profile: local
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: ${MYSQL_URL}
username: ${MYSQL_USERNAME}
password: ${MYSQL_PASSWORD}
sql:
init:
mode: never # schema.sql 실행시 always 키고 실행하시면 됩니다.
jpa:
hibernate:
ddl-auto: validate
properties:
hibernate:
format_sql: true
dialect: org.hibernate.dialect.MySQL8Dialect
show-sql: true
security:
oauth2:
client:
registration:
naver:
client-id: ${NAVER_CLIENT_ID}
client-secret: ${NAVER_CLIENT_SECRET}
redirect_uri: http://localhost:8080/api/auth/login/naver/code
client-name: Naver
authorization-grant-type: authorization_code
scope:
- name
- email
provider:
naver:
authorization-uri: https://nid.naver.com/oauth2.0/authorize
token-uri: https://nid.naver.com/oauth2.0/token
user-info-uri: https://openapi.naver.com/v1/nid/me
user-name-attribute: response

base:
url: http://localhost:3000
---
spring:
config:
activate:
on-profile: prod
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: ${MYSQL_URL}
username: ${MYSQL_USERNAME}
password: ${MYSQL_PASSWORD}
sql:
init:
mode: never
jpa:
hibernate:
ddl-auto: update
properties:
hibernate:
format_sql: true
dialect: org.hibernate.dialect.MySQL8Dialect
show-sql: false
security:
oauth2:
client:
registration:
naver:
client-id: ${NAVER_CLIENT_ID}
client-secret: ${NAVER_CLIENT_SECRET}
redirect_uri: https://talkka-bus/api/auth/login/naver/code
client-name: Naver
authorization-grant-type: authorization_code
scope:
- name
- email
provider:
naver:
authorization-uri: https://nid.naver.com/oauth2.0/authorize
token-uri: https://nid.naver.com/oauth2.0/token
user-info-uri: https://openapi.naver.com/v1/nid/me
user-name-attribute: response

base:
url: https://talkka-bus:3000 # 추후 프론트에 맞게 수정 필요

0 comments on commit 9d717d4

Please sign in to comment.