Remove authentication from certain route

87 views
Skip to first unread message

Ivan Kulaga

unread,
Jan 27, 2024, 2:20:14 PM1/27/24
to vert.x
Hello, beautiful community!
I would like to know if there is a way to remove protection from a certain path that was previously protected. 
For example, I have this code: 
// All requests to paths starting with '/api/' will be protected router.route("/api/*").handler(basicAuthHandler);but I want endpoints  ("/api/public/*") to be accessible without login.  
Could you please tell me how this can be achieved, or give a link to documentation/stackoverflow/examples etc.?

Paulo Lopes

unread,
Jan 28, 2024, 3:58:04 AM1/28/24
to ve...@googlegroups.com
Order does mater, so if you add the unprotected route first it takes precedence. Be aware that the wild cards may shade the later routes, so you need to plan the order correctly.

On 27 Jan 2024, at 20:20, Ivan Kulaga <kulagaivan...@gmail.com> wrote:

Hello, beautiful community!
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/vertx/241de1f7-54a8-4f9b-b195-247564d43402n%40googlegroups.com.

Ivan Kulaga

unread,
Jan 28, 2024, 6:45:03 AM1/28/24
to vert.x
It works! Thanks a lot for your swift reply, the knowledge that the order matters helped me a lot.
Reply all
Reply to author
Forward
0 new messages