Skip to content
Snippets Groups Projects
Commit 1d081ee8 authored by Arsh Sabharwal's avatar Arsh Sabharwal
Browse files

fixed installation time bug, added support for user login endpoint

parent b77e07bc
No related branches found
No related tags found
No related merge requests found
......@@ -11,7 +11,7 @@ rest_api_authentication.request_api_support:
path: /admin/config/people/rest_api_authentication/requestSupport
defaults:
_title: 'miniOrange API Authentication Request Support'
_controller: '\Drupal\rest_api_authentication\Form\rest_api_authenticationController::openSupportRequestForm'
_controller: '\Drupal\rest_api_authentication\Controller\rest_api_authenticationController::openSupportRequestForm'
requirements:
_permission: 'administer site configuration'
......
......@@ -9,3 +9,7 @@ services:
public: false
tags:
- { name: page_cache_request_policy }
rest_api_authentication.route_subscriber:
class: Drupal\rest_api_authentication\Routing\RouteSubscriber
tags:
- { name: event_subscriber }
......@@ -69,6 +69,9 @@ class restAPI implements AuthenticationProviderInterface {
$api_error = array();
if ($request->getPathInfo() == "/user/login") {
return null;
}
$authentication_method = \Drupal::config('rest_api_authentication.settings')->get('authentication_method');
switch ($authentication_method) {
case 0:
......
<?php
namespace Drupal\rest_api_authentication\Routing;
use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
/**
* Listens to the dynamic route events.
*/
class RouteSubscriber extends RouteSubscriberBase {
/**
* {@inheritdoc}
*/
protected function alterRoutes(RouteCollection $collection) {
$route_login = $collection->get('user.login.http');
$route_login->addOptions([
'_auth' => [
'rest_api_authentication'
],
]);
}
/**
* @param Route $route
*
* @return false|true
*/
private function restLoginRount(Route $route) {
$path = $route->getPath();
return strpos($path,'/user/login?_format=');
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment