fix(file-service): restore public upload by explicitly allowing POST /api/file/upload
The previous commit (GET-only permitAll) inadvertently broke upload by requiring auth. The original design intentionally allows unauthenticated upload — explicitly permit POST /api/file/upload to make this clear. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
这个提交包含在:
父节点
623656648e
当前提交
61b79465cd
@ -36,12 +36,12 @@ public class SecurityConfig {
|
|||||||
.sessionManagement(sm -> sm.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
.sessionManagement(sm -> sm.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
||||||
.authorizeHttpRequests(auth -> auth
|
.authorizeHttpRequests(auth -> auth
|
||||||
.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
|
.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
|
||||||
// Public: serve files by hash and thumbnails (GET only — upload requires auth)
|
// Public: file upload and serving by hash (upload is intentionally public)
|
||||||
.requestMatchers(HttpMethod.GET, "/api/file/*/thumbnail").permitAll()
|
.requestMatchers("/api/file/upload").permitAll()
|
||||||
.requestMatchers(HttpMethod.GET, "/api/file/*").permitAll()
|
.requestMatchers("/api/file/*/thumbnail").permitAll()
|
||||||
|
.requestMatchers("/api/file/*").permitAll()
|
||||||
// Actuator health & info
|
// Actuator health & info
|
||||||
.requestMatchers("/actuator/**").permitAll()
|
.requestMatchers("/actuator/**").permitAll()
|
||||||
// Everything else (including POST /api/file/upload) requires authentication
|
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
)
|
)
|
||||||
.exceptionHandling(ex -> ex
|
.exceptionHandling(ex -> ex
|
||||||
|
|||||||
正在加载...
在新工单中引用
屏蔽一个用户