@@ -42,6 +42,7 @@ public function getLoginUrl(
4242 'get ' => NULL ,
4343 'secret ' => NULL ,
4444 'algorithm ' => 'HS256 ' ,
45+ 'destination ' => NULL ,
4546 ],
4647 ) {
4748 // https://github.com/firebase/php-jwt?tab=readme-ov-file#example
@@ -56,6 +57,9 @@ public function getLoginUrl(
5657
5758 $ routeName = 'os2loop_cura_login.start ' ;
5859 $ routeParameters = [];
60+ if ($ destination = trim ($ options ['destination ' ])) {
61+ $ routeParameters ['destination ' ] = $ destination ;
62+ }
5963 $ requestOptions = [];
6064 if ($ name = $ options ['get ' ]) {
6165 $ method = Request::METHOD_GET ;
@@ -69,17 +73,23 @@ public function getLoginUrl(
6973 $ requestOptions ['form_params ' ] = ['payload ' => $ jwt ];
7074 }
7175 $ url = Url::fromRoute ($ routeName , $ routeParameters )->setAbsolute ()->toString (TRUE )->getGeneratedUrl ();
72- $ this ->io ()->writeln ($ method === Request::METHOD_POST
73- ? sprintf ('POST \'ing to %s ' , $ url )
74- : sprintf ('GET \'ing %s ' , $ url ),
75- );
76- $ response = $ this ->httpClient ->request ($ method , $ url , $ requestOptions );
7776
78- $ this ->io ()->writeln (Yaml::encode ([
79- 'status ' => $ response ->getStatusCode (),
80- 'headers ' => Yaml::encode ($ response ->getHeaders ()),
81- 'body ' => $ response ->getBody ()->getContents (),
82- ]));
77+ if ($ method === Request::METHOD_GET ) {
78+ $ this ->io ()->writeln ($ url );
79+ }
80+ else {
81+ $ this ->io ()->writeln (sprintf ('POST \'ing to %s ' , $ url ));
82+ $ response = $ this ->httpClient ->request ($ method , $ url , $ requestOptions );
83+
84+ $ contents = $ response ->getBody ()->getContents ();
85+ $ this ->io ()->writeln (Yaml::encode ([
86+ 'status ' => $ response ->getStatusCode (),
87+ 'headers ' => Yaml::encode ($ response ->getHeaders ()),
88+ 'contents ' => $ contents ,
89+ ]));
90+
91+ $ this ->io ()->writeln ($ contents );
92+ }
8393 }
8494
8595}
0 commit comments