From ddec6a2e23b061523e9021a8ab87509a1a9d9c1e Mon Sep 17 00:00:00 2001 From: "zhang.pengcheng" Date: Thu, 5 Jun 2025 11:47:59 +0900 Subject: [PATCH] =?UTF-8?q?1.=20Long=20user=5Fid=20=E2=86=92=20Authenticat?= =?UTF-8?q?ion=20authentication=202.=20SecurityConfig=20=20.anyRequest().p?= =?UTF-8?q?ermitAll();=E7=84=A1=E5=8A=B9=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/example/todoapp/config/SecurityConfig.java | 7 +++++-- .../main/java/com/example/todoapp/dto/ToBuyResponse.java | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/com/example/todoapp/config/SecurityConfig.java b/backend/src/main/java/com/example/todoapp/config/SecurityConfig.java index 0c91b4f..326888d 100644 --- a/backend/src/main/java/com/example/todoapp/config/SecurityConfig.java +++ b/backend/src/main/java/com/example/todoapp/config/SecurityConfig.java @@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpMethod; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; @@ -49,8 +50,10 @@ public class SecurityConfig { .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .authorizeHttpRequests() - .requestMatchers("/auth/**").permitAll() // 認証エンドポイントは認証不要 - .anyRequest().authenticated(); // その他のエンドポイントは認証必要 + // .requestMatchers("/auth/**").permitAll() // 認証エンドポイントは認証不要 + // .anyRequest().authenticated() + .anyRequest().permitAll(); + ; // その他のエンドポイントは認証必要 // JWTフィルターを認証フィルターの前に追加 http.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class); diff --git a/backend/src/main/java/com/example/todoapp/dto/ToBuyResponse.java b/backend/src/main/java/com/example/todoapp/dto/ToBuyResponse.java index 03809dc..bf5730b 100644 --- a/backend/src/main/java/com/example/todoapp/dto/ToBuyResponse.java +++ b/backend/src/main/java/com/example/todoapp/dto/ToBuyResponse.java @@ -6,6 +6,7 @@ import lombok.Data; public class ToBuyResponse { private int tobuy_id; private Long stuff_id; + private String stuff_name; private int amount; private String shop; } \ No newline at end of file