basic-authentication

What encoding should I use for HTTP Basic Authentication?

♀尐吖头ヾ 提交于 2019-11-26 13:29:08
The RFC2617 says to encode the username and password to base64 but don't say what character encoding to use when creating the octets for input into the base64 algorithm. Should I assume US-ASCII or UTF8? Or has someone settled this question somewhere already? Original spec - RFC 2617 RFC 2617 can be read as "ISO-8859-1" or "undefined". Your choice. It's known that many servers use ISO-8859-1 (like it or not) and will fail when you send something else. So probably the only safe choice is to stick to ASCII. For more information and a proposal to fix the situation, see the draft "An Encoding

HTTP Basic Auth via URL in Firefox does not work?

谁说胖子不能爱 提交于 2019-11-26 12:39:40
问题 I know that normally you can login to sites that require HTTP basic authentication with Selenium by passing the username and password in the URL, e.g.: selenium.open(\"http://myusername:myuserpassword@mydomain.com/mypath\"); I\'ve been running a Selenium test with Firefox 2 or 3 and there I still get the \"Authentication Required\" dialog window? Update: It seems not to be a Selenium problem but rather a Firefox issue. If I enter the URL manually within FF I\'ll get the authentication dialog,

Making a HTTP GET request with HTTP-Basic authentication

纵然是瞬间 提交于 2019-11-26 10:58:15
问题 I need to build a proxy for a Flash Player project I\'m working on. I simply need to make a HTTP GET request with HTTP-Basic authentication to another URL, and serve the response from PHP as if the PHP file was the original source. How can I do this? 回答1: Using file_get_contents() with a stream to specify the HTTP credentials, or use curl and the CURLOPT_USERPWD option. 回答2: Marc B did a great job of answering this question. I recently took his approach and wanted to share the resulting code.

How to prevent browser to invoke basic auth popup and handle 401 error using Jquery?

陌路散爱 提交于 2019-11-26 08:59:03
问题 I need to send authorization request using basic auth. I have successfully implemented this using jquery. However when I get 401 error basic auth browser popup is opened and jquery ajax error callback is not called. 回答1: I was facing this issue recently, too. Since you can't change the browser's default behavior of showing the popup in case of a 401 ( basic or digest authentication), there are two ways to fix this: Change the server response to not return a 401 . Return a 200 code instead and

What is the “realm” in basic authentication

我只是一个虾纸丫 提交于 2019-11-26 08:57:53
问题 I\'m setting up basic authentication on a php site and found this page on the php manual showing the set up. What does \"realm\" mean here in the header? header(\'WWW-Authenticate: Basic realm=\"My Realm\"\'); Is it the page page being requested? 回答1: From RFC 1945 (HTTP/1.0) and RFC 2617 (HTTP Authentication referenced by HTTP/1.1) The realm attribute (case-insensitive) is required for all authentication schemes which issue a challenge. The realm value (case-sensitive), in combination with

PowerShell's Invoke-RestMethod equivalent of curl -u (Basic Authentication)

大憨熊 提交于 2019-11-26 08:12:23
问题 What is the equivalent of curl -u username:password ... in PowerShell\'s Invoke-RestMethod ? I tried this: $securePwd = ConvertTo-SecureString \"password\" -AsPlainText -Force $credential = New-Object System.Management.Automation.PSCredential ($username, $securePwd) Invoke-RestMethod -Credential $credential ... but it returns 401, Unauthorized. 回答1: This is the only method that worked for me so far: $base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f

How do I get basic auth working in angularjs?

我们两清 提交于 2019-11-26 08:07:08
问题 How can I get basic auth working in AngularJs? I\'ve googled and the resources aren\'t working for me. I\'m very new to AngularJS 回答1: Assuming your html is defined like this: <!doctype html> <html ng-app="sandbox-app"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script> <script src="todo.js"></script> <link rel="stylesheet" href="todo.css"> </head> <body> <h2>Todo</h2> <div ng-controller="TodoCtrl"> <ol> ... </ol> </div> </body> </html> You can

http basic authentication “log out”

元气小坏坏 提交于 2019-11-26 08:02:44
问题 HTTP basic authentication credentials are stored until the browser is closed, but is there a way to remove the credentials before the browser is closed? I read about a trick with HTTP 401 status code, but it seems to work not properly (see comment to answer). Maybe the mechanism trac uses is the solution. Can the credentials be deleted with JavaScript? Or with a combination of JavaScript and the status 401 trick? 回答1: Update : This solution does not seem to work anymore in many browsers.

How to perform Basic Authentication for FirefoxDriver, ChromeDriver and IEdriver in Selenium WebDriver?

泪湿孤枕 提交于 2019-11-26 07:34:06
问题 I am using the Selenium-Firefox-driver and Selenium-Chrome-Driver version 2.0a5 ( Web Driver API ), and I am trying to test a web app that has BASIC authentication (there is a popup that come up to authenticate the user when I hit whatever page, the popup is not part of the HTML). Now, I need to a strategy to authenticate the user in Firefox, Chrome and IE (I\'m going to import the IE Driver soon). I was reading in few articles that I can set a Firefox profile for instance..something like:

How to clear basic authentication details in chrome

ⅰ亾dé卋堺 提交于 2019-11-26 06:54:45
问题 I\'m working on a site that uses basic authentication. Using Chrome I\'ve logged in using the basic auth. I now want to remove the basic authentication details from the browser and try a different login. How do you clear the current basic authentication details when using Chrome? 回答1: It seems chrome will always show you the login prompt if you include a username in the url e.g. http://me@example.com This is not a real full solution, see Mike's comment below. 回答2: You can open an incognito