http-authentication

How can I get the authenticated user name under Apache using plain HTTP authentication and PHP?

跟風遠走 提交于 2019-12-03 08:04:32
问题 First, let's get the security considerations out of the way. I'm using simple authentication under Apache for a one-off, internal use only, non-internet connected LAN, PHP web app. How can get I the HTTP authenticated user name in PHP? 回答1: I think that you are after this $username = $_SERVER['PHP_AUTH_USER']; $password = $_SERVER['PHP_AUTH_PW']; 来源: https://stackoverflow.com/questions/1417/how-can-i-get-the-authenticated-user-name-under-apache-using-plain-http-authenti

Do HTTP authentication over HTTPS with URL rewriting

倖福魔咒の 提交于 2019-12-03 07:15:29
I am trying to protect the ~/public_html/dev directory using http auth basic, but to make that secure I want to run it over ssl. The middle section of the below .htaccess file switches to https if the request URI begins with /dev and works. The last section of the file works as well but does not work properly with the https redirect. I basically want to be able to type http://www.example.com/dev/some_sub_dir/ and be redirected to https://www.example.com/dev/some_sub_dir/ and prompted for the http auth username and password. What currently happens is if I go to http://www.example.com/dev/some

Rails: Accessing the username/password used for HTTP Basic Auth?

此生再无相见时 提交于 2019-12-03 06:59:23
问题 I'm building a basic API where user information can be retrieved after that user's login and password are correctly sent. Right now I'm using something like this: http://foo:bar@example.com/api/user.xml So, what I need to do is access the user/password sent in the request (the foo and bar ) but am not sure how to access that info in a Rails controller. Then I'd check those variables via a quick User.find and then set those as the username and password variables for authenticate_or_request

Avoid HTTP auth popup in a chrome extension (digest)

℡╲_俬逩灬. 提交于 2019-12-03 06:01:23
问题 I'm currently developing a chrome extension, I need to access some http-auth protected resources (webdav). The HTTP auth is using (in the best case) a digest authentication. I'm able to do the auth directly in the ajax request using the https://login:password@domain.tld/path/to/ressource form. The issue is : if the login/password is wrong, I can't just get a 401 status (unauthorized), Chrome pops up the regular authentication dialog. Which I don't want cause it's confusing for user and I can

What is the delimiter for WWW-Authenticate for multiple schemes?

ⅰ亾dé卋堺 提交于 2019-12-03 04:34:46
I've read through RFC 2617 and can't find there or anywhere else what the delimiter is if multiple schemes are supported. For example, suppose both Basic and Digest are supported. I understand that it may appear this way: HTTP/1.1 401 Unauthorized WWW-Authenticate: Basic WWW-Authenticate: Digest But I've also read that both can be listed as one line, but no one ever shows an example or describes what delimiter to use. I've seen cautions that commas can be used within a single scheme: HTTP/1.1 401 Unauthorized WWW-Authenticate: Digest param1="foo", param2="bar" I've also read that if commas are

How does http://user:pass@host.com authentication work?

a 夏天 提交于 2019-12-01 03:48:32
问题 Can anyone explain how http://user:pass@host.com authentication works? Does the browser send the Authorization header with user:pass being base-64 encoded? I opened the Net console in Chrome developer tools and when I do request such as http://user:pass@stackoverflow.com I do not see Authorization header being added. I am really curious to how the browser sends the password in case I use user:pass@ in front of a URL. 回答1: To inspect headers, you need to test against a server that requires

Using HTTP authentication with libcurl in C for Twitter Streaming [duplicate]

左心房为你撑大大i 提交于 2019-12-01 01:04:49
Possible Duplicate: Trying to Access Twitter Streaming API with C I am not sure what I am doing wrong in my code but it seems there's a problem on authentication. Every time I execute the code there is no output. My goal here is I wanted to receive a stream of Tweets from Twitter API. The problem might be something else. But I am not sure. Please help. This is the C code: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <curl/curl.h> struct string { char *ptr; size_t len; }; void init_string(struct string *s) { s->len = 0; s->ptr = malloc(s->len+1); if (s->ptr == NULL) {

How to show an image which is secured by http authentication

痞子三分冷 提交于 2019-11-30 21:39:18
How can i show an image from a server with standard http protection without showing the authentication window? I now use standard html <img src="..."> but because the image is protected this asks for an authentication window. I do have the login data, how can i show the image? Regards, Tom. This should work. Simply replace the username and password with your authentication details. (Warning: Doesn't work in all browsers) <img src="http://username:password@server/Path" /> I would recommend putting this in a separate file on your server. That way you can reference it without exposing the

Spring Rest Service - Invalid CSRF token when I attempt to login

北城余情 提交于 2019-11-30 20:19:31
I have a Spring MVC REST service, with Spring Security (3.2.5.RELEASE) enabled. When I turn on @EnableWebMvcSecurity, a login form is automatically generated for me at http://localhost:8080/login . If I use this form to login, everything works just fine. The problem occurs when I attempt to login by sending a POST request directly. In my post request, I provide the username and password. I also include the http header 'X-CSRF-TOKEN' and for the header value, I use the JSESSIONID that I see has been generated in a cookie. But when I send this POST request, I get back the following result: HTTP

Using HTTP authentication with libcurl in C for Twitter Streaming [duplicate]

痞子三分冷 提交于 2019-11-30 19:23:28
问题 This question already has an answer here : Closed 8 years ago . Possible Duplicate: Trying to Access Twitter Streaming API with C I am not sure what I am doing wrong in my code but it seems there's a problem on authentication. Every time I execute the code there is no output. My goal here is I wanted to receive a stream of Tweets from Twitter API. The problem might be something else. But I am not sure. Please help. This is the C code: #include <stdio.h> #include <stdlib.h> #include <string.h>