File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 27
27
use Psr \Http \Message \RequestInterface ;
28
28
use Psr \Http \Message \ResponseInterface ;
29
29
use RandomLib \Factory as RandomFactory ;
30
+ use RandomLib \Generator as RandomGenerator ;
30
31
use UnexpectedValueException ;
31
32
32
33
/**
@@ -302,7 +303,7 @@ protected function getRandomState($length = 32)
302
303
->getRandomFactory ()
303
304
->getMediumStrengthGenerator ();
304
305
305
- return $ generator ->generateString ($ length );
306
+ return $ generator ->generateString ($ length, RandomGenerator:: CHAR_ALNUM );
306
307
}
307
308
308
309
/**
@@ -358,7 +359,7 @@ protected function getAuthorizationParameters(array $options)
358
359
$ options ['client_id ' ] = $ this ->clientId ;
359
360
$ options ['redirect_uri ' ] = $ this ->redirectUri ;
360
361
$ options ['state ' ] = $ this ->state ;
361
-
362
+
362
363
return $ options ;
363
364
}
364
365
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ public function testAuthorizationUrlStateParam()
64
64
'state ' => 'XXX '
65
65
]));
66
66
}
67
-
67
+
68
68
/**
69
69
* Tests https://github.com/thephpleague/oauth2-client/pull/485
70
70
*/
@@ -75,7 +75,7 @@ public function testCustomAuthorizationUrlOptions()
75
75
]);
76
76
$ query = parse_url ($ url , PHP_URL_QUERY );
77
77
$ this ->assertNotEmpty ($ query );
78
-
78
+
79
79
parse_str ($ query , $ params );
80
80
$ this ->assertArrayHasKey ('foo ' , $ params );
81
81
$ this ->assertSame ('BAR ' , $ params ['foo ' ]);
@@ -307,7 +307,7 @@ public function testRandomGeneratorCreatesRandomState()
307
307
$ xstate = str_repeat ('x ' , 32 );
308
308
309
309
$ generator = m::mock (RandomGenerator::class);
310
- $ generator ->shouldReceive ('generateString ' )->with (32 )->times (1 )->andReturn ($ xstate );
310
+ $ generator ->shouldReceive ('generateString ' )->with (32 , 7 )->times (1 )->andReturn ($ xstate );
311
311
312
312
$ factory = m::mock (RandomFactory::class);
313
313
$ factory ->shouldReceive ('getMediumStrengthGenerator ' )->times (1 )->andReturn ($ generator );
You can’t perform that action at this time.
0 commit comments