Making WordPress.org

Changeset 15311


Ignore:
Timestamp:
10/09/2026 02:25:28 PM (2 weeks ago)
Author:
obenland
Message:

FreeScout: Accept logins from WordPress.org's identity provider

Closes ​https://github.com/WordPress/wordpress.org/pull/1032.

Location:
sites/trunk/freescout.wordpress.net
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/freescout.wordpress.net/Modules/WPOrgSSO/Config/config.php

    r15246 r15311  
    1919        // The WordPress.org SAML identity provider, as its settings page lists it.
    2020        'idp'            => array(
    21                 'entity_id' => env( 'WPORG_SSO_IDP_ENTITY_ID', 'https://login.wordpress.org' ),
     21                'entity_id' => env( 'WPORG_SSO_IDP_ENTITY_ID', 'https://wordpress.org' ),
    2222                'url'       => env( 'WPORG_SSO_IDP_URL', 'https://login.wordpress.org/wp-login.php?action=idp' ),
    2323
  • sites/trunk/freescout.wordpress.net/Modules/WPOrgSSO/Http/Controllers/SsoController.php

    r15262 r15311  
    7979                        $result = Saml::from_config()->validate( (string) $request->input( 'SAMLResponse', '' ) );
    8080                } catch ( \Throwable $e ) {
    81                         \Log::warning( '[WPOrgSSO] ' . $e->getMessage() );
     81                        \Log::error( '[WPOrgSSO] ' . $e->getMessage() );
    8282
    8383                        return redirect()->away( $complete, 303 );
  • sites/trunk/freescout.wordpress.net/Modules/WPOrgSSO/Services/Saml.php

    r15246 r15311  
    150150
    151151                        $username       = (string) $response->getNameId();
    152                         $in_response_to = (string) $response->getXMLDocument()->documentElement->getAttribute( 'InResponseTo' );
     152                        $in_response_to = self::in_response_to( $response->getXMLDocument() );
    153153                } catch ( RuntimeException $e ) {
    154154                        throw $e;
    … …  
    167167                        'in_response_to' => $in_response_to,
    168168                );
     169        }
     170
     171        /**
     172         * Gets the ID of the login request a response answers.
     173         *
     174         * WordPress.org's identity provider only names it in the assertion's bearer confirmation, not on the response
     175         * itself. The whole response is signed, so it's as trustworthy there.
     176         *
     177         * @param \DOMDocument $document Validated response.
     178         * @return string Login request ID, or empty.
     179         */
     180        private static function in_response_to( \DOMDocument $document ): string {
     181                $xpath = new \DOMXPath( $document );
     182                $xpath->registerNamespace( 'samlp', Constants::NS_SAMLP );
     183                $xpath->registerNamespace( 'saml', Constants::NS_SAML );
     184
     185                return (string) $xpath->evaluate( 'string(/samlp:Response/saml:Assertion/saml:Subject/saml:SubjectConfirmation[@Method="' . Constants::CM_BEARER . '"]/saml:SubjectConfirmationData/@InResponseTo)' );
    169186        }
    170187
  • sites/trunk/freescout.wordpress.net/Modules/WPOrgSSO/tests/Support/IdentityProvider.php

    r15246 r15311  
    139139                $id       = '_' . bin2hex( random_bytes( 16 ) );
    140140
     141                // Like wp-saml-idp, only the bearer confirmation names the login request, not the response itself.
    141142                $xml = sprintf(
    142                         '<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="%1$s" Version="2.0" IssueInstant="%3$s" Destination="%6$s" InResponseTo="%8$s">' .
     143                        '<samlp:Response xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" ID="%1$s" Version="2.0" IssueInstant="%3$s" Destination="%6$s">' .
    143144                                '<saml:Issuer>%5$s</saml:Issuer>' .
    144145                                '<samlp:Status><samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/></samlp:Status>' .
  • sites/trunk/freescout.wordpress.net/README.md

    r15265 r15311  
    5151|---|---|---|
    5252| `WPORG_API_URL` | `https://api.wordpress.org/dotorg/freescout/` | Where the helpdesk endpoints are. |
    53 | `WPORG_SSO_IDP_ENTITY_ID` | `https://login.wordpress.org` | The identity provider's entity ID, from its settings page on login.wordpress.org. |
     53| `WPORG_SSO_IDP_ENTITY_ID` | `https://wordpress.org` | The identity provider's entity ID, from its settings page on login.wordpress.org. |
    5454| `WPORG_SSO_IDP_URL` | `https://login.wordpress.org/wp-login.php?action=idp` | The identity provider's login URL, from the same page. |
    5555| `WPORG_HELPSCOUT_APP_ID`, `WPORG_HELPSCOUT_APP_SECRET` | | A HelpScout app's credentials, for `WPOrgHelpScoutImport`. Only needed while mailboxes move; delete the app after the last import. |
Note: See TracChangeset for help on using the changeset viewer.