basic-authentication

Using Basic Authentication (htaccess) to restrict access to a specific URL

不打扰是莪最后的温柔 提交于 2019-12-08 17:26:33
问题 I need to restrict access to a particular URL, e.g. http://mydomain.com/this/is/the/url on my webserver using Basic Authentication through Apache. Any other URL should be openly accessible. I have seen that you can add specific rules to files using: <Files "mypage.html"> Require valid-user </Files> My problem is that all requests are routed to controllers using mod-rewrite and so I don't think that I can restrict access based on the file. Any ideas would be most helpful! 回答1: In .htacess file

Laravel 4 Basic Auth custom error

心已入冬 提交于 2019-12-08 14:02:26
I'm using the 'HTTP Basic Authentication' feature of laravel. I want to customize the error message which is generated from laravel if the entered credentials are wrong. Is it possible to catch the 401 Error which is generated when HTTP Auth fails? Hope you can help me. Regards Basic Auth Try to capture 401 error and return cusom view?! App::error(function($exception, $code) { switch ($code) { case 401: return Response::view('errors.403', array(), 401); case 403: return Response::view('errors.403', array(), 403); case 404: return Response::view('errors.404', array(), 404); case 500: return

Spring Boot web app w/ both session + CSRF & stateless Basic Auth w/o CSRF

▼魔方 西西 提交于 2019-12-08 13:48:44
问题 I'm trying to stand up a Spring Boot based web server that supports both a secured session-based UI, including CSRF protection and stateless access that is authenticated via basic auth and does not require CSRF. The two use cases I'm trying to support are a standard AngularJS UI and a simple REST api that authenticates on every request. Does anyone know how to configure this? I've seen lots of examples of using one or the other, but not both together. 回答1: So I finally got back to looking

HTTPS Basic authentication

不羁岁月 提交于 2019-12-08 13:45:35
问题 I try to authenticate user with username and password But in the didReceiveAuthenticationChallenge method it doesn't go to an else even if i put a wrong username or password. Here is my code: - (IBAction)clickOK:(id)sender { if ([[usernameField text] length] < 1 || [[passwordField text] length] < 1) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Login" message:@"Neither the username nor password may be empty!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert

How to POST to Vitalist.com's API via Powershell?

不羁岁月 提交于 2019-12-08 12:25:24
问题 I'd liketo use Powershell to post a new action to my Vitalist.com account. The Vitalist API documentation is here. I've tried HttpWebResponse in Powershell but I'm missing something. Any pointers are appreciated. Thanks. 回答1: I don't know anything about Vitalis, but to execute HTTP POST you can use this function: function Execute-HttpPost { param( [string] $url = $null, [string] $data = $null, [System.Net.NetworkCredential]$credentials = $null, [string] $contentType = "application/x-www-form

C# WebClient HTTP Basic Authentication Failing 401 with Correct Credentials

百般思念 提交于 2019-12-08 10:50:34
I'm trying to automate configuring a wireless router's SSID and Password via c# webclient . The router has no API that I know of. It's an unbranded chinese router. The web config seems to be the only option for configuration. It uses http-basic-authentication (you browse to the IP address of the router and get a generic dialog asking for username and password). I've used Wireshark to get the headers and form fields that the http-post requests use when I manually update the SSID and Password (two separate forms). I then attempted to use webclient to emulate those post requests. Here is a

HowTo: AngularJS Basic Auth + cookie to a REST API server?

拥有回忆 提交于 2019-12-08 10:28:21
问题 I'd like to handle Basic Auth with AngularJS the right way. I'm pretty sure the answer is somewhere on SO, but I didn't find it. It seems that everyone has particular need about authentication and I'm confused. Note that I have no particular knowledge about authentication so sorry for dummy questions. The case A REST API on a Django server that handles HTTP Basic Auth (The server) An AngularJS application embedded in Cordova/Phonegap to be used in smartphones (The client(s)) The client logs

Android: Store HTTP Basic password/username

与世无争的帅哥 提交于 2019-12-08 09:39:38
问题 I have a simple RESTful backend and I am using HTTP Basic over HTTPS for authentication. It works fine, but I am looking for a appropriate solution to store the credentials (username + password). There are a lot of examples out there and the majority suggest to use the Account Manager to store passwords. AFAIK the account manager stores only OAUTH (and similar) accounts and automatically generates tokens etc. But how can I use it to store and fetch the original passwords? Is it even possible?

AFNetworking: How/when to prompt for username and password for BASIC Auth?

谁都会走 提交于 2019-12-08 09:01:50
问题 I'm looking for a best-practice about prompting the user for credentials. I have to code for the possibility that after the user logs in from the phone, he/she could login from another device or webpage and change the password. Since I'm doing BASIC auth, that token will now be incorrect and I need to handle it appropriately. I've started a new project with AFNetworking. I have subclassed AFHTTPClient and I've overridden the HTTPRequestOperationWithRequest message to set a authentication

Accessing Username and Password in django request header returns None

喜欢而已 提交于 2019-12-08 08:08:15
问题 I'm creating a view which is expected to be accessed by a bot passing a username and password in the header. (It's a google feed bot to be specific). However, I can never seem to access the username and password to authenticate the bot's credentials. request.GET.get('username') and request.GET.get('password') both return None since both request.GET and request.POST return empty QueryDicts. I am using Postman with basic authentication to test my requests. Here is my code from views.py : def