wishlists + statics + some fixes
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package space.luminic.budgerapp.configs
|
||||
|
||||
import kotlinx.coroutines.reactor.mono
|
||||
import org.slf4j.LoggerFactory
|
||||
import org.springframework.http.HttpHeaders
|
||||
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken
|
||||
import org.springframework.security.core.authority.SimpleGrantedAuthority
|
||||
@@ -16,8 +15,7 @@ import space.luminic.budgerapp.services.AuthService
|
||||
|
||||
@Component
|
||||
class BearerTokenFilter(private val authService: AuthService) : SecurityContextServerWebExchangeWebFilter() {
|
||||
private val logger = LoggerFactory.getLogger(BearerTokenFilter::class.java)
|
||||
|
||||
// private val logger = LoggerFactory.getLogger(BearerTokenFilter::class.java)
|
||||
|
||||
|
||||
override fun filter(exchange: ServerWebExchange, chain: WebFilterChain): Mono<Void> {
|
||||
@@ -27,7 +25,10 @@ class BearerTokenFilter(private val authService: AuthService) : SecurityContextS
|
||||
"/api/auth/login",
|
||||
"/api/auth/register",
|
||||
"/api/auth/tgLogin"
|
||||
) || exchange.request.path.value().startsWith("/api/actuator")
|
||||
) || exchange.request.path.value().startsWith("/api/actuator") || exchange.request.path.value()
|
||||
.startsWith("/api/static/")
|
||||
|| exchange.request.path.value()
|
||||
.startsWith("/api/wishlistexternal/")
|
||||
) {
|
||||
return chain.filter(exchange)
|
||||
}
|
||||
|
||||
@@ -26,7 +26,8 @@ class SecurityConfig(
|
||||
.logout { it.disable() }
|
||||
.authorizeExchange {
|
||||
it.pathMatchers(HttpMethod.POST, "/auth/login", "/auth/register", "/auth/tgLogin").permitAll()
|
||||
it.pathMatchers("/actuator/**").permitAll()
|
||||
it.pathMatchers("/actuator/**", "/static/**").permitAll()
|
||||
it.pathMatchers("/wishlistexternal/**").permitAll()
|
||||
it.anyExchange().authenticated()
|
||||
}
|
||||
.addFilterAt(
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package space.luminic.budgerapp.configs
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.Paths
|
||||
|
||||
|
||||
@Configuration
|
||||
class StorageConfig(@Value("\${storage.location}") location: String) {
|
||||
|
||||
val rootLocation: Path = Paths.get(location)
|
||||
|
||||
init {
|
||||
Files.createDirectories(rootLocation) // Создаем папку, если её нет
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user