PRE-3632: add a logout action per gateway config - #330
Merged
adumont-payplug merged 1 commit intoSep 17, 2026
Conversation
adumont-payplug
merged commit Sep 17, 2026
c37495d
into
feature/PRE-3440_multi_shop_configuration
7 checks passed
adumont-payplug
deleted the
feature/PRE-3632_logout_per_gateway_config
branch
September 17, 2026 09:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a Disconnect this account action to each PayPlug gateway's admin screen. It clears the
credentials stored for that one payment method and disables it, leaving every other gateway —
including others of the same factory, on other channels — authenticated and untouched.
Distinct from the existing
renew_oauthcheckbox, which immediately mints new credentials.Logout ends with none.
What gets cleared. The ticket assumed the OAuth state was written through
SyliusUpcConfigurationRepository::set(). That method has zero callers, here and in UPC alike(
WebhookNotificationHelperis the only consumer ofIConfigurationRepository, and it onlyreads). The state is actually:
UnifiedAuthenticationController::oauthCallback()live_client,test_client,account_emailon the gateway configTokenManager→SyliusTokenCacheupc_oauth_token:<client_id>, one per environmentPayPlugApiClientpayplug_account_<…>— keyed by secret key, so inert once credentials are goneAll of the first two are cleared.
hfIdentifiergoes too, but only whenPayPlugGatewayFactory::isHostedFieldsConfig()holds — a CB gateway with Hosted Fields selected,where it names the account being disconnected.
live,oneClick,deferredCapture, thedisplay-mode flags and
fees_forare merchant settings and are left alone.Three decisions worth a reviewer's eye:
TokenManager::CACHE_KEY_PREFIXis private with no accessor, so the literal is mirrored inGatewayConnectionRevokerand pinned by a test. The alternative was leaving a usable accesstoken at rest for the remainder of its TTL after the merchant asked to disconnect. A
forget()on UPC would remove the duplication.
<form>, where anested
<form>is invalid HTML, so the CSRF token travels in the query string — the same shapeas Sylius's own
sylius_admin_shipment_resend_confirmation_email.security.csrf.token_manageris injected with@?. It only exists while CSRF protection isenabled, and a hard reference would break container compilation for an app that turns it off;
the check is then skipped, matching Sylius's
sylius_csrf_protection_enabled()guards.Two consequences of the auto-disable, both intended but worth confirming: PRE-3629's
per-channel uniqueness rule counts only enabled gateways, so logging out releases this gateway's
channels for another config to claim; and
PaymentMethodValidator::process()only ever disables,never re-enables, so after reconnecting the merchant must tick Enabled by hand.
Motivation: a merchant on a multi-shop setup has no way to sever one gateway's connection —
renew_oauthonly ever swaps one connection for another, and there is no path to "disconnect andstop taking payments here".
Related issue(s): PRE-3632
Type of Change
Checklist
Code Quality
UPC cache-key prefix, documented above and in the class docblock
Testing
GatewayConnectionRevokerTestandUnifiedLogoutControllerTest, including that a failed CSRF check mutates nothingon the
sonarcloudCI job — not yet observed; tick once CI is greenSecurity & Ops
payplugchannel and surfaced as a flash rather than a 500