istio-ecosystem / wasm-extensions

Contains miscellaneous Wasm extensions for Istio
Apache License 2.0
105 stars 34 forks source link

Support basicAuth per hostname #50

Closed arki91 closed 3 years ago

arki91 commented 3 years ago

In our setup we have multiple hostnames routed against one istio ingess gateway pod so we have to setup basic auth for each hostname differently.

bianpengyuan commented 3 years ago

The latest basic auth filter has hosts option now: https://github.com/istio-ecosystem/wasm-extensions/releases/tag/1.9.2. Please take a look at this configuration reference on how to configure the hosts option: https://github.com/istio-ecosystem/wasm-extensions/tree/master/extensions/basic_auth#configuration-reference.

An example configuration is like the folllow:

{
 "basic_auth_rules": [
   {
     "hosts":["bookinfo.com", "*.suffix.com", "host.prefix.*"],
     "prefix": "/productpage",
     "request_methods":[ "GET", "POST" ],
     "credentials":["test:test"]
   }
 ]
}

Thanks!