protected function bootFilters()
	{
		if (config('api.cors_enabled', true)) {
			$this->app['router']->before(function ($request) {
				if (Request::header('Origin') && $_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
					$response = Response::make(null, 204);
					Cors::attachHeaders($response);
					Cors::attachOriginHeader($response, Request::header('Origin'));
					return $response;
				}
			});
			
			$this->app['router']->after(function ($request, $response) {
				if (Request::header('Origin')) {
					Cors::attachHeaders($response);
					Cors::attachOriginHeader($response, Request::header('Origin'));
				}
			});
		}
		
		$this->app['router']->filter('protect', function ($route, $request) {
			Api::protect();
		});
		
		$this->app['router']->filter('checkscope', function ($route, $request, $scope = '') {
			// B/c Laravel uses : as a special character already.
			$scope = str_replace('.', ':', $scope);
			
			Api::checkScope($scope);
		});
	}