English 中文(简体)
申述2 http://www.ohchr.org
原标题:Symfony2 http_basic security rejects valid credentials
最佳回答

基本认证与PHP在阿帕帕奇(PHP)下做主/女农业研究组分类。

工作:

app_dev.php

if( !isset($_SERVER[ PHP_AUTH_USER ]) )
{
    if (isset($_SERVER[ HTTP_AUTHORIZATION ]) && (strlen($_SERVER[ HTTP_AUTHORIZATION ]) > 0))
    {
        list($_SERVER[ PHP_AUTH_USER ], $_SERVER[ PHP_AUTH_PW ]) = explode( : , base64_decode(substr($_SERVER[ HTTP_AUTHORIZATION ], 6)));
        if( strlen($_SERVER[ PHP_AUTH_USER ]) == 0 || strlen($_SERVER[ PHP_AUTH_PW ]) == 0 )
        {
            unset($_SERVER[ PHP_AUTH_USER ]);
            unset($_SERVER[ PHP_AUTH_PW ]);
        }
    }
}

<>strong>web/htaccess

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] 
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>

https://github.com/symfony/symfony/issues/1813。 github issue

问题回答

目前的版本(Symfony版本2.1.8)。

It s because of the special way that Apache + PHP as FastCGI handles HTTP auth variables.

At least, the fix for the current version is a little simplier than it was before (as compared to @Teo.sk s answer), and the instructions are available directly hardcoded as comments in the file vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/ServerBag.php of the framework:

/*
* php-cgi under Apache does not pass HTTP Basic user/pass to PHP by default
* For this workaround to work, add these lines to your .htaccess file:
* RewriteCond %{HTTP:Authorization} ^(.+)$
* RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
*
* A sample .htaccess file:
* RewriteEngine On
* RewriteCond %{HTTP:Authorization} ^(.+)$
* RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
* RewriteCond %{REQUEST_FILENAME} !-f
* RewriteRule ^(.*)$ app.php [QSA,L]
*/

简言之,为了确定这一条,你们都必须在<条码>上添加以下内容: <代码>web/ 您的申请:

RewriteCond %{HTTP:Authorization} ^(.+)$
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

www.un.org/Depts/DGACM/index_spanish.htm 新Info(2013-05-01):现在,Im 使用了第二.2.1版的同义词,在固定工作时,我不得不在以下条目下添加这两条代码:web/.htaccess:

RewriteEngine On

您不需要修改您的书名项目,你还需要改变笔记。

sudoedit /etc/apache2/sites-enabled/[yoursite].

插入

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]

a. 保留地重新启用

享有:

i 采用双管线:

 - { path: /correspondencia/recepcion/login, role: IS_AUTHENTICATED_ANONYMOUSLY }
 - { path: /correspondencia/recepcion, role: ROLE_ADMIN }

without the last slash wrong

/correspondencia/recepcion/

good

/correspondencia/recepcion




相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

MALICIOUS_CODE EI_EXPOSE_REP Medium

I run findbugs against all of my code and only tackle the top stuff. I finally got the top stuff resolved and now am looking at the details. I have a simple entity, say a user: public class User ...

XSS on jsbin.com

Anyone know if jsbin.com implements any protection for XSS or other javascript attacks? I see jsbin links used fairly regularly on sites like this one and I can t find any indication from the site ...

Make md5 strong

Im making a website that will intergrate with game that only support md5 hashing metod (atm). Which ofc is not especially safe anymore. But how could i make it stronger? Should I just generate long ...

Why running a service as Local System is bad on windows?

I am trying to find out the difference between difference service account types. I tumbled upon this question. The answer was because it has powerful access to local resources, and Network Service ...

Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

热门标签