@@ -39,7 +39,7 @@ class OAuth2Test extends TestCase
3939 ];
4040
4141 private $ signingMinimal = [
42- 'signingKey ' => ' example_key ' ,
42+ 'signingKey ' => null , // added in setUp
4343 'signingAlgorithm ' => 'HS256 ' ,
4444 'scope ' => 'https://www.googleapis.com/auth/userinfo.profile ' ,
4545 'issuer ' => 'app@example.com ' ,
@@ -58,7 +58,7 @@ class OAuth2Test extends TestCase
5858 private $ fetchAuthTokenMinimal = [
5959 'tokenCredentialUri ' => 'https://tokens_r_us/test ' ,
6060 'scope ' => 'https://www.googleapis.com/auth/userinfo.profile ' ,
61- 'signingKey ' => ' example_key ' ,
61+ 'signingKey ' => null , // added in setUp
6262 'signingAlgorithm ' => 'HS256 ' ,
6363 'issuer ' => 'app@example.com ' ,
6464 'audience ' => 'accounts.google.com ' ,
@@ -72,6 +72,12 @@ class OAuth2Test extends TestCase
7272 'clientId ' => 'myaccount.on.host.issuer.com ' ,
7373 ];
7474
75+ public function setUp (): void
76+ {
77+ $ this ->signingMinimal ['signingKey ' ] = str_repeat ('x ' , 256 );
78+ $ this ->fetchAuthTokenMinimal ['signingKey ' ] = file_get_contents (__DIR__ . '/fixtures/private.pem ' );
79+ }
80+
7581 /**
7682 * @group oauth2-authorization-uri
7783 */
@@ -598,8 +604,8 @@ public function testCanHS256EncodeAValidPayloadWithSigningKeyId()
598604 {
599605 $ testConfig = $ this ->signingMinimal ;
600606 $ keys = [
601- 'example_key_id1 ' => new Key (' example_key1 ' , 'HS256 ' ),
602- 'example_key_id2 ' => new Key (' example_key2 ' , 'HS256 ' ),
607+ 'example_key_id1 ' => new Key (str_repeat ( ' y ' , 256 ) , 'HS256 ' ),
608+ 'example_key_id2 ' => new Key (str_repeat ( ' z ' , 256 ) , 'HS256 ' ),
603609 ];
604610 $ testConfig ['signingKey ' ] = $ keys ['example_key_id2 ' ]->getKeyMaterial ();
605611 $ testConfig ['signingKeyId ' ] = 'example_key_id2 ' ;
@@ -618,8 +624,8 @@ public function testFailDecodeWithoutSigningKeyId()
618624 {
619625 $ testConfig = $ this ->signingMinimal ;
620626 $ keys = [
621- 'example_key_id1 ' => new Key (' example_key1 ' , 'HS256 ' ),
622- 'example_key_id2 ' => new Key (' example_key2 ' , 'HS256 ' ),
627+ 'example_key_id1 ' => new Key (str_repeat ( ' y ' , 256 ) , 'HS256 ' ),
628+ 'example_key_id2 ' => new Key (str_repeat ( ' z ' , 256 ) , 'HS256 ' ),
623629 ];
624630 $ testConfig ['signingKey ' ] = $ keys ['example_key_id2 ' ]->getKeyMaterial ();
625631 $ o = new OAuth2 ($ testConfig );
@@ -820,7 +826,7 @@ public function testGeneratesAssertionRequests()
820826 {
821827 $ testConfig = $ this ->tokenRequestMinimal ;
822828 $ o = new OAuth2 ($ testConfig );
823- $ o ->setSigningKey (' a_key ' );
829+ $ o ->setSigningKey (str_repeat ( ' z ' , 256 ) );
824830 $ o ->setSigningAlgorithm ('HS256 ' );
825831
826832 // Generate the request and confirm that it's correct.
0 commit comments