Skip to content

Commit

Permalink
Minor changes to assist unit testing
Browse files Browse the repository at this point in the history
  • Loading branch information
dpi committed Nov 4, 2020
1 parent f46723f commit 50ee362
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Controller/AuthmanOauthAuthorizationCodeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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]);
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 50ee362

Please sign in to comment.