@@ -159,7 +159,7 @@ public function testShowAuthPickerPageWithOcsHeader() {
159159 ->expects ($ this ->once ())
160160 ->method ('get ' )
161161 ->with ('oauth.state ' )
162- ->willReturn (' OauthStateToken ' );
162+ ->willReturn (null );
163163 $ this ->defaults
164164 ->expects ($ this ->once ())
165165 ->method ('getName ' )
@@ -182,7 +182,6 @@ public function testShowAuthPickerPageWithOcsHeader() {
182182 'urlGenerator ' => $ this ->urlGenerator ,
183183 'stateToken ' => 'StateToken ' ,
184184 'serverHost ' => 'https://example.com ' ,
185- 'oauthState ' => 'OauthStateToken ' ,
186185 ],
187186 'guest '
188187 );
@@ -223,35 +222,19 @@ public function testShowAuthPickerPageWithOauth() {
223222 ->method ('get ' )
224223 ->with ('oauth.state ' )
225224 ->willReturn ('OauthStateToken ' );
226- $ this ->defaults
225+ $ this ->urlGenerator
227226 ->expects ($ this ->once ())
228- ->method ('getName ' )
229- ->willReturn ( ' ExampleCloud ' );
230- $ this -> request
231- -> expects ( $ this -> once ())
232- -> method ( ' getServerHost ' )
233- -> willReturn ( ' example.com ' );
234- $ this -> request
235- -> method ( ' getServerProtocol ' )
236- ->willReturn ('https ' );
227+ ->method ('linkToRoute ' )
228+ ->with (
229+ ' core.ClientFlowLogin.grantPage ' ,
230+ [
231+ ' stateToken ' => ' StateToken ' ,
232+ ' clientIdentifier ' => ' MyClientIdentifier ' ,
233+ ' oauthState ' => ' OauthStateToken '
234+ ] )
235+ ->willReturn ('grantURL ' );
237236
238- $ expected = new StandaloneTemplateResponse (
239- 'core ' ,
240- 'loginflow/authpicker ' ,
241- [
242- 'client ' => 'My external service ' ,
243- 'clientIdentifier ' => 'MyClientIdentifier ' ,
244- 'instanceName ' => 'ExampleCloud ' ,
245- 'urlGenerator ' => $ this ->urlGenerator ,
246- 'stateToken ' => 'StateToken ' ,
247- 'serverHost ' => 'https://example.com ' ,
248- 'oauthState ' => 'OauthStateToken ' ,
249- ],
250- 'guest '
251- );
252- $ csp = new Http \ContentSecurityPolicy ();
253- $ csp ->addAllowedFormActionDomain ('https://example.com/redirect.php ' );
254- $ expected ->setContentSecurityPolicy ($ csp );
237+ $ expected = new Http \RedirectResponse ('grantURL ' );
255238 $ this ->assertEquals ($ expected , $ this ->clientFlowLoginController ->showAuthPickerPage ('MyClientIdentifier ' ));
256239 }
257240
0 commit comments