Hi all, I'm hoping there's a way to do this, but i...
# ktor
j
Hi all, I'm hoping there's a way to do this, but is there any way to authenticate all routes in an application without wrapping authenticate everywhere? We have an application that's structuring the routes
Copy code
routing {
  someRoute1()
  someRoute2()
  ...
  someRoute100()
}
with each group of routes in it's own file
Copy code
fun Application.someRoute1() {
  routing {
    route('/some/{place}') {
      head {
      }
      get {
      }
    }
  }
}
however, we now want to add authentication to all routes, but if we add the authenticate function to the first example,
Copy code
routing {
  authenticate {
    someRoute1()
    someRoute2()
    ...
    someRoute100()
  }
}
it doesn't seem like the individual route functions get the authenticate function. Is there a way to do this without manually editing each individual route file?
i
Try
Route.routesFoo
and removing
routing {}
from the individual functions
j
ok i think that's good enough, thank you!
a shame that we still need to edit all the route files though
h
This was the exact problem i was facing Thanks alot 😁