Apply basic-auth plugin at route level

Is there any way to apply basic-auth plugin on all the routes together instead of manually applying it on each route? Thanks.

You can apply the plugin on global level

Also, there are a few routes on which I do not want to apply the basic-auth plugin. Basically, I wanted to know if it is possible to allow some routes while applying the basic-auth plugin.