{"id":26,"date":"2007-01-20T14:37:13","date_gmt":"2006-07-25T05:55:02","guid":{"rendered":""},"modified":"2017-03-07T16:22:45","modified_gmt":"2017-03-07T16:22:45","slug":"how_to_authenticate","status":"publish","type":"post","link":"https:\/\/blogs.gentoo.org\/genone\/2007\/01\/20\/how_to_authenticate\/","title":{"rendered":"how to authenticate"},"content":{"rendered":"<p>So now I&#8217;m at the point where I need to work on the authentication part for the stats server code, and I noticed that my plan to use http digest authentication doesn&#8217;t work as that requires to store the plaintext password of clients on the server which I&#8217;d like to avoid (generally one should only store a hash of the passwords in the authentication backend).<br \/>\nBefore going into alternatives let me list a few requirements I have for them:<br \/>\n&#8211; don&#8217;t require the real password in the auth backend<br \/>\n&#8211; don&#8217;t transmit the real password unsecured over the network<br \/>\n&#8211; must work with only http headers, don&#8217;t touch the body in any way<br \/>\n&#8211; must be easily scriptable<br \/>\n&#8211; preemptive authorization (e.g. send the auth data with the first request)<br \/>\n&#8211; should work within a webbrowser<br \/>\nSo, what options do I have now? Well, I can&#8217;t see a single alternative that fits all requirements (if you know one let me know), the closest is http basic auth, but I really don&#8217;t want to send the password over network as almost-plaintext. This lead me to the idea of extending it with gpg-encrypting the password, but that&#8217;s not transparent when you use the browser (not that important for the current use case) and more importantly gpg adds about 600 bytes of protocol overhead for encrypted data (without using &#8211;armor), with the base64 encoding required for http that&#8217;s almost one kilobyte just for a password that originally only had a few bytes.<br \/>\nSo, right now I have to select between a rather hackish, inefficient and untested but secure solution and a well-tested, relatively efficient and well-specified but insecure one. What would people prefer here?<br \/>\nOr does anyone know another solution to the problem that satisfies the above requirements? (the first four are hard requirements, the other two I could work around)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So now I&#8217;m at the point where I need to work on the authentication part for the stats server code, and I noticed that my plan to use http digest authentication doesn&#8217;t work as that requires to store the plaintext password of clients on the server which I&#8217;d like to avoid (generally one should only &hellip; <a href=\"https:\/\/blogs.gentoo.org\/genone\/2007\/01\/20\/how_to_authenticate\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">how to authenticate<\/span><\/a><\/p>\n","protected":false},"author":46,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,8],"tags":[],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/blogs.gentoo.org\/genone\/wp-json\/wp\/v2\/posts\/26"}],"collection":[{"href":"https:\/\/blogs.gentoo.org\/genone\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.gentoo.org\/genone\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/genone\/wp-json\/wp\/v2\/users\/46"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.gentoo.org\/genone\/wp-json\/wp\/v2\/comments?post=26"}],"version-history":[{"count":1,"href":"https:\/\/blogs.gentoo.org\/genone\/wp-json\/wp\/v2\/posts\/26\/revisions"}],"predecessor-version":[{"id":48,"href":"https:\/\/blogs.gentoo.org\/genone\/wp-json\/wp\/v2\/posts\/26\/revisions\/48"}],"wp:attachment":[{"href":"https:\/\/blogs.gentoo.org\/genone\/wp-json\/wp\/v2\/media?parent=26"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/genone\/wp-json\/wp\/v2\/categories?post=26"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.gentoo.org\/genone\/wp-json\/wp\/v2\/tags?post=26"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}