in my project I have several routes like - `/api/...
# ktor
w
in my project I have several routes like -
/api/<device id>/foo
-
/api/<device id>/bar
- ... each device id is a UUID and I want to verify it is a UUID and not a random string and ensure that the user is authorized for that. I saw [this sample project](https://github.com/ktorio/ktor-documentation/blob/3.0.0/codeSnippets/snippets/custom-plugin-authorization/src/main/kotlin/com/example/plugins/AuthorizationPlugin.kt) using
createRouteScopedPlugin
and
on(AuthenticationChecked
which does most of what I want. I just want to know if there is a way to pass along a verified UUID from this plugin to the routes this is installed on so I don’t have to manually convert the string parameter into a UUID every place it is used
i could use the call attributes but that seems kind of weird
maybe call attributes + an extension function to clean up the retrieval?
a
maybe call attributes + an extension function to clean up the retrieval?
I think it's an optimal solution
👍 1