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