<p>My university doesn't support the POST cgi method (I know, it's crazy), and I was hoping to be able to have a system where a user can have a username and password and log in securely. Is this even possible?</p>

<p>If it's not, how would you do it with POST? Just out of curiosity.</p>

<p>Cheers!</p>

[{'answer_id': 69989, 'author': 'Vinko Vrsalovic', 'author_id': 5190, 'author_profile': 'https://Stackoverflow.com/users/5190', 'pm_score': 1, 'selected': False, 'text': "<p>You could use HTTP Authentication, if supported.</p>\n\n<p>You'd have to add SSL, as all methods, POST, GET and HTTP Auth (well, except Digest HHTP authentication) send plaintext.</p>\n\n<p>GET is basically just like POST, it just has a limit on the amount of data you can send which is usually a lot smaller than POST and a semantic difference which makes GET not a good candidate from that point of view, even if technically they both can do it.</p>\n\n<p>As for examples, what are you using? There are many choices in Python, like the cgi module or some framework like Django, CherryPy, and so on</p>\n"}, {'answer_id': 69995, 'author': 'DJ Capelis', 'author_id': 10943, 'author_profile': 'https://Stackoverflow.com/users/10943', 'pm_score': 4, 'selected': True, 'text': "<p>You can actually do it all with GET methods.  However, you'll want to use a full challenge response protocol for the logins.  (You can hash on the client side using javascript.  You just need to send out a unique challenge each time.)  You'll also want to use SSL to ensure that no one can see the strings as they go across.</p>\n\n<p>In some senses there's no real security difference between GET and POST requests as they both go across in plaintext, in other senses and in practice... GET is are a hell of a lot easier to intercept and is all over most people's logs and your web browser's history. :)</p>\n\n<p>(Or as suggested by the other posters, use a different method entirely like HTTP auth, digest auth or some higher level authentication scheme like AD, LDAP, kerberos or shib.  However I kinda assumed that if you didn't have POST you wouldn't have these either.)</p>\n"}, {'answer_id': 70003, 'author': 'deemer', 'author_id': 11192, 'author_profile': 'https://Stackoverflow.com/users/11192', 'pm_score': 0, 'selected': False, 'text': '<p>With a bit of JavaScript, you could have the client hash the entered password and a server-generated nonce, and use that in an HTTP GET.</p>\n'}, {'answer_id': 70025, 'author': 'Sev', 'author_id': 83819, 'author_profile': 'https://Stackoverflow.com/users/83819', 'pm_score': -1, 'selected': False, 'text': '<p>Logging in securely is very subjective.  Full \'security\' is not easy to achieve (if at all possible...debatable). However, you can come close.  </p>\n\n<p>If POST is not an option, maybe you can use a directory security method such as .htaccess or windows authentication depending on what system you\'re on.</p>\n\n<p>Both of the above will get you the pop-up window that allows for a username and password to be entered.</p>\n\n<p>To use POST as the method to send the login credentials, you\'d just use an HTML form with method="post" and retrieve the information from, say, a PHP or ASP page, using the $_POST[\'varname\'] method in PHP or the request.form("varname") method in ASP.  From the PHP or ASP page, as an example, you can do a lookup in a database of users, to see if that username/password combination exists, and if so, redirect them to the appropriate page.</p>\n\n<p>As reference, use <a href="http://www.w3schools.com/ASP/showasp.asp?filename=demo_simpleform" rel="nofollow noreferrer">http://www.w3schools.com/ASP/showasp.asp?filename=demo_simpleform</a> for the HTML/ASP portion</p>\n'}, {'answer_id': 70145, 'author': 'micahwittman', 'author_id': 11181, 'author_profile': 'https://Stackoverflow.com/users/11181', 'pm_score': 0, 'selected': False, 'text': '<p>A good choice: <a href="http://advosys.ca/viewpoints/2006/08/http-digest-authentication/" rel="nofollow noreferrer">HTTP Digest authentication</a></p>\n\n<p>Harder to pull off well, but an option: <a href="http://blog.paranoidferret.com/index.php/2007/07/22/secure-authentication-without-ssl-using-javascript/" rel="nofollow noreferrer">Client-side hashing with Javascript</a></p>\n'}, {'answer_id': 204152, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>Javascript is the best option in this case.</p>\n\n<p>Along with the request for the username and password, it sends a unique random string. You can then use a javascript md5 library to generate a hashed password, by combining the random string and the password [pwhash = md5(randomstring+password)].  The javascript then instantiates the call to <em><a href="http://SERVER/login.cgi?username=TheUsername&amp;random=RANDOMSTRING&amp;pwhash=0123456789abcdef0123456789abcdef" rel="nofollow noreferrer">http://SERVER/login.cgi?username=TheUsername&amp;random=RANDOMSTRING&amp;pwhash=0123456789abcdef0123456789abcdef</a></em></p>\n\n<p>The server must then do two things:\n  Check if the random string has EVER been used before, and it if has, deny the request. (<strong>very important</strong> for security)</p>\n\n<p>Lookup the plaintext password for username, and do md5(randomstring+password). If that matches what the user supplied in the URL as a pwhash, then you know it\'s the user.</p>\n\n<p>The reason you check if the random string has ever been used before is to stop a repeat attack.  If somebody is able to see the network traffic or the browser history or logs, then they could simply log in again using the same URL, and it doesn\'t matter whether they know the original password or not.</p>\n\n<p>I also recommend putting "Pragma: no-cache" and "Cache-Control: no-cache" at the top of the headers returned by the CGI script, just so that the authenticated session is not stored in the browser\'s or your ISPs web cache.</p>\n\n<p>An even more secure solution would be using proper encryption and Challenge-Response. You tell the server your username, the server sends back a Challenge (some random string encrypted with your password), and you tell the server what the random string was.  If you\'re able to tell the server, then obviously you have the password and are who you say you are!  Kerberos does it this way, but quite a lot more carefully to prevent all sorts of attacks.</p>\n'}]
['https://Stackoverflow.com/questions/69979', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/11324/']