ShopwareAG/shopware-4 — pull request #17 by lennartdiedrich (2012-10-02 16:22:06+00:00)
Title: Move referer and user agent retrieval to if-statement header

Currently it is not possible to access the default Auth Component using `Shopware()->Auth()` before the `onPreDispatchBackend` of the Auth-Plugin has been executed. The instantiation of the Auth Component using `onInitResourceAuth` and `onInitResourceBackendSession` requires the $request property to be set, which happens in the `onPreDispatchBackend` method.

This patch allows to use the Auth Component, at least when the referer and client checks are not executed, by retrieving the referer and user agent from the request only when the checks are enabled.

The reason for this requirement is that we need to execute our own custom `onPreDispatchBackend` method before the default handlers `onPreDispatchBackend` method has been executed, because we adapted the backend login process to support preemptive HTTP Basic Authentication.

Maybe there's a better solution for this specific problem, but at least this pull request increases the performance a little bit by avoiding unnecessary variable instantiation.