From 50ee362543a3a7fc9ee62585e8e1b9561589a8f7 Mon Sep 17 00:00:00 2001 From: dpi Date: Wed, 4 Nov 2020 20:08:21 +0800 Subject: [PATCH] Minor changes to assist unit testing --- .../AuthmanOauthAuthorizationCodeController.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Controller/AuthmanOauthAuthorizationCodeController.php b/src/Controller/AuthmanOauthAuthorizationCodeController.php index 2f73a07..e124fd9 100644 --- a/src/Controller/AuthmanOauthAuthorizationCodeController.php +++ b/src/Controller/AuthmanOauthAuthorizationCodeController.php @@ -45,6 +45,7 @@ public static function create(ContainerInterface $container) { $instance->authmanOauthFactory = $container->get('authman.oauth'); $instance->messenger = $container->get('messenger'); $instance->currentUser = $container->get('current_user'); + $instance->stringTranslation = $container->get('string_translation'); return $instance; } @@ -106,13 +107,15 @@ public function start(AuthmanAuthInterface $authman_auth): Response { * A redirect response. */ public function receive(Request $request, AuthmanAuthInterface $authman_auth): Response { + $authmanConfigId = $authman_auth->id(); + // @todo #94/#95 - $tokenInfoUrl = Url::fromRoute('entity.authman_auth.information', ['authman_auth' => $authman_auth->id()]); + $tokenInfoUrl = Url::fromRoute('entity.authman_auth.information', ['authman_auth' => $authmanConfigId]); // Code generated by authorization server and passed back to us by the // user agent. $authorizationCode = $request->query->get('code'); - $authmanInstance = $this->authmanOauthFactory->get($authman_auth->id()); + $authmanInstance = $this->authmanOauthFactory->get($authmanConfigId); try { // Get the token via the provided authorization code. $token = $authmanInstance->getAccessToken(AuthmanAuthInterface::GRANT_AUTHORIZATION_CODE, ['code' => $authorizationCode]); @@ -148,7 +151,7 @@ public function receive(Request $request, AuthmanAuthInterface $authman_auth): R /** * Get key config storage. * - * @return \Drupal\authman\EntityHandlers\AuthmanAuthStorage + * @return \Drupal\Core\Config\Entity\ConfigEntityStorageInterface * The key config storage. */ protected function keyStorage(): EntityStorageInterface {