Move basic auth check

Backport of https://github.com/owncloud/core/pull/11130

@PVince81 @karlitschek 
Well, introduced with https://github.com/owncloud/core/pull/3487 but no description instead of "broken" and it works also when moved ;-)