How to get IIS basic authentication working with WampServer
Posted by: randy.klepetko@sbcglobal.net (---.lightspeed.snantx.sbcglobal.net)
Date: September 21, 2015 07:05PM

I am trying to use basic authentication within the url (https://username:password@domain.com) for soap posts between servers. When I have two LAMP servers, everything works great. When I attempt a post from a wamp server to a lamp server, the authentication variables are missing and I get an authentication error.

I've tracked it down to something IIS on my windows 7 WampServer is doing/not doing, but can't figure out how to fix it. I have IIS running and basic authentication enabled. Any assistance is appreciated.

Options: ReplyQuote
Re: How to get IIS basic authentication working with WampServer
Posted by: RiggsFolly (---.as43234.net)
Date: September 22, 2015 12:00PM

This is not really a IIS or LAMP speciality help forum.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: How to get IIS basic authentication working with WampServer
Posted by: randy.klepetko@sbcglobal.net (---.lightspeed.snantx.sbcglobal.net)
Date: September 22, 2015 05:00PM

But it's the WAMP server that isn't working. It isn't passing the authorization parameters (username:password).

Options: ReplyQuote
Re: How to get IIS basic authentication working with WampServer
Posted by: Otomatic (Moderator)
Date: September 22, 2015 05:12PM

Hi,

>But it's the WAMP server that isn't working
It is not working because you use IIS on the same machine.

Please, answer to : READ BEFORE YOU ASK A QUESTION

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: How to get IIS basic authentication working with WampServer
Posted by: randy.klepetko@sbcglobal.net (---.lightspeed.snantx.sbcglobal.net)
Date: September 22, 2015 08:43PM

Please, I've been reading and looking for this answer for days, and I can't find anything so I'm asking.

I have very functional PHP code REST ap (both client post and server receive) that uses basic authentication. Tested and proved on LAMP servers.

When I try to use the code my development WAMP server, the authentication fails both directions because the $_SERVER global set are missing all of the PHP_AUTH_* parameters.

If it is IIS, what should I use instead? Or are there configuration changes to make it work.

I have the following modules enabled in Apache, are they the right ones:
access_compat_module
actions_module
alias_module
allowmethods_module
asis_module
auth_basic_module
authn_core_module
authn_file_module
authz_core_module
authz_groupfile_module
authz_host_module
authz_user_module
autoindex_module
cache_module
cache_disk_module
deflate_module
dir_module
env_module
file_cache_module
headers_module
include_module
isapi_module
ldap_module
log_config_module
mime_module
negotiation_module
rewrite_module
session_module
session_cookie_module
setenvif_module
ssl_module
vhost_alias_module
auth_form_module

When I use the php_sapi_name() command I get the following response: apache2handler

Any help is appreciated, Thanks

Options: ReplyQuote
Re: How to get IIS basic authentication working with WampServer
Posted by: Otomatic (Moderator)
Date: September 23, 2015 03:09PM

Hi,

- 1 - You did not answer to READ BEFORE YOU ASK A QUESTION

- 2 - $_SERVER['PHP_AUTH_*']

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: How to get IIS basic authentication working with WampServer
Posted by: randy.klepetko@sbcglobal.net (---.lightspeed.snantx.sbcglobal.net)
Date: September 23, 2015 04:19PM

Windows 7 Professional SP1 32 Bit
WampServer Version 2.5
Apache 2.4.9
PHP 5.5.12
MySQL 5.6.17

WAMP installs fine and comes up green and I have no errors, just all outgoing and incoming authorization calls fail when using url basic authentication.

PHP_AUTH_* means all of the global authorization server variables are missing: PHP_AUTH_USER, PHP_AUTH_PASSWORD, etc...

The only errors I find are those that relate to the authorization server variables missing.

Options: ReplyQuote
Re: How to get IIS basic authentication working with WampServer
Posted by: randy.klepetko@sbcglobal.net (---.lightspeed.snantx.sbcglobal.net)
Date: September 23, 2015 04:26PM

Questions 8&9:
I can bring up the homepage, phpMyAdmin, phpinfo, and the REST ap is contained within a cakePHP 3 foundation where the web pages work great (including mod_rewrite, .htacces, etc.)

The only issue is when I use url authentication for all calls (username:password@domain.com) the wampsever is stripping the credentials out of the url, and not adding is the are set as curl options.

Options: ReplyQuote
Re: How to get IIS basic authentication working with WampServer
Posted by: RiggsFolly (---.as43234.net)
Date: September 24, 2015 11:00AM

Randy,

I just tested an unchanged WAMPServer 2.5 installation using this PHP script

<?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>";
}
?>

Borrowed straight from the PHP online manual

All it does is echo back what you enter as a Userid & Password on the URL line but it proves that the $_SERVER variables are in fact set.

I did note that if I call this script without the `http://` at the beginnning of the url, then it does not work, could that be your problem?

So this does not work

AAAAAA:BBBBBBB@testing.dev/http-auth.php

But this does work. (without the single quotes, they are just to stop the forum converting the url)

'http://AAAAAA:BBBBBBB@testing.dev/http-auth.php'

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: How to get IIS basic authentication working with WampServer
Posted by: randy.klepetko@sbcglobal.net (---.lightspeed.snantx.sbcglobal.net)
Date: September 24, 2015 04:34PM

OK, I'll try a fresh install and see what happens.

Options: ReplyQuote
Re: How to get IIS basic authentication working with WampServer
Posted by: Otomatic (Moderator)
Date: September 24, 2015 04:41PM

Hi,

> OK, I'll try a fresh install and see what happens.

You did not bother to go to the link I gave in - 2 -
- 2 - $_SERVER['PHP_AUTH_*']

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote


Sorry, only registered users may post in this forum.