http-authentication

Using Basic HTTP access authentication in Django testing framework

和自甴很熟 提交于 2019-11-28 19:33:49
问题 For some of my Django views I've created a decorator that performs Basic HTTP access authentication. However, while writing test cases in Django, it took me a while to work out how to authenticate to the view. Here's how I did it. I hope somebody finds this useful. 回答1: Here's how I did it: from django.test import Client import base64 auth_headers = { 'HTTP_AUTHORIZATION': 'Basic ' + base64.b64encode('username:password'), } c = Client() response = c.get('/my-protected-url/', **auth_headers)

GreaseMonkey script to auto login using HTTP authentication

假装没事ソ 提交于 2019-11-28 19:01:30
I've got quite a few GreaseMonkey scripts that I wrote at my work which automatically log me into the internal sites we have here. I've managed to write a script for nearly each one of these sites except for our time sheet application, which uses HTTP authentication. Is there a way I can use GreaseMonkey to log me into this site automatically? Edit: I am aware of the store password functionality in browsers, but my scripts go a step further by checking if I'm logged into the site when it loads (by traversing HTML) and then submitting a post to the login page. This removes the step of having to

JQuery Ajax calls with HTTP Basic Authentication

霸气de小男生 提交于 2019-11-28 17:52:05
I have a REST based server which I am trying to communicate with using JQuery. Both XML and JSON are available as response formats, so I am using JSON. The connections are all SSL so HTTP Basic Authentication has been our authorization method of choice, and we have had no problems with other front ends (raw Javascript, Silverlight, etc...) Now I am attempting to put something together with JQuery and having endless problems using HTTP Basic Authentication. I have scoured through numerous previous questions most of which either have solutions that do not seem to actually work or blame the

AFNetworking 2.0 and HTTP Basic Authentication

十年热恋 提交于 2019-11-28 15:43:31
Can't find AFHTTPClient on AFNetworking 2.0, to use: AFHTTPClient *client = [AFHTTPClient clientWithBaseURL:[NSURL URLWithString:@"http://examplewebsite.com]]; [client setAuthorizationHeaderWithUsername:@"username" password:@"password"]; How it needs to be manage on AFNetworking 2.0? Leguman AFNetworking 2.0 new architecture use serializers for creating requests and parsing responses. In order to set the authorization header, you should first initialize a request operation manager that replaces the AFHTTPClient, create a serializer and then call the dedicated method to set the header. For

HTTP authentication between devise and iphone app

你。 提交于 2019-11-28 15:15:18
I'm new to ruby on rails but I want to send the data from my SQlite database from my iphone app to the rails web app. Like a "sync" service. I'm using devise for authentication for the web app. I enabled basic HTTP authentication and I can curl into the website for xml or json data. I can also upload data to the website when I set the post headers to JSON and with username and password. Here's where I'm stuck. 1) How do I keep the user signed in after the 1st login? Do I use http authentication every time I send data to the website? I've read about token authentication but I'm not sure how to

Accessing a web service and a HTTP interface using certificate authentication

China☆狼群 提交于 2019-11-28 10:06:30
It is the first time I have to use certificate authentication. A commercial partner expose two services, a XML Web Service and a HTTP service. I have to access both of them with .NET clients. What I have tried 0. Setting up the environment I have installed the SSLCACertificates (on root and two intermediate) and the client certificate in my local machine (win 7 professional) using certmgr.exe. 1. For the web service I have the client certificate (der). The service will be consumed via a .NET proxy. Here's the code: OrderWSService proxy = new OrderWSService(); string CertFile = "ClientCert_DER

HTTP Digest Authentication versus SSL

不羁的心 提交于 2019-11-28 08:09:54
What is the difference between HTTP Digest Authentication and SSL from a performance, security and flexibility point of view? The pros and cons of HTTP Digest Authentication are explained quite clearly in the Wikipedia article on the topic -- you should read that! To put it bluntly: HTTP Digest Auth will only protect you from losing your cleartext password to an attacker (and considering the state of MD5 security, maybe not even that). It is however wide open to Man-in-the-Middle attacks and also -- depending on the implementation, since most of the advanced features are optional -- replay,

IIS7 and Authentication problems

大城市里の小女人 提交于 2019-11-28 04:11:37
问题 i've got a stock standard ASP.NET web site, deployed to our development machine (internal machine in our server room). Now, this dev site can be accessed by both INTERNAL and EXTERNAL users. Now, in IIS6 we used to have it so that Anonymous Authentication was turned off and something else was turned on .. giving the users a popup model box for username and password. I think they had to type some username or password that was defined in a web.config file? (not their website account username

Rails/Rspec Make tests pass with http basic authentication

假装没事ソ 提交于 2019-11-28 03:22:41
Here my http basic authentication in the application controller file (application_controller.rb) before_filter :authenticate protected def authenticate authenticate_or_request_with_http_basic do |username, password| username == "username" && password == "password" end end and the default test for the index action of my home controller (spec/controllers/home_controller_spec.rb) require 'spec_helper' describe HomeController do describe "GET 'index'" do it "should be successful" do get 'index' response.should be_success end end Test doesn't run because of the authentication method. I could

AFNetworking 2.0 and HTTP Basic Authentication

旧时模样 提交于 2019-11-27 19:51:12
问题 Can't find AFHTTPClient on AFNetworking 2.0, to use: AFHTTPClient *client = [AFHTTPClient clientWithBaseURL:[NSURL URLWithString:@"http://examplewebsite.com]]; [client setAuthorizationHeaderWithUsername:@"username" password:@"password"]; How it needs to be manage on AFNetworking 2.0? 回答1: AFNetworking 2.0 new architecture use serializers for creating requests and parsing responses. In order to set the authorization header, you should first initialize a request operation manager that replaces