Skip to content

Add php native authorization headers #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 10, 2016
Merged

Conversation

dzubchik
Copy link
Contributor

Hi! We faced with missing php headers during basic authentication, so Symfony BasicAuthenticationListener could not work correctly. In this PR i propose to add appropriate headers.

@marcj
Copy link
Member

marcj commented Nov 10, 2016

Isn't PHP_AUTH_USER etc in the _SERVER bag instead of header?

@marcj
Copy link
Member

marcj commented Nov 10, 2016

Just checked: \Symfony\Component\HttpFoundation\ServerBag::initialize which is used in the constructor uses the information in _SERVER/$server (where PHP_AUTH_USER belongs to) to populate its $headers ($this->headers = new HeaderBag($this->server->getHeaders());).

So if you could place it in $_SERVER['PHP_AUTH_USER'] = ... (and clear those keys on every request first) anything else is done automatically. We need for this also to replace $syRequest->headers->replace($headers); with $syRequest->headers->add($headers);.

@dzubchik
Copy link
Contributor Author

@marcj , yes, you are right - php-doc. I will update PR according to this.

@marcj marcj merged commit 4fe3ead into php-pm:master Nov 10, 2016
@marcj
Copy link
Member

marcj commented Nov 10, 2016

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants