@@ -117,7 +117,7 @@ public function openid() {
117117 $ response = new \Laminas \Diactoros \Response ();
118118 $ server = new \Pdsinterop \Solid \Auth \Server ($ this ->authServerFactory , $ this ->authServerConfig , $ response );
119119 $ response = $ server ->respondToOpenIdMetadataRequest ();
120- return $ this ->respond ($ response );
120+ return $ this ->respond ($ response )-> withHeader ( ' Access-Control-Allow-Origin ' , ' * ' ) ;
121121 }
122122
123123 /**
@@ -129,7 +129,7 @@ public function authorize() {
129129 if (!$ this ->userManager ->userExists ($ this ->userId )) {
130130 $ result = new JSONResponse ('Authorization required ' );
131131 $ result ->setStatus (401 );
132- return $ result ;
132+ return $ result-> withHeader ( ' Access-Control-Allow-Origin ' , ' * ' ) ;
133133 }
134134
135135 $ parser = new \Lcobucci \JWT \Parser ();
@@ -154,7 +154,7 @@ public function authorize() {
154154 } catch (\Exception $ e ) {
155155 $ result = new JSONResponse ('Bad request, missing redirect uri ' );
156156 $ result ->setStatus (400 );
157- return $ result ;
157+ return $ result-> withHeader ( ' Access-Control-Allow-Origin ' , ' * ' ) ;
158158 }
159159 }
160160 $ clientId = $ getVars ['client_id ' ];
@@ -164,7 +164,7 @@ public function authorize() {
164164 $ result ->setStatus (302 );
165165 $ approvalUrl = $ this ->urlGenerator ->getAbsoluteURL ($ this ->urlGenerator ->linkToRoute ("solid.page.approval " , array ("clientId " => $ clientId , "returnUrl " => $ _SERVER ['REQUEST_URI ' ])));
166166 $ result ->addHeader ("Location " , $ approvalUrl );
167- return $ result ;
167+ return $ result-> withHeader ( ' Access-Control-Allow-Origin ' , ' * ' ) ;
168168 }
169169
170170 $ user = new \Pdsinterop \Solid \Auth \Entity \User ();
@@ -177,7 +177,7 @@ public function authorize() {
177177 $ response = $ server ->respondToAuthorizationRequest ($ request , $ user , $ approval );
178178 $ response = $ this ->tokenGenerator ->addIdTokenToResponse ($ response , $ clientId , $ this ->getProfilePage (), $ this ->session ->get ("nonce " ), $ this ->config ->getPrivateKey ());
179179
180- return $ this ->respond ($ response );
180+ return $ this ->respond ($ response )-> withHeader ( ' Access-Control-Allow-Origin ' , ' * ' ) ;
181181 }
182182
183183 private function checkApproval ($ clientId ) {
@@ -250,7 +250,7 @@ public function token() {
250250 $ codeInfo = $ this ->tokenGenerator ->getCodeInfo ($ code );
251251 $ response = $ this ->tokenGenerator ->addIdTokenToResponse ($ response , $ clientId , $ codeInfo ['user_id ' ], $ _SESSION ['nonce ' ], $ this ->config ->getPrivateKey (), $ dpopKey );
252252
253- return $ this ->respond ($ response );
253+ return $ this ->respond ($ response )-> withHeader ( ' Access-Control-Allow-Origin ' , ' * ' ) ;
254254 }
255255
256256 /**
@@ -297,7 +297,7 @@ public function register() {
297297
298298 $ registration = $ this ->tokenGenerator ->respondToRegistration ($ registration , $ this ->config ->getPrivateKey ());
299299
300- return new JSONResponse ($ registration );
300+ return ( new JSONResponse ($ registration))-> addHeader ( ' Access-Control-Allow-Origin ' , ' https://noeldemartin.github.io ' );
301301 }
302302
303303 /**
@@ -348,6 +348,7 @@ private function respond($response) {
348348 }
349349 }
350350 $ result ->setStatus ($ statusCode );
351+ $ result ->addHeader ('Access-Control-Allow-Origin ' , '* ' );
351352 return $ result ;
352353 }
353354
0 commit comments