Skip to content

Commit

Permalink
fix: extension key in event listener
Browse files Browse the repository at this point in the history
  • Loading branch information
maikschneider committed May 5, 2023
1 parent ed8c652 commit 3195ab1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
11 changes: 4 additions & 7 deletions Classes/EventListener/BackendUserLookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ public function __construct(
}

/**
* @throws ExtensionConfigurationExtensionNotConfiguredException
* @throws ExtensionConfigurationPathDoesNotExistException
* @throws IdentityResolverException
*/
public function __invoke(BackendUserLookupEvent $event): void
Expand All @@ -31,13 +33,8 @@ public function __invoke(BackendUserLookupEvent $event): void
}

$providerId = $event->getProviderId();
try {
$extendedProviderConfiguration = $this->extensionConfiguration->get('xima-oauth2-extended', $providerId) ?? [];
} catch (ExtensionConfigurationPathDoesNotExistException|ExtensionConfigurationExtensionNotConfiguredException) {
return;
}

$resolverClass = $extendedProviderConfiguration['resolverClassName'] ?? '';
$extendedProviderConfiguration = $this->extensionConfiguration->get('xima_oauth2_extended', 'oauth2_client_providers') ?? [];
$resolverClass = $extendedProviderConfiguration[$providerId]['resolverClassName'] ?? '';
if (!$resolverClass) {
return;
}
Expand Down
16 changes: 9 additions & 7 deletions Classes/EventListener/FrontendUserLookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,22 @@ public function __construct(
) {
}

/**
* @throws SiteNotFoundException
* @throws ExtensionConfigurationPathDoesNotExistException
* @throws IdentityResolverException
* @throws OAuth2ConfigurationException
* @throws ExtensionConfigurationExtensionNotConfiguredException
*/
public function __invoke(FrontendUserLookupEvent $event): void
{
if ($event->getTypo3User() !== null || !($event->getRemoteUser() instanceof ResourceOwnerInterface)) {
return;
}

$providerId = $event->getProviderId();
try {
$extendedProviderConfiguration = $this->extensionConfiguration->get('xima-oauth2-extended', $providerId) ?? [];
} catch (ExtensionConfigurationPathDoesNotExistException|ExtensionConfigurationExtensionNotConfiguredException) {
return;
}

$resolverClass = $extendedProviderConfiguration['resolverClassName'] ?? '';
$extendedProviderConfiguration = $this->extensionConfiguration->get('xima_oauth2_extended', 'oauth2_client_providers') ?? [];
$resolverClass = $extendedProviderConfiguration[$providerId]['resolverClassName'] ?? '';
if (!$resolverClass) {
return;
}
Expand Down

0 comments on commit 3195ab1

Please sign in to comment.