Auth
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<?php namespace GermanAirlinesVa\Graphql;
|
||||
|
||||
use Closure;
|
||||
|
||||
class Authentication
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($request->input('gql_session') === 'SUPER_SECRET_TOKEN') {
|
||||
return "false";
|
||||
}
|
||||
else {
|
||||
return "true";
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
@@ -34,12 +34,17 @@ class Plugin extends PluginBase
|
||||
public function boot()
|
||||
{
|
||||
App::make('October\Rain\Support\ClassLoader')->addDirectories('graphql');
|
||||
|
||||
$this->bootPackages();
|
||||
|
||||
App::register(GraphqlServiceProvider::class);
|
||||
App::register(SubscriptionServiceProvider::class);
|
||||
|
||||
$this->app->singleton(DatabaseManager::class, function ($app) {
|
||||
return $app->make('db');
|
||||
});
|
||||
\Illuminate\Support\Facades\Broadcast::routes(['prefix' => '', 'middleware' => 'GermanAirlinesVA\\Graphql\\Classes\\Authentication']);
|
||||
require("channels/channels.php");
|
||||
}
|
||||
|
||||
public function bootPackages()
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Broadcast Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may register all of the event broadcasting channels that your
|
||||
| application supports. The given channel authorization callbacks are
|
||||
| used to check if an authenticated user can listen to the channel.
|
||||
|
|
||||
*/
|
||||
|
||||
Broadcast::channel('lighthouse-*', function ($user) {
|
||||
return true;
|
||||
});
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php namespace GermanAirlinesVa\Graphql\Classes;
|
||||
|
||||
use Closure;
|
||||
|
||||
class Authentication
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if ($request->input('gql_session') === 'SUPER_SECRET_TOKEN') {
|
||||
return "false";
|
||||
}
|
||||
else {
|
||||
return "true";
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user