timetagger_cli icon indicating copy to clipboard operation
timetagger_cli copied to clipboard

Add support for HTTP Basic authentication

Open arogge opened this issue 1 year ago • 1 comments

We run timetagger locally hosted with LDAP authentication. This produces the (probably rather unusual) requirement to authenticate to the reverse-proxy using the LDAP credentials before we can access the API. For this I added support for that using two new configuration options auth_username and auth_password.

This code currently works for me.

However, I'm unsure where to advertise that feature (i.e. whether to put it in the sample configuration). Also, I don't think it should be too obvious, because we probably don't want people to configure username/password unless they really need that (after all, you're putting a cleartext password into the configuration) Maybe we could emit a helpful error when we get an HTTP 401 and not mention it otherwise?

Another thing I noticed is, that maybe I should add a check that either both or none of the parameters are set when we load the config.

Any guidance, hints and suggestions are very welcome!

arogge avatar Nov 25 '24 09:11 arogge

Cool!

Would be nice to add dummy variables in the initial_config_text in config.py. plus a comment that explains their use. That should probably enough for people who need it to find it.

I think the code should not only check for presence, but only of it being non-empty. Maybe call them basic_auth_username to be explicit and maybe enable other auth later.

almarklein avatar Dec 11 '24 11:12 almarklein