Changeset 3763844 for gen-wave/trunk/src/Core/AgentAuth.php
- Timestamp:
- 10/25/2026 12:38:56 AM (3 days ago)
- File:
-
- 1 edited
-
gen-wave/trunk/src/Core/AgentAuth.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
gen-wave/trunk/src/Core/AgentAuth.php
r3642637 r3763844 28 28 } 29 29 30 /** 31 * The verify-domain challenge is answered only while this site is talking to 32 * the panel (connect, disconnect): a short window opened before the request 33 * and closed after it. Five minutes covers a slow panel; it closes itself. 34 */ 35 private const CHALLENGE_WINDOW = 'genwave_challenge_open'; 36 37 public static function openChallenge(): void 38 { 39 set_transient(self::CHALLENGE_WINDOW, 1, 5 * MINUTE_IN_SECONDS); 40 } 41 42 public static function closeChallenge(): void 43 { 44 delete_transient(self::CHALLENGE_WINDOW); 45 } 46 47 public static function challengeOpen(): bool 48 { 49 return (bool) get_transient(self::CHALLENGE_WINDOW); 50 } 51 30 52 /** True once the site has completed the signed connect. */ 31 53 public static function isConnected(): bool … … 45 67 } 46 68 69 // The panel calls back to verify-domain during this request: answer it now, and only now. 70 self::openChallenge(); 47 71 $response = wp_remote_post(self::panelUrl() . '/api/plugin/connect', [ 48 72 'headers' => ['Content-Type' => 'application/json', 'Accept' => 'application/json'], … … 56 80 ]); 57 81 82 self::closeChallenge(); 83 58 84 if (is_wp_error($response)) { 59 85 return ['success' => false, 'message' => $response->get_error_message()]; … … 93 119 94 120 if (!empty($licenseKey)) { 121 self::openChallenge(); 95 122 wp_remote_post(self::panelUrl() . '/api/plugin/disconnect', [ 96 123 'headers' => ['Content-Type' => 'application/json', 'Accept' => 'application/json'], … … 102 129 'sslverify' => ! preg_match('#(localhost|127\.0\.0\.1|\.local)#', self::panelUrl()), 103 130 ]); 131 self::closeChallenge(); 104 132 } 105 133
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)