Dave Jensen
01/14/2020, 5:43 PMBen Madore
01/14/2020, 5:45 PMBen Madore
01/14/2020, 5:45 PMCzar
01/15/2020, 3:11 PMCzar
01/15/2020, 3:11 PMbjonnh
01/15/2020, 5:32 PMArtyom Gornostayev
01/23/2020, 7:07 AMArtyom Gornostayev
01/23/2020, 8:20 AMArtyom Gornostayev
01/23/2020, 8:51 AMLuca Clemente Gonzalez
01/27/2020, 3:08 PMLuca Clemente Gonzalez
01/27/2020, 3:09 PMCzar
01/30/2020, 11:31 PMBen Madore
02/04/2020, 11:07 PMBen Madore
02/04/2020, 11:08 PMcorneil
02/12/2020, 7:30 AMCzar
02/13/2020, 7:13 PM@EventListener
without using https://github.com/konrad-kaminski/spring-kotlin-coroutine ?
What I mean is, is there a standard officially supported way for doing that?Robert
02/19/2020, 4:50 PMpublic final Flux<T> checkpoint(String description)
Ideally I could stay in the Kotlin WebFlux Domain, without using Project Reactor Infrastructure Typesthanksforallthefish
02/21/2020, 10:55 AMclass CustomFilterSecurityExpressionRoot(
webSecurityExpressionRoot: SecurityExpressionOperations
) : SecurityExpressionOperations by webSecurityExpressionRoot {
fun isAuthenticatedUser() = !isClient() && isAuthenticated
fun isClaimClient() = isClient()
private fun isClient() = authentication.name.contains("@")
}
and a security configuration like
http.authorizeRequests()
.expressionHandler(CustomFilterSecurityExpressionHandler())
.requestMatchers(EndpointRequest.toAnyEndpoint()).permitAll()
.anyRequest().access("claimClient || authenticatedUser")
when I try to GET myservice/actuator
I get Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'permitAll' cannot be found on object of type 'com.iptiq.claim.distribution.config.CustomFilterSecurityExpressionRoot' - maybe not public or not valid?
in fact, I can solve the issue by adding val permitAll = permitAll()
to CustomFilterSecurityExpressionRoot
, but it seems cumbersome. is there a more elegant way (also because if this is only approach I would need to create a field for basically every method I want to delegate, which defeats the goal of delegation). I understand (probably wrongly) that if the method in org.springframework.security.access.expression.SecurityExpressionOperations
would be call getPermitAll()
instead of permitAll
my delegation would work, am I right?Ivan Pavlov
02/21/2020, 12:13 PM@GetMapping
fun get(@RequestParam(required = false) limit: Int = 10): String {
return limit.toString()
}
java.lang.IllegalStateException: Optional int parameter 'limit' is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type.
Different approach works fine but I would like to avoid it:
@GetMapping
fun get(@RequestParam(required = false, defaultValue = "10") limit: Int): String {
return limit.toString()
}
gbaldeck
02/21/2020, 9:52 PMgbaldeck
02/21/2020, 10:11 PMGopal S Akshintala
02/23/2020, 8:14 AMNamedParameterJdbcTemplate
. However, I am have been receiving this error that no beans found for it while running tests. In a annotation based approach, we don’t have to supply an explicit NamedParameterJdbcTemplate.
My sample app here: https://github.com/overfullstack/kofu-mvc-jdbc. And PFB some code snippets from it:
val app = application(WebApplicationType.SERVLET) {
beans {
bean<SampleService>()
bean<UserHandler>()
}
enable(dataConfig)
enable(webConfig)
}
val dataConfig = configuration {
beans {
bean<UserRepository>()
}
listener<ApplicationReadyEvent> {
ref<UserRepository>().init()
}
}
val webConfig = configuration {
webMvc {
port = if (profiles.contains("test")) 8181 else 8080
router {
val handler = ref<UserHandler>()
GET("/", handler::hello)
GET("/api", handler::json)
}
converters {
string()
jackson()
}
}
}
class UserRepository(private val client: NamedParameterJdbcTemplate) {
fun count() =
client.queryForObject("SELECT COUNT(*) FROM users", emptyMap<String, String>(), Int::class.java)
}
open class UserRepositoryTests {
private val dataApp = application(WebApplicationType.NONE) {
enable(dataConfig)
}
private lateinit var context: ConfigurableApplicationContext
@BeforeAll
fun beforeAll() {
context = dataApp.run(profiles = "test")
}
@Test
fun count() {
val repository = context.getBean<UserRepository>()
assertEquals(3, repository.count())
}
@AfterAll
fun afterAll() {
context.close()
}
}
Gopal S Akshintala
02/23/2020, 8:14 AMParameter 0 of constructor in com.sample.UserRepository required a bean of type 'org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate' that could not be found.
Action:
Consider defining a bean of type 'org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate' in your configuration.
Gopal S Akshintala
02/23/2020, 8:14 AMnfrankel
02/23/2020, 8:46 AMwe don’t have to supply an explicitNamedParameterJdbcTemplate
sendilkumarn [JHipster]
02/23/2020, 12:39 PMthis.webTestClient.mutateWith(csrf())
.mutateWith(mockAuthentication(TestUtil.authenticationToken(idToken)))
.post().uri("/api/logout").exchange()
.expectStatus().isOk()
.expectHeader().contentType(MediaType.APPLICATION_JSON_VALUE)
gbaldeck
02/24/2020, 8:22 PM