Traefik Plugin from Basic Auth using Kuzzle as authentication provider and Basic Auth
This is a Traefik Basic Auth Plugin using Kuzzle as authentication provider.
One authentication system to rule them all
Kuzzle offer a complex and fine-grained RBAC authentication system, why do not use it everywhere?
At this time, Traefik Plugin system is still an experimental feature use it with caution. You can freeze your Traefik version to increase stability if you want to use this plugin on a real world use case
You can found a demonstration Docker Compose file (docker-compose.demo.yml
) in the repository root.
TRAEFIK_PILOT_TOKEN="xxxx" docker-compose -f docker-compose.demo.yml up -d
This will launch:
admin
Kuzzle userwhoami
instance available using both admin
and developer
Kuzzle usersOnce all containers are started and healthy, you can use the Kuzzle Admin Console to create your users (admin
and developer
).
Declare it in the Traefik configuration:
YAML
pilot:
token: "xxxx"
experimental:
plugins:
traefik-kuzzle-auth:
moduleName: github.com/alexandrebouthinon/traefik-kuzzle-auth
version: v0.1.0
TOML
[pilot]
token = "xxxx"
[experimental.plugins.fail2ban]
moduleName = "github.com/alexandrebouthinon/traefik-kuzzle-auth"
version = "v0.1.0"
CLI
--pilot.token=${TRAEFIK_PILOT_TOKEN}
--experimental.plugins.traefik-kuzzle-auth.moduleName=github.com/alexandrebouthinon/traefik-kuzzle-auth
--experimental.plugins.traefik-kuzzle-auth.version=v0.1.0
YAML
middlewares:
your-well-named-middleware:
plugin:
traefik-kuzzle-auth:
customRealm: "Use a valid Kuzzle user to authenticate" # optional
kuzzle:
url: "http://localhost:7512" # required
routes: # optional
login: /_login/local
getCurrentUser: /_me # With Kuzzle v1 you must use '/users/_me'
allowedUsers: # optional
- admin
- developer
TOML
[middlewares]
[middlewares.your-well-named-middleware]
[middlewares.your-well-named-middleware.plugin]
[middlewares.your-well-named-middleware.plugin.traefik-kuzzle-auth]
customRealm = "Use a valid Kuzzle user to authenticate" # optional
[middlewares.your-well-named-middleware.plugin.traefik-kuzzle-auth.kuzzle]
url = "http://localhost:7512" # required
allowedUsers = ["admin", "developer"] # optional
[middlewares.your-well-named-middleware.plugin.traefik-kuzzle-auth.kuzzle.routes] # optional
login = "/_login/local"
getCurrentUser = "/_me" # With Kuzzle v1 you must use '/users/_me'
Docker Compose Labels
labels:
- "traefik.http.middlewares.your-well-named-middleware.plugin.traefik-kuzzle-auth.customRealm=Use a valid Kuzzle user to authenticate" # optional
- "traefik.http.middlewares.your-well-named-middleware.plugin.traefik-kuzzle-auth.kuzzle.url=http://kuzzle:7512" # required
- "traefik.http.middlewares.your-well-named-middleware.plugin.traefik-kuzzle-auth.kuzzle.routes.login=/_login/local" # optional
- "traefik.http.middlewares.your-well-named-middleware.plugin.traefik-kuzzle-auth.kuzzle.routes.getCurrentUser=/_me" # With Kuzzle v1 you must use '/users/_me' (optional)
- "traefik.http.middlewares.your-well-named-middleware.plugin.traefik-kuzzle-auth.kuzzle.allowedUsers=admin,developer" # optional
You can found a development Docker Compose file (docker-compose.dev.yml
) in the repository root.
TRAEFIK_PILOT_TOKEN="xxxx" docker-compose -f docker-compose.dev.yml up -d
This will launch:
admin
Kuzzle userwhoami
instance available using both admin
and developer
Kuzzle usersOnce all containers are started and healthy, you can use the Kuzzle Admin Console to create your users (admin
and developer
).
New ideas are welcome, feel free to fill out an issue and let’s discuss it
Kuzzle is a generic backend offering the basic building blocks common to every application.
Rather than developing the same standard features over and over again each time you create a new application, Kuzzle proposes them off the shelf, allowing you to focus on building high-level, high-value business functionalities.
Kuzzle enables you to build modern web applications and complex IoT networks in no time.