update public path

This commit is contained in:
2025-08-12 14:59:32 +02:00
committed by swordsteel
parent c69a9cd07c
commit e19e0e59bc
2 changed files with 10 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ package ltd.hlaeja.configuration
import ltd.hlaeja.security.JwtAuthenticationConverter import ltd.hlaeja.security.JwtAuthenticationConverter
import ltd.hlaeja.security.JwtAuthenticationManager import ltd.hlaeja.security.JwtAuthenticationManager
import ltd.hlaeja.security.authorize.publicPaths
import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration import org.springframework.context.annotation.Configuration
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity
@@ -55,6 +56,6 @@ class SecurityConfiguration {
private fun authorizeExchange( private fun authorizeExchange(
authorizeExchange: AuthorizeExchangeSpec, authorizeExchange: AuthorizeExchangeSpec,
) = authorizeExchange ) = authorizeExchange
.pathMatchers("/login").permitAll() .publicPaths().permitAll()
.anyExchange().hasRole("REGISTRY") .anyExchange().hasRole("REGISTRY")
} }

View File

@@ -0,0 +1,8 @@
package ltd.hlaeja.security.authorize
import org.springframework.security.config.web.server.ServerHttpSecurity.AuthorizeExchangeSpec
fun AuthorizeExchangeSpec.publicPaths(): AuthorizeExchangeSpec.Access = pathMatchers(
"/actuator/**",
"/login",
)