-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Currently in order to retrieve a IP address you need both the username and password. With the username and password you can also change the IP address. This would be unnecessary access if you just wanted to share a home IP with a friend (Who might accidentally do a curl post and clobber the IP).
I suggest that during a get request if a username is in a URL parameter (e.g https://d5.example.com/servername) then the server will return the IP address of "servername". POST and DELETE handlers will ignore the parameter and reject requests without the Authorization header.
One unintended benefit is that you could retrieve IP address with just a browser because you just need a URL without any extra headers. You could not use a browser before because you needed the Authorization header set when you send the request.
Do you think this would be a valuable feature?
Implementation
Instead of HashMap<UsernamePasswordHash, IPAddr> I would make it HashMap<Username, (Password, IPAddr)>. It would be require each endpoint to decode the base64 Basic Auth to get username and password. Thankfully the base64 crate is already included so no new dependencies will be added.