This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.test.rest
|
package com.test.rest
|
||||||
|
|
||||||
import org.slf4j.LoggerFactory
|
import org.slf4j.LoggerFactory
|
||||||
|
import org.springframework.beans.factory.annotation.Value
|
||||||
import org.springframework.security.access.prepost.PreAuthorize
|
import org.springframework.security.access.prepost.PreAuthorize
|
||||||
import org.springframework.web.bind.annotation.GetMapping
|
import org.springframework.web.bind.annotation.GetMapping
|
||||||
import org.springframework.web.bind.annotation.RestController
|
import org.springframework.web.bind.annotation.RestController
|
||||||
@@ -11,6 +12,9 @@ open class TestController {
|
|||||||
|
|
||||||
private val logger = LoggerFactory.getLogger(TestController::class.java)
|
private val logger = LoggerFactory.getLogger(TestController::class.java)
|
||||||
|
|
||||||
|
@Value("\${SPRING_DATASOURCE_PASSWORD}")
|
||||||
|
private val password: String? = null
|
||||||
|
|
||||||
@PreAuthorize("hasRole('ADMIN')")
|
@PreAuthorize("hasRole('ADMIN')")
|
||||||
@GetMapping("/test")
|
@GetMapping("/test")
|
||||||
fun test(): String {
|
fun test(): String {
|
||||||
@@ -29,4 +33,9 @@ open class TestController {
|
|||||||
return "Home page"
|
return "Home page"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/scret")
|
||||||
|
fun secret(): String {
|
||||||
|
return "password"
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user