tuupola / slim-basic-auth

PSR-7 and PSR-15 HTTP Basic Authentication Middleware
MIT License
440 stars 66 forks source link

Can't get Authorization header using fastCGI #77

Closed filipefreitas82 closed 5 years ago

filipefreitas82 commented 5 years ago

This isn't really an issue, I just can't use this workaround: FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization

I was trying to use the environment option: _"environment" => "REDIRECT_HTTPAUTHORIZATION"

but this is not implemented for slim v3. Any special reason?

tuupola commented 5 years ago

The 3.x branch removed all the workarounds and assumes user has an environment which correctly includes the Authorization header in the the PSR-7 request object. If a workaround is required it is assumed not to be this middlewares responsibility anymore.

If headers cannot be fixed with web server or framework config, you could create an ad-hoc middleware which inserts the correct Authorizationheader before calling this middleware. You could also use the older 2.x branch which still has the workarounds and also supports Slim 3.

UPGRADING describes the differences between 2.x and 3.x in more depth.