mirror of https://github.com/usbharu/Hideout.git
fix: Spring Securityが正常に動作していなかったので修正
This commit is contained in:
parent
e19a165be4
commit
ae0e4a4013
|
@ -8,6 +8,8 @@ import org.springframework.http.HttpMethod.POST
|
|||
import org.springframework.security.config.annotation.web.builders.HttpSecurity
|
||||
import org.springframework.security.config.annotation.web.invoke
|
||||
import org.springframework.security.web.SecurityFilterChain
|
||||
import org.springframework.security.web.util.matcher.AnyRequestMatcher
|
||||
import org.springframework.security.web.util.matcher.RequestMatcher
|
||||
|
||||
@Configuration
|
||||
class ActivityPubSecurityConfig {
|
||||
|
@ -15,11 +17,16 @@ class ActivityPubSecurityConfig {
|
|||
@Order(4)
|
||||
fun activityPubSecurityFilterChain(http: HttpSecurity): SecurityFilterChain {
|
||||
http {
|
||||
securityMatcher(RequestMatcher {
|
||||
val accept = it.getHeader("Accept") ?: ""
|
||||
return@RequestMatcher accept == "application/json" || accept == "application/activity+json"
|
||||
})
|
||||
authorizeHttpRequests {
|
||||
authorize(POST, "/inbox", permitAll)
|
||||
authorize(POST, "/users/{username}/inbox", permitAll)
|
||||
authorize(GET, "/outbox", permitAll)
|
||||
authorize(GET, "/users/{username}/outbox", permitAll)
|
||||
authorize(GET, "/users/{username}", permitAll)
|
||||
}
|
||||
}
|
||||
return http.build()
|
||||
|
|
Loading…
Reference in New Issue