public function registerMiddlewareBindings(Application $app)
    {
        $app->singleton(CheckAuthCodeRequestMiddleware::class, function ($app) {
            return new CheckAuthCodeRequestMiddleware($app['oauth2-server.authorizer']);
        });

        $app->singleton(OAuthMiddleware::class, function ($app) {
            $httpHeadersOnly = $app['config']->get('oauth2.http_headers_only');

            return new OAuthMiddleware($app['oauth2-server.authorizer'], $httpHeadersOnly);
        });

        $app->singleton(OAuthClientOwnerMiddleware::class, function ($app) {
            return new OAuthClientOwnerMiddleware($app['oauth2-server.authorizer']);
        });

        $app->singleton(OAuthUserOwnerMiddleware::class, function ($app) {
            return new OAuthUserOwnerMiddleware($app['oauth2-server.authorizer']);
        });
    }