File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515 }
1616 ],
1717 "require" : {
18- "pdsinterop/solid-auth" : " v0.13.0 " ,
18+ "pdsinterop/solid-auth" : " v0.14.1 " ,
1919 "pdsinterop/solid-crud" : " v0.8.3" ,
2020 "phpmailer/phpmailer" : " ^6.10" ,
2121 "sweetrdf/easyrdf" : " ~1.15.0" ,
Original file line number Diff line number Diff line change 55
66 class ClientRegistration {
77 public static function getRegistration ($ clientId ) {
8- if (preg_match ("/^http(s)?:/ " , $ clientId )) {
9- return self ::getRemoteRegistration ($ clientId );
10- }
11-
128 Db::connect ();
139 $ query = Db::$ pdo ->prepare (
1410 'SELECT clientData FROM clients WHERE clientId=:clientId '
@@ -20,6 +16,14 @@ public static function getRegistration($clientId) {
2016 if (sizeof ($ result ) === 1 ) {
2117 return json_decode ($ result [0 ]['clientData ' ], true );
2218 }
19+ if (preg_match ("/^http(s)?:/ " , $ clientId )) {
20+ $ clientData = self ::getRemoteRegistration ($ clientId );
21+ if (!isset ($ clientData ['origin ' ]) && isset ($ clientData ['client_uri ' ])) {
22+ $ clientData ['origin ' ] = rtrim ($ clientData ['client_uri ' ], '/ ' );
23+ }
24+ self ::saveClientRegistration ($ clientData );
25+ return $ clientData ;
26+ }
2327 return false ;
2428 }
2529
Original file line number Diff line number Diff line change @@ -90,15 +90,17 @@ public static function respondToAuthorize() {
9090
9191 $ response = $ authServer ->respondToAuthorizationRequest ($ request , $ user , $ approval );
9292
93- $ tokenGenerator = Server::getTokenGenerator ();
93+ if (in_array ("id_token " , $ requestedResponseTypes )) {
94+ $ tokenGenerator = Server::getTokenGenerator ();
9495
95- $ response = $ tokenGenerator ->addIdTokenToResponse (
96- $ response ,
97- $ clientId ,
98- $ webId ,
99- $ _SESSION ['nonce ' ] ?? '' ,
100- Server::getKeys ()["privateKey " ]
101- );
96+ $ response = $ tokenGenerator ->addIdTokenToResponse (
97+ $ response ,
98+ $ clientId ,
99+ $ webId ,
100+ $ _SESSION ['nonce ' ] ?? '' ,
101+ Server::getKeys ()["privateKey " ]
102+ );
103+ }
102104
103105 Server::respond ($ response );
104106 }
Original file line number Diff line number Diff line change @@ -36,7 +36,14 @@ public static function respondToStorage() {
3636 $ resourceServer ->setBaseUrl ($ baseUrl );
3737 $ wac ->setBaseUrl ($ baseUrl );
3838
39- $ webId = StorageServer::getWebId ($ rawRequest );
39+ try {
40+ $ webId = StorageServer::getWebId ($ rawRequest );
41+ } catch (\Exception $ e ) {
42+ $ response = $ resourceServer ->getResponse ()
43+ -> withStatus (400 , "Bad request " );
44+ StorageServer::respond ($ response );
45+ exit ();
46+ }
4047
4148 if (!isset ($ webId )) {
4249 $ response = $ resourceServer ->getResponse ()
You can’t perform that action at this time.
0 commit comments