basic-authentication

Keeping HTTP Basic Authentification alive while being redirected

坚强是说给别人听的谎言 提交于 2019-12-01 05:26:25
We are using web service with basic authentication. It all worked all fine, till owners of web service implemented balancing service. Which is simply redirects requests to different instances of web service. The problem is that after being redirected basic authentication fails. There is "request authentication credentials was not passed" exception. Additional info: We have to create request manually. var req = (HttpWebRequest)WebRequest.CreateDefault(new Uri(Settings.Default.HpsmServiceAddress)); req.Headers.Add("Authorization", "Basic aaaaaaaaaaa"); req.PreAuthenticate = true; req

Sending Basic authentication over http

偶尔善良 提交于 2019-12-01 05:26:11
I am trying to read the source from a page that requires basic authentication. However, using a Header and even Credentials in my HttpWebRequest, I still get a Unauthorized Exception [401] returned. string urlAddress = URL; string UserName = "MyUser"; string Password = "MyPassword"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlAddress); if (UserName != string.Empty) { string encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(UserName + ":" + Password)); request.Headers.Add("Authorization", "Basic " + encoded); System.Net

why is use of “new NetworkCredential(username, password)” not working for Basic Authentication to my website (from a WinForms C# app)?

天大地大妈咪最大 提交于 2019-12-01 04:24:21
问题 I have a website that uses Basic Authentication (username/password). Why is the following code not working? When I run it the web application takes me to the login controller, whereas I'm expecting that it should already be authenticated given I'm populating the credentials. In other words I'm trying to confirm how, in .NET, I confirm my winforms HttpWebRequest so that it will automate the authentication process. I'm assumeing that NetworkCredential is the .net class that should do this? Or

Safari: “Blocked https://… from asking for credentials because it is a cross-origin request.” after updating to Angular 8

穿精又带淫゛_ 提交于 2019-12-01 04:21:44
问题 We have secured our Angular web app with Basic Auth. After updating our app from Angular 7 to 8.0 , we are no longer asked for the credentials in Safari and the following errors appear in the console: [Error] Blocked https://*/runtime-es2015.4f263ec725bc7710f1f5.js from asking for credentials because it is a cross-origin request. [Error] Blocked https://*/main-es2015.6fa442dd5c5a204f47da.js from asking for credentials because it is a cross-origin request. [Error] Blocked https://*/polyfills

Why do browsers not send the Authentication header when the credentials are provided in the URL?

▼魔方 西西 提交于 2019-12-01 04:19:46
I would like to give users the opportunity to do a per-request-authentication by providing the username and password in the URL. As the request is secure, I have no concerns on that. I tried to call the request http://user:password@localhost/ using a usual browser, (Firefox, Chrome, Safari and Opera was the ones I tested) and I got a 401 response back. When I tried the same URI, but this time provided the credentials as HTTP-header like Authentication: Basic dXNlcjpwYXNzd29yZA== , it worked. When searching for that, I found this answer to another question: https://serverfault.com/questions

BasicAuthentication in android for webview not working

若如初见. 提交于 2019-12-01 03:59:09
Hi I want to open this url http://3864.cloud-matic.net/ from my android webview and I have tried many ways but the app even not opens mainActivity. What I have tried is below. public void onCreate(Bundle state) { super.onCreate(state); setContentView(R.layout.main); WebView webView = (WebView) findViewById(R.id.webView1); webView.setHttpAuthUsernamePassword("cloud-matic.net/", "realm", username, password); webView.loadUrl("http://3864.cloud-matic.net/"); } Please give me idea where I am wrong. Ali Ali webview.setWebViewClient(new MyWebViewClient ()); private class MyWebViewClient extends

JavaScript redirect URL with Authorization header

青春壹個敷衍的年華 提交于 2019-12-01 03:12:16
I managed to successfully invoke a URL behind a directory in Apache that is protected with Basic Authentication (htpasswd, etc.). The Ajax GET request works normally and returns the protected content: var encoded = Base64.encode(username + ':' + password); $.ajax({ url: "/app/test", type: "GET", beforeSend: function(xhr) { xhr.setRequestHeader('Authorization', 'Basic ' + encoded); }, success: function() { window.location.href = '/app/test.html'; } }); My original assumption was that once the web session had successfully authorized a request, it would make possible the redirection in the

Basic Authentication with PHP gives an endless loop

試著忘記壹切 提交于 2019-12-01 01:25:33
问题 For some reason I can't get Basic Authentication to work using PHP on my server. I am using the exact code from the manual page: <?php if (!isset($_SERVER['PHP_AUTH_USER'])) { header('WWW-Authenticate: Basic realm="My Realm"'); header('HTTP/1.0 401 Unauthorized'); echo 'Text to send if user hits Cancel button'; exit; } else { echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>"; echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>"; } ?> However, when I run it, I can never get

Why do browsers not send the Authentication header when the credentials are provided in the URL?

瘦欲@ 提交于 2019-12-01 01:18:55
问题 I would like to give users the opportunity to do a per-request-authentication by providing the username and password in the URL. As the request is secure, I have no concerns on that. I tried to call the request http://user:password@localhost/ using a usual browser, (Firefox, Chrome, Safari and Opera was the ones I tested) and I got a 401 response back. When I tried the same URI, but this time provided the credentials as HTTP-header like Authentication: Basic dXNlcjpwYXNzd29yZA== , it worked.

Logging out with HTTP Basic Auth in Laravel

僤鯓⒐⒋嵵緔 提交于 2019-12-01 00:58:26
问题 I have one user class which consists of two types of users and want to allow different users to go to different pages. I have created a filter as follows Route::filter('isExpert', function() { $userIsExpert = 0; $userIsLoggedIn = Auth::check(); if ($userIsLoggedIn && Auth::user()->role == 'expert') { $userIsExpert = 1; } Log::info('Logged in: ' . $userIsLoggedIn . ' && Expert: ' . $userIsExpert); if ($userIsExpert == 0) { Log::info('should be logging out now.'); Auth::logout(); return Auth: