wdonne / traefikoidc

BSD 2-Clause "Simplified" License
2 stars 2 forks source link

is late initialization of the plugin possible? #5

Closed KampfCaspar closed 3 months ago

KampfCaspar commented 3 months ago

Apart from other sites I would like to protect the traefik dashboard of the host that holds my OIDC server with the plugin.

Now it seems, the plugin is instantiated before the routers. It immediately tries to fetch the OIDC information but - given the router to my OIDC server does not yet exist - is served an error page with default certificate.

If it would be possible to let the plugin 'late initialize' (after the routers exist, e.g. on first use), this recursion problem could be solved. Or is there another way to break the chain?

wdonne commented 3 months ago

All middlewares are indeed instantiated before the routes because the latter may refer to the former. I'm not aware of any lifecycle events for routes, so the only option I see is to postpone the real initialisation until the first request comes in.

wdonne commented 3 months ago

Fixed in v1.1.0.