|
|
|
|
@ -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); |
|
|
|
|
|