is there a way to get the currently selected `Rout...
# ktor
z
is there a way to get the currently selected
Route
from the
ApplicationCall
?
z
ah, RTFM 😄 thank you
👍 1
😆 1
c
@zpearce what is your usecase? what are you trying to lookup from the currently selected route?
z
I'm currently playing around with attaching metadata to routes indicating which jwt scopes are required to access the route. I don't have anything really working yet - still trying to wrap my head around it
c
Perhaps you need to do it similar to already existing auth
Similar to
Route.authenticate()
z
the jwt auth implementation gives me a validate function where I can verify the jwt, but it doesn't give me the ability to assign different required scopes to routes.
at first I thought I could write my own extension functions on
Route
(get, post, etc) that take a list of required jwt scopes. That metadata would need to be stored somewhere that is accessible in the
validate
function, where I could compare the scope claim of the incoming jwt against the list of required scopes for the current route
c
How man "scopes" do you have? Can't you simply register multiple JWT authenitcators for every scope ?
z
ahh, I think I see what you mean. Different named authenticators (all jwt based) that themselves keep the metadata about required scopes?
c
yes, exactly
however it wouldn't work if you have too many scopes
z
right
c
or if the list of scopes is dynamic
z
as of now my project doesn't have that many. I'll give that a try and see how I like it. Thanks for the idea
c
It looks like we need some kind markers to be passed with
configurationNames
that need to be available in verifiers. But this requires design, we can think about it