Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Admin/OAuthProviderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
use Horde\Core\Sidebar\SidebarRenderer;
use Horde\Core\Topbar\TopbarBuilder;
use Horde\Core\Topbar\TopbarRenderer;
use Horde\Horde\Service\UrlGenerator;
use Horde\Core\Uri\RouteUrlWriter;
use Horde\Horde\Traits\HtmlResponseTrait;
use Horde\Horde\Traits\RedirectResponseTrait;
use Horde\OAuth\Client\ProviderDiscovery;
Expand Down Expand Up @@ -57,7 +57,7 @@ public function __construct(
private readonly AdminSidebarPanel $adminPanel,
private readonly SidebarRenderer $sidebarRenderer,
private readonly Horde_Registry $registry,
private readonly UrlGenerator $urlGenerator,
private readonly RouteUrlWriter $urlWriter,
private readonly ?ProviderDiscovery $discovery = null,
) {}

Expand Down Expand Up @@ -188,7 +188,7 @@ private function editProvider(ServerRequestInterface $request, ?string $provider
$view->provider = $provider;
$view->baseUrl = $baseUrl;
$view->setupNotes = $preset['notes'] ?? '';
$view->callbackUrl = $this->urlGenerator->absoluteUrlFor('SettingsOAuthCallback');
$view->callbackUrl = $this->urlWriter->absoluteUrlFor('SettingsOAuthCallback');

$template = $provider['type'] === 'service_app' ? 'edit-service-app' : 'edit-oauth2';

Expand Down
6 changes: 3 additions & 3 deletions src/Auth/OAuthLoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

use Horde\Core\Service\OAuthProviderConfigRepository;
use Horde\Core\Service\Exception\OAuthProviderConfigNotFoundException;
use Horde\Horde\Service\UrlGenerator;
use Horde\Core\Uri\RouteUrlWriter;
use Horde\Horde\Traits\RedirectResponseTrait;
use Horde\OAuth\Client\OAuth2Client;
use Horde\OAuth\Client\OAuthFlowData;
Expand All @@ -39,7 +39,7 @@ class OAuthLoginController implements RequestHandlerInterface

public function __construct(
private readonly OAuthProviderConfigRepository $providerConfig,
private readonly UrlGenerator $urlGenerator,
private readonly RouteUrlWriter $urlWriter,
private readonly OAuthFlowStore $flowStore,
private readonly Horde_Registry $registry,
private readonly ClientInterface $httpClient,
Expand Down Expand Up @@ -84,7 +84,7 @@ public function handle(ServerRequestInterface $request): ResponseInterface
redirectUrl: $redirectUrl,
));

$callbackUri = $this->urlGenerator->absoluteUrlFor('SettingsOAuthCallback');
$callbackUri = $this->urlWriter->absoluteUrlFor('SettingsOAuthCallback');
$providerCfg = ProviderConfig::fromArray($row);

$client = new OAuth2Client(
Expand Down
6 changes: 6 additions & 0 deletions src/Service/UrlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
use Horde\Routes\Mapper;
use Horde\Routes\Utils;

/**
* NOTE: New code should use Horde\Core\Uri\RouteUrlWriter instead.
* RouteUrlWriter consumes the RoutesProvider interface and works in both
* Rampage (without legacy bootstrap) and legacy flows. This class remains
* for existing callers wired through _bootstrap() in Application.php.
*/
class UrlGenerator
{
private Utils $utils;
Expand Down
6 changes: 3 additions & 3 deletions src/Settings/OAuthAccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
use Horde\Core\Topbar\TopbarRenderer;
use Horde\Horde\Service\AuthLink;
use Horde\Horde\Service\IdentityLinkService;
use Horde\Horde\Service\UrlGenerator;
use Horde\Core\Uri\RouteUrlWriter;
use Horde\Horde\Traits\HtmlResponseTrait;
use Horde\Horde\Traits\RedirectResponseTrait;
use Horde\Identity\IdentityRole;
Expand Down Expand Up @@ -65,7 +65,7 @@ public function __construct(
private readonly OAuthTokenService $tokenService,
private readonly IdentityLinkService $identityLinkService,
private readonly IdentityService $identityService,
private readonly UrlGenerator $urlGenerator,
private readonly RouteUrlWriter $urlWriter,
private readonly OAuthFlowStore $flowStore,
private readonly Horde_Notification_Handler $notification,
private readonly AssetCollector $assetCollector,
Expand Down Expand Up @@ -438,7 +438,7 @@ private function disconnect(ServerRequestInterface $request, ?string $providerId
private function buildOAuth2Client(array $row): OAuth2Client
{
$providerConfig = ProviderConfig::fromArray($row);
$redirectUri = $this->urlGenerator->absoluteUrlFor('SettingsOAuthCallback');
$redirectUri = $this->urlWriter->absoluteUrlFor('SettingsOAuthCallback');

return new OAuth2Client(
provider: $providerConfig,
Expand Down