Skip to content

Commit

Permalink
Merge pull request #34 from Leets-Official/33-bug-cors
Browse files Browse the repository at this point in the history
33 bug cors
  • Loading branch information
yechan-kim authored Jul 30, 2024
2 parents 64cb330 + edbb5cb commit 403e2c1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion appspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ hooks:
AfterInstall:
- location: scripts/after-deploy.sh
timeout: 60
runas: ubuntu
runas: root
4 changes: 1 addition & 3 deletions scripts/after-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,5 @@ else
sleep 5
fi

source ~/.bashrc

echo "> Deploy - $JAR_PATH "
nohup java -jar $JAR_PATH > commitato.log 2>&1 &
nohup java -jar $JAR_PATH > commitato.log 2>&1 &
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
)
.csrf(AbstractHttpConfigurer::disable)
.formLogin((formLogin) -> formLogin
.loginPage("/login/github"))
.loginPage("/login/github"))
.authorizeHttpRequests((authorize) ->
authorize
.requestMatchers("/", "/v3/api-docs/**", "/swagger-ui/**",
"/login/**", "/auth/**", "/h2-console/**", "/error/**").permitAll()
.anyRequest().authenticated()
.requestMatchers("/", "/v3/api-docs/**", "/swagger-ui/**",
"/login/**", "/auth/**", "/h2-console/**", "/error/**").permitAll()
.anyRequest().authenticated()
)
.headers(headers -> headers
.frameOptions(frameOptions -> frameOptions.disable()) // H2 ์ฝ˜์†” ํ”„๋ ˆ์ž„ ์˜ต์…˜ ์„ค์ •
.frameOptions(frameOptions -> frameOptions.disable()) // H2 ์ฝ˜์†” ํ”„๋ ˆ์ž„ ์˜ต์…˜ ์„ค์ •
)
.addFilterBefore(new JwtAuthenticationFilter(jwtProvider), UsernamePasswordAuthenticationFilter.class);
return http.build();
Expand All @@ -59,7 +59,13 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
@Bean
CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
configuration.setAllowedOrigins(Arrays.asList("http://localhost:8080", "http://localhost:3000", "http://localhost:5173", DOMAIN_URI));
configuration.setAllowedOrigins(Arrays.asList(
"http://localhost:8080",
"http://localhost:3000",
"http://localhost:5173",
"https://api.github.com",
"https://github.com",
DOMAIN_URI));
configuration.setAllowedMethods(Arrays.asList("HEAD", "GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"));
configuration.setAllowCredentials(true);
configuration.setAllowedHeaders(List.of("*"));
Expand Down

0 comments on commit 403e2c1

Please sign in to comment.