This project is a compilation of examples of træfik configurations for the authentication.
Go the the directory of the example you want. Then use the docker command :
docker-compose up -dTo authenticate you, use the test:test credential or user:user for the forward authentication.
Now you just have to GET the http://whoami URL with the appropriate authentication method.
The actual examples are:
| Authent | Provider | Example directory |
|---|---|---|
| Forward | File + Docker | forward_auth_with_docker_label/ |
Use htpasswd to generate the user:mdp both for file and label configuration.
Use sed -e s/\\$/\\$\\$/g to escape the passwords in the labels.
Their is both users and usersFile configurations to check that all user:password are taken into account.
Use htdigest to generate the user:mdp both for file and label configuration.
Their is both users and usersFile configurations to check that all user:realm:password are taken into account.
The forward auth uses and httpd (v2.4) server as an external http auth server.
It is configured from this documentation
You can custom the configuration by overriding the httpd.conf file.
You can change the user:password by modifying .htpasswd and .htdigest files.
To create the password file
htpasswd -c .htpasswd user
# then type the passwordTo add another user:password
htpasswd .htpasswd anotherUserUse sed -e s/\\$/\\$\\$/g to escape the passwords in the labels
To create the password file
htdigest -c .htdigest user realm
# then type the passwordTo add another user:password
htdigest .htdigest anotherUser realmAdd the auth server in the /etc/hosts
sudo sh -c 'echo "10.0.1.10 auth.server" >> /etc/hosts'Then, you can make the request with the server name.
curl -u user:user -k https://auth.server:443 --cert certs/client.pem --key certs/client.key -vvv