fix security configuration
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
dmitriy.churmeev
2026-03-29 15:40:56 +03:00
parent 3eeb91dee4
commit 69be05259d
2 changed files with 5 additions and 5 deletions

View File

@@ -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

View File

@@ -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"
}