cakephp / authentication

Authentication plugin for CakePHP. Can also be used in PSR7 based applications.
MIT License
115 stars 100 forks source link

3.x: fix Uri class usage #598

Closed LordSimal closed 1 year ago

LordSimal commented 1 year ago

Http\Uri was dropped in https://github.com/cakephp/cakephp/pull/16859

But now since we don't have a wrapper class holding the base info the DefaultUrlChecker needed to be updated and use the config values instead. I don't know if this is the correct way right now but it was the first that came to my mind.

ADmad commented 1 year ago

ServerRequest has the base as an attribute so instead of the Uri we can pass the request instance to the _getUrlFromRequest() method and check if $request->getAttribute('base') is non-empty.

LordSimal commented 1 year ago

So am I correct that the base attribute on the request has priority over the App.base config value?

ndm2 commented 1 year ago

I don't think there should be a fallback, if the server request object has no base, then either the app has none, or the request object was created manually (not via the factory) or has the attribute unset, both of which indicates possible intent.

ADmad commented 1 year ago

The request's base attribute is set based on the App.base config, there's no need to check for it again and use it as fallback.