Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
9f58b42
Connectors: Add application password UI primitives
jorgefilipecosta Jun 22, 2026
90864e4
Connectors: Render application password settings
jorgefilipecosta Jun 22, 2026
cb73cce
Connectors: Fix application password help typing
jorgefilipecosta Jun 22, 2026
eda8ba3
Tests: Activate application password connector fixture
jorgefilipecosta Jun 22, 2026
9a2bd0c
Tests: Detect application password Core support
jorgefilipecosta Jun 22, 2026
1b6826c
Connectors: Clarify application password setting defaults
jorgefilipecosta Jun 22, 2026
3ba1e83
Backport changelog: Link application password connector PR
jorgefilipecosta Jun 22, 2026
1ffc18f
Connectors: Reject mismatched auth setting names in compat
jorgefilipecosta Jun 23, 2026
2ab633f
Connectors: Reuse connector URL helpers
jorgefilipecosta Jun 23, 2026
9e47a9d
Tests: Verify application password removal clears settings
jorgefilipecosta Jun 23, 2026
76bf9ba
Connectors: Share connector action area
jorgefilipecosta Jun 23, 2026
4e78127
Docs: Clarify connector credential masking in compat
jorgefilipecosta Jun 23, 2026
b321570
Connectors: Fully mask application passwords in compat
jorgefilipecosta Jun 23, 2026
2f4b15e
Connectors: Inline application password mask in compat
jorgefilipecosta Jun 23, 2026
bbbe089
Connectors: Remove obsolete TextControl size prop
jorgefilipecosta Jun 23, 2026
c8b19a6
Connectors: Update test connector description
jorgefilipecosta Jul 6, 2026
687054a
Connectors: Store application password credentials together
jorgefilipecosta Jul 6, 2026
3b31740
Connectors: Preserve stored application password credentials
jorgefilipecosta Jul 6, 2026
c861ba1
Connectors: Avoid false save errors from username sanitization
jorgefilipecosta Jul 6, 2026
45fac29
Connectors: Wait for settings before showing the credentials form
jorgefilipecosta Jul 6, 2026
b33f0ba
Connectors: Support constants and environment variables for applicati…
jorgefilipecosta Jul 6, 2026
728d47f
Connectors: Show externally configured application password credentials
jorgefilipecosta Jul 6, 2026
2ea64ee
Connectors: Cover environment-configured application password connectors
jorgefilipecosta Jul 6, 2026
a1fd7b1
Connectors: Reuse credential setting contract
jorgefilipecosta Jul 6, 2026
00d2c44
Connectors: Surface malformed external application password credentials
jorgefilipecosta Jul 7, 2026
f67c795
Connectors: Stop rethrowing disconnect errors
jorgefilipecosta Jul 7, 2026
7bcf4ad
Connectors: Wait for settings before showing the API key form
jorgefilipecosta Jul 7, 2026
2171f79
Connectors: Deduplicate connector plugin selector data
jorgefilipecosta Jul 7, 2026
9e85c9b
Connectors: Pass credential setting name to sanitize callback
jorgefilipecosta Jul 7, 2026
ace68d1
Connectors: Ignore malformed external application password credentials
jorgefilipecosta Jul 7, 2026
521db77
Connectors: Derive help-link label from the URL hostname
jorgefilipecosta Jul 7, 2026
f7f3eb7
Connectors: Trim application password credential values
jorgefilipecosta Jul 7, 2026
11d95b9
Connectors: Reuse the settings help-link label derivation
jorgefilipecosta Jul 7, 2026
d3275a1
Connectors: Assert the application password is masked on reload
jorgefilipecosta Jul 7, 2026
0e9dd61
Connectors: Fix application password settings CI
jorgefilipecosta Jul 7, 2026
1b6d66a
Connectors: Address application password review feedback
jorgefilipecosta Jul 9, 2026
f28db44
Connectors: Inline the generated setting name suffix
jorgefilipecosta Jul 9, 2026
876e5ac
Connectors: Fix generated setting name pattern in docblock
jorgefilipecosta Jul 9, 2026
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
3 changes: 3 additions & 0 deletions backport-changelog/7.1/12264.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/12264

* https://github.com/WordPress/gutenberg/pull/79403
47 changes: 29 additions & 18 deletions lib/compat/wordpress-7.0/class-wp-connector-registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* logo_url?: non-empty-string,
* type: non-empty-string,
* authentication: array{
* method: 'api_key'|'none',
* method: 'api_key'|'application_password'|'none',
* credentials_url?: non-empty-string,
* setting_name?: non-empty-string,
* constant_name?: non-empty-string,
Expand Down Expand Up @@ -57,12 +57,11 @@ final class WP_Connector_Registry {
* Registers a new connector.
*
* Validates the provided arguments and stores the connector in the registry.
* For connectors with `api_key` authentication, a `setting_name` can be provided
* explicitly. If omitted, one is automatically generated using the pattern
* `connectors_{$type}_{$id}_api_key`, with hyphens in the type and ID normalized
* to underscores (e.g., connector type `spam_filtering` with ID `akismet` produces
* `connectors_spam_filtering_akismet_api_key`). This setting name is used for the
* Settings API registration and REST API exposure.
* For connectors with `api_key` or `application_password` authentication, a
* `setting_name` can be provided explicitly. When omitted, setting names are
* automatically generated using the pattern `connectors_{$type}_{$id}_{$method}`,
* with hyphens in the type and ID normalized to underscores. These setting
* names are used for Settings API registration and REST API exposure.
*
* Registering a connector with an ID that is already registered will trigger a
* `_doing_it_wrong()` notice and return `null`. To override an existing connector,
Expand All @@ -84,16 +83,24 @@ final class WP_Connector_Registry {
* @type array $authentication {
* Required. Authentication configuration.
*
* @type string $method Required. The authentication method: 'api_key' or 'none'.
* @type string $method Required. The authentication method: 'api_key',
* 'application_password', or 'none'.
* @type string $credentials_url Optional. URL where users can obtain API credentials.
* @type string $setting_name Optional. The setting name for the API key.
* When omitted, auto-generated as
* `connectors_{$type}_{$id}_api_key`.
* @type string $setting_name Optional. The setting name for the API key
* or application-password credentials. When
* omitted, auto-generated as
* `connectors_{$type}_{$id}_api_key` for API
* keys and `connectors_{$type}_{$id}_application_password`
* for application passwords.
* Must be a non-empty string when provided.
* @type string $constant_name Optional. PHP constant name for the API key
* (e.g. 'ANTHROPIC_API_KEY'). Only checked when provided.
* (e.g. 'ANTHROPIC_API_KEY') or for application-password
* credentials in `username:password` format. Only checked
* when provided.
* @type string $env_var_name Optional. Environment variable name for the API key
* (e.g. 'ANTHROPIC_API_KEY'). Only checked when provided.
* (e.g. 'ANTHROPIC_API_KEY') or for application-password
* credentials in `username:password` format. Only checked
* when provided.
* }
* @type array $plugin {
* Optional. Plugin data for install/activate UI.
Expand All @@ -114,7 +121,7 @@ final class WP_Connector_Registry {
* logo_url?: non-empty-string,
* type: non-empty-string,
* authentication: array{
* method: 'api_key'|'none',
* method: 'api_key'|'application_password'|'none',
* credentials_url?: non-empty-string,
* setting_name?: non-empty-string,
* constant_name?: non-empty-string,
Expand Down Expand Up @@ -180,11 +187,11 @@ public function register( string $id, array $args ): ?array {
return null;
}

if ( empty( $args['authentication']['method'] ) || ! in_array( $args['authentication']['method'], array( 'api_key', 'none' ), true ) ) {
if ( empty( $args['authentication']['method'] ) || ! in_array( $args['authentication']['method'], array( 'api_key', 'application_password', 'none' ), true ) ) {
_doing_it_wrong(
__METHOD__,
/* translators: %s: Connector ID. */
sprintf( __( 'Connector "%s" authentication method must be "api_key" or "none".' ), esc_html( $id ) ),
sprintf( __( 'Connector "%s" authentication method must be "api_key", "application_password", or "none".' ), esc_html( $id ) ),
'7.0.0'
);
return null;
Expand All @@ -208,10 +215,13 @@ public function register( string $id, array $args ): ?array {
$connector['logo_url'] = $args['logo_url'];
}

if ( 'api_key' === $args['authentication']['method'] ) {
$requires_credentials = in_array( $args['authentication']['method'], array( 'api_key', 'application_password' ), true );

if ( $requires_credentials ) {
if ( ! empty( $args['authentication']['credentials_url'] ) && is_string( $args['authentication']['credentials_url'] ) ) {
$connector['authentication']['credentials_url'] = $args['authentication']['credentials_url'];
}

if ( isset( $args['authentication']['setting_name'] ) ) {
if ( ! is_string( $args['authentication']['setting_name'] ) || '' === $args['authentication']['setting_name'] ) {
_doing_it_wrong(
Expand All @@ -224,8 +234,9 @@ public function register( string $id, array $args ): ?array {
}
$connector['authentication']['setting_name'] = $args['authentication']['setting_name'];
} else {
$connector['authentication']['setting_name'] = str_replace( '-', '_', "connectors_{$connector['type']}_{$id}_api_key" );
$connector['authentication']['setting_name'] = str_replace( '-', '_', "connectors_{$connector['type']}_{$id}_{$args['authentication']['method']}" );
}

if ( isset( $args['authentication']['constant_name'] ) ) {
if ( ! is_string( $args['authentication']['constant_name'] ) || '' === $args['authentication']['constant_name'] ) {
_doing_it_wrong(
Expand Down
36 changes: 20 additions & 16 deletions lib/compat/wordpress-7.0/connectors.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,17 @@ function wp_is_connector_registered( string $id ): bool {
* @type string $logo_url Optional. URL to the connector's logo image.
* @type string $type The connector type, e.g. 'ai_provider' or 'spam_filtering'.
* @type array $authentication {
* Authentication configuration. When method is 'api_key', includes
* credentials_url, setting_name, and optionally constant_name and
* env_var_name. When 'none', only method is present.
* Authentication configuration. When method is 'api_key' or
* 'application_password', includes credentials_url, setting_name, and
* optionally constant_name and env_var_name. When 'none', only method
* is present.
*
* @type string $method The authentication method: 'api_key' or 'none'.
* @type string $method The authentication method: 'api_key',
* 'application_password', or 'none'.
* @type string $credentials_url Optional. URL where users can obtain API credentials.
* @type string $setting_name Optional. The setting name for the API key.
* @type string $constant_name Optional. PHP constant name for the API key.
* @type string $env_var_name Optional. Environment variable name for the API key.
* @type string $setting_name Optional. The setting name for the API key or application-password credentials.
* @type string $constant_name Optional. PHP constant name for the API key or application-password credentials.
* @type string $env_var_name Optional. Environment variable name for the API key or application-password credentials.
* }
* @type array $plugin {
* Optional. Plugin data for install/activate UI.
Expand All @@ -69,7 +71,7 @@ function wp_is_connector_registered( string $id ): bool {
* logo_url?: non-empty-string,
* type: non-empty-string,
* authentication: array{
* method: 'api_key'|'none',
* method: 'api_key'|'application_password'|'none',
* credentials_url?: non-empty-string,
* setting_name?: non-empty-string,
* constant_name?: non-empty-string,
Expand Down Expand Up @@ -110,15 +112,17 @@ function wp_get_connector( string $id ): ?array {
* @type string $logo_url Optional. URL to the connector's logo image.
* @type string $type The connector type, e.g. 'ai_provider' or 'spam_filtering'.
* @type array $authentication {
* Authentication configuration. When method is 'api_key', includes
* credentials_url, setting_name, and optionally constant_name and
* env_var_name. When 'none', only method is present.
* Authentication configuration. When method is 'api_key' or
* 'application_password', includes credentials_url, setting_name,
* and optionally constant_name and env_var_name. When 'none', only
* method is present.
*
* @type string $method The authentication method: 'api_key' or 'none'.
* @type string $method The authentication method: 'api_key',
* 'application_password', or 'none'.
* @type string $credentials_url Optional. URL where users can obtain API credentials.
* @type string $setting_name Optional. The setting name for the API key.
* @type string $constant_name Optional. PHP constant name for the API key.
* @type string $env_var_name Optional. Environment variable name for the API key.
* @type string $setting_name Optional. The setting name for the API key or application-password credentials.
* @type string $constant_name Optional. PHP constant name for the API key or application-password credentials.
* @type string $env_var_name Optional. Environment variable name for the API key or application-password credentials.
* }
* @type array $plugin {
* Optional. Plugin data for install/activate UI.
Expand All @@ -136,7 +140,7 @@ function wp_get_connector( string $id ): ?array {
* logo_url?: non-empty-string,
* type: non-empty-string,
* authentication: array{
* method: 'api_key'|'none',
* method: 'api_key'|'application_password'|'none',
* credentials_url?: non-empty-string,
* setting_name?: non-empty-string,
* constant_name?: non-empty-string,
Expand Down
Loading
Loading