Hi! Old java-spring developer here who has spent t...
# spring
g
Hi! Old java-spring developer here who has spent the last few years in kotlin and ktor. If one is to start using spring with ktor, are there any things you should really watch out for? Specific question: How are coroutines working out with Spring Security? Do you need to do some kind of CoroutineContext adapter similar to the old Exector when one used @Async ?
n
I recently used Kotlin in Spring Webflux with Spring security it was pretty straightforward in my opinion. Most of the Spring security APIs are Flux/Mono based. Do you have specific questions in mind.?
r
Typical cases are well supported. But some more advanced things, like spring-security-kerberos, don't work with webflux.
g
oh I dropped the ball here.. @nicholasnet a more specific question is how it works when you are suspending in coroutines given that the security context is usually on the thread, and even if you do the MODE_INHERITABLETHREADLOCAL I'd guess that only works as long as you are working with threads and not coroutines?
n
My bad I should have read the question properly. Most of the Spring Reactive API are Mono/Flux based (no suspend) so you will have to return that as far as I know. Does not mean you cannot use coroutine in your internal implementation.. you certainly can but end of the day you still have to return Mono or Flux. Having said that I am not sure this answers your question though. So, I would recommend to see docs and code sample to see how it fits together.
g
@nicholasnet I'm mainly talking about -> you come in with thread #1 and you start doing work with coroutine #1 -> coroutine #1 gets suspended in thread #1 -> coroutine #1 get awoken in thread #2 Now where are the security details? Yep, will do some more research