Commit db7ec32c authored by paul121's avatar paul121 Committed by Bojan Bogdanovic
Browse files

Issue #3167287: Always load clients through the ClientRepository service

parent 3528e1ee
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@
        "lcobucci/jwt": "^4",
        "league/oauth2-server": "^8.3",
        "steverhoades/oauth2-openid-connect-server": "^2.4",
        "drupal/consumers": "^1.2",
        "drupal/consumers": "^1.14",
        "php": ">=7.4"
    },
    "require-dev": {
+3 −3
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ use Drupal\Core\Field\BaseFieldDefinition;
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\consumers\Entity\Consumer;
use Drupal\consumers\Entity\ConsumerInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Url;
use Drupal\user\RoleInterface;
@@ -45,7 +45,7 @@ function simple_oauth_entity_update(EntityInterface $entity) {
  if ($entity instanceof AccountInterface) {
    $collector->deleteMultipleTokens($collector->collectForAccount($entity));
  }
  if ($entity instanceof Consumer) {
  if ($entity instanceof ConsumerInterface) {
    $collector->deleteMultipleTokens($collector->collectForClient($entity));
  }
}
@@ -200,7 +200,7 @@ function simple_oauth_form_consumer_form_alter(array &$form, FormStateInterface
 * @param \Drupal\Core\Form\FormStateInterface $form_state
 *   The state.
 */
function simple_oauth_form_consumer_form_submit($entity_type_id, Consumer $entity, array &$form, FormStateInterface $form_state) {
function simple_oauth_form_consumer_form_submit($entity_type_id, ConsumerInterface $entity, array &$form, FormStateInterface $form_state) {
  if ($entity_type_id !== 'consumer') {
    return;
  }
+1 −1
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ class SimpleOauthAuthenticationProvider implements AuthenticationProviderInterfa
    $request->files->add($auth_request->files->all());
    // Set consumer ID header on successful authentication, so negotiators
    // will trigger correctly.
    $request->headers->set('X-Consumer-ID', $account->getConsumer()->uuid());
    $request->headers->set('X-Consumer-ID', $account->getConsumer()->getClientId());

    return $account;
  }
+3 −2
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Drupal\simple_oauth\Authentication;

use Drupal\consumers\Entity\ConsumerInterface;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Session\AccountInterface;
@@ -34,7 +35,7 @@ class TokenAuthUser implements TokenAuthUserInterface {
  /**
   * The activated consumer instance.
   *
   * @var \Drupal\consumers\Entity\Consumer
   * @var \Drupal\consumers\Entity\ConsumerInterface
   */
  protected $consumer;

@@ -71,7 +72,7 @@ class TokenAuthUser implements TokenAuthUserInterface {
  /**
   * {@inheritdoc}
   */
  public function getConsumer() {
  public function getConsumer(): ConsumerInterface {
    return $this->consumer;
  }

+3 −2
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Drupal\simple_oauth\Authentication;

use Drupal\consumers\Entity\ConsumerInterface;
use Drupal\user\UserInterface;

/**
@@ -20,9 +21,9 @@ interface TokenAuthUserInterface extends \IteratorAggregate, UserInterface {
  /**
   * Get the activated consumer.
   *
   * @return \Drupal\consumers\Entity\Consumer
   * @return \Drupal\consumers\Entity\ConsumerInterface
   *   The activated consumer after authentication.
   */
  public function getConsumer();
  public function getConsumer(): ConsumerInterface;

}
Loading