https://kotlinlang.org logo
#ktor
Title
# ktor
r

Rustam Siniukov

03/16/2022, 2:55 PM
hi, what version do you use?
h

hfhbd

03/16/2022, 2:57 PM
1.6.8, okay, then I try to create a reproducer
I think, I found my mistake:
Copy code
authenticate("admin") {
    get {
        val user = call.principal<UserIdPrincipal>()!!
        call.respondText { user.name }
    }
}
authenticate("users") {
    get {
        val user = call.principal<UserIdPrincipal>()!!
        call.respondText { user.name }
    }
}
I need to put both providers into one
authenticate
builder...
Copy code
authenticate("admin", "users") {
    get {
        val user = call.principal<UserIdPrincipal>()!!
        call.respondText { user.name }
    }
}
r

Rustam Siniukov

03/16/2022, 3:16 PM
yes, that’s true. in the first example there are different subroutes that doesn’t merge
I was very surprised with your message, because we have a test for multiple auth providers
h

hfhbd

03/16/2022, 3:18 PM
Hm, okay, so I have to check the role/users permissions 😄 With the first example, I could simple call a different action, because I know, the user is an admin.
So what about adding a check/warning when two routes are equal (except auth), but could not be merged?
4 Views