fix security configuration
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -3,11 +3,6 @@ when:
|
||||
branch: main
|
||||
|
||||
steps:
|
||||
test:
|
||||
image: alpine:latest
|
||||
commands:
|
||||
- echo "WOODPECKER WORKS"
|
||||
|
||||
# Шаг 1: Сборка Spring Boot приложения через Gradle
|
||||
build:
|
||||
image: gradle:8.5-jdk21 # JDK
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.test.test.rest
|
||||
|
||||
import com.auth.config.WebSecurityConfig
|
||||
import org.springframework.security.access.prepost.PreAuthorize
|
||||
import org.springframework.security.core.Authentication
|
||||
import org.springframework.security.core.context.SecurityContextHolder
|
||||
@@ -10,9 +11,13 @@ import org.springframework.web.bind.annotation.RestController
|
||||
@RestController
|
||||
open class TestController {
|
||||
|
||||
private val logger = org.slf4j.LoggerFactory.getLogger(TestController::class.java)
|
||||
|
||||
|
||||
@PreAuthorize("hasRole('ADMIN')")
|
||||
@GetMapping("/test")
|
||||
fun test(): String {
|
||||
logger.info("test!")
|
||||
return "Test page"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user