Rohde Fischer
08/16/2024, 3:23 PMdata class DomainPrincipal
that of course does not (and should not) know of ktor Principal
. However, when doing JWT mapping in ktor, I want to map to my domain model 🙂 but as far as I know, I cannot really do that because the data class is (as it should be) final.
So, if not much mistaken, I need to work around this, am I correct in this?
If so am I also correct in that there's basically two ways to work around it:
• Having some kind of composition by data class KtorDomainPrincipal(val domainPrincipal: DomainPrincipal): Principal
• Using the by
keyword to make a subclass of principal that basically wraps the methods and fields of my DomainPrincipal
is there any pros or cons that I should know of with the two? I think the first is easier to maintain whereas the second will have a cleaner and nicer interfaceBruce Hamilton
08/17/2024, 6:44 AMApplicationCall.principal<KtorDomainPrincipal>.domainObject
. I'm not entirely sure why the empty placeholder Principal
interface exists, it might be useful for us to remove it from Ktor authentication.