basic-authentication

Symfony2 http_basic security rejects valid credentials

扶醉桌前 提交于 2019-11-29 06:03:41
I use Symfony Standard 2.0.0BETA1 and tried to configure http_basic authentication exactly the same as in this book chapter security: encoders: Symfony\Component\Security\Core\User\User: plaintext providers: main: users: foo: { password: testing, roles: ROLE_USER } firewalls: main: pattern: /.* http_basic: true logout: true access_control: - { path: /.*, role: ROLE_USER } Problem is when I try to open a page and i submit user name "foo" and password "testing" it simply loops and ask me for credential infinitely or display error page. Steps to reproduce issue: Copy security configuration from

How to debug urllib2 request that uses a basic authentication handler

早过忘川 提交于 2019-11-29 01:18:32
I'm making a request using urllib2 and the HTTPBasicAuthHandler like so: import urllib2 theurl = 'http://someurl.com' username = 'username' password = 'password' passman = urllib2.HTTPPasswordMgrWithDefaultRealm() passman.add_password(None, theurl, username, password) authhandler = urllib2.HTTPBasicAuthHandler(passman) opener = urllib2.build_opener(authhandler) urllib2.install_opener(opener) params = "foo=bar" response = urllib2.urlopen('http://someurl.com/somescript.cgi', params) print response.info() I'm currently getting a httplib.BadStatusLine exception when running this code. How could I

How to add basic authentication header to WebRequest [duplicate]

与世无争的帅哥 提交于 2019-11-29 01:04:37
This question already has an answer here: HttpWebRequest using Basic authentication 8 answers I have a basic WCF service and I want to test it using HttpWebRequest. The problem is that I use basic authentication. How do I add a header with basic authentication? That's my code so far: var request = (HttpWebRequest)WebRequest.Create(url); Thanks Easy. In order to add a basic authentication to your HttpRequest you do this: string username = "Your username"; string password = "Your password"; string svcCredentials = Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(username + ":" + password));

How do I use window.fetch() with httpOnly cookies or basic auth

荒凉一梦 提交于 2019-11-29 00:48:18
问题 I'm playing around with window.fetch() in Firefox and Chrome. For some reasons, fetch() doesn't send any cookies. Now that wouldn't be a problem, as I can send them using fetch('/something', { headers: { Cookie: document.cookie } }) But this won't work for httpOnly cookies. 回答1: Okay, I found out after reading on the Mozilla Developer Network a bit more and trying out the credentials option. Looks like the credentials option is what I should have looked for. fetch('/something', { credentials:

Basic Authentication with RestTemplate (3.1)

谁说胖子不能爱 提交于 2019-11-29 00:02:45
I am trying to reproduce the following curl command using Java: curl -v -u user:pass http://myapp.com/api This command returns some JSON data. My buggy Java implementation is as follows: @Test public void callTest() { RestTemplate restTemplate = createRestTemplate("user", "pass"); URI uri = new URI("http://myapp.com/api"); String res = restTemplate.getForObject(uri, String.class); } private static RestTemplate createRestTemplate(String username, String password) { UsernamePasswordCredentials cred = new UsernamePasswordCredentials(username, password); BasicCredentialsProvider cp = new

HTTPS and BASIC authentication

依然范特西╮ 提交于 2019-11-28 23:16:54
When I use HTTP BASIC authentication along with HTTPS , are the username and password securely passed to the server? I would be happy if you can help me with some references. I mean, it would be great if I can cite StackOverflow Q&A as a reference in, say, assignments, reports, exams, or even in a technical paper. But I think I am not there yet. yes. if you're using https the conversation with the web server is entirely encrypted. Yes, they are passed securely... if a hacker can decrypt your https transaction he can for sure decrypt the base64 user:password... I know the more rocks you put the

What is the cleanest way to do HTTP POST with basic auth in Python?

人走茶凉 提交于 2019-11-28 22:42:35
What is the cleanest way to do HTTP POST with Basic Auth in Python? Using only the Python core libs. Seriously, just use requests : import requests resp = requests.post(url, data={}, auth=('user', 'pass')) It's a pure python library, installing is as easy as easy_install requests or pip install requests . It has an extremely simple and easy to use API, and it fixes bugs in urllib2 so you don't have to. Don't make your life harder because of silly self-imposed requirements. user1740078 Hackish workaround works: urllib.urlopen("https://username:password@hostname/path", data) A lot of people don

JAX-WS and BASIC authentication, when user names and passwords are in a database

吃可爱长大的小学妹 提交于 2019-11-28 22:31:52
问题 I'm new to JAX-WS and there's a thing which I don't understand. There's a ton of tutorials available on how to set up JAX-WS security, but in pretty much all cases BindingProvider.USERNAME_PROPERTY and BindingProvider.PASSWORD_PROPERTY are stored in some .xml file(depending on the container I believe) - they are "hardcoded" that is. And that's what I don't get. How can I authenticate a web service client by comparing BindingProvider.USERNAME_PROPERTY and BindingProvider.PASSWORD_PROPERTY with

Converting curl cmd to jQuery $.ajax()

孤街醉人 提交于 2019-11-28 18:54:06
I'm trying to make a api call with jquery ajax, I have curl working for the api, but my ajax is throwing HTTP 500 I have a curl command working that looks like this: curl -u "username:password" -H "Content-Type: application/json" -H "Accept: application/json" -d '{"foo":"bar"}' http://www.example.com/api I tried ajax like this, but it is not working: $.ajax({ url: "http://www.example.com/api", beforeSend: function(xhr) { xhr.setRequestHeader("Authorization", "Basic " + btoa("username:password")); }, type: 'POST', dataType: 'json', contentType: 'application/json', data: {foo:"bar"}, success:

Asmx web service basic authentication

百般思念 提交于 2019-11-28 18:53:36
I want to implement basic authentication using username and password validation in my asmx web service. I don't want to use WCF and I know this is not secure way , but I need to use basic authentication without using https. My web service is like this: [WebService(Namespace = "http://www.mywebsite.com/")] public class Service1 { [WebMethod] public string HelloWorld() { return "Hello world"; } } And I use this custom HttpModule: public class BasicAuthHttpModule : IHttpModule { void IHttpModule.Init(HttpApplication context) { context.AuthenticateRequest += new EventHandler(OnAuthenticateRequest)