We currently check the accept request header a few times in this code to make sure it matches application/xrds+xml. The existing code worked fine for Accept: application/xrds+xml but not for more complex requests like Accept: text/html; q=0.3, application/xhtml+xml; q=0.5, application/xrds+xml This caused the server to not return XRDS when it would have been appropriate to do so, which breaks discovery. This patch simplifies the check for the XRDS content type to allow for different formats of accept request headers. Change-Id: I3877ef72f6d11346c772e83f95d43ab97123a364
27 lines
740 B
PHP
27 lines
740 B
PHP
<?php
|
|
use openid\XRDS\XRDSDocumentBuilder;
|
|
|
|
class HomeController extends BaseController
|
|
{
|
|
|
|
private $discovery;
|
|
|
|
public function __construct(DiscoveryController $discovery)
|
|
{
|
|
$this->discovery = $discovery;
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
//This field contains a semicolon-separated list of representation schemes
|
|
//which will be accepted in the response to this request.
|
|
$accept = Request::header('Accept');
|
|
if (strstr($accept, XRDSDocumentBuilder::ContentType))
|
|
return $this->discovery->idp();
|
|
if (Auth::guest())
|
|
return View::make("home");
|
|
else {
|
|
return Redirect::action("UserController@getProfile");
|
|
}
|
|
}
|
|
} |