22
33namespace Pdsinterop \Solid \Controller ;
44
5+ use Pdsinterop \Solid \Auth \Config \Client ;
6+ use Pdsinterop \Solid \Auth \Enum \Authorization ;
7+ use Pdsinterop \Solid \Auth \Factory \ConfigFactory ;
8+
59abstract class ServerController extends AbstractController
610{
711 protected $ authServerConfig ;
@@ -58,20 +62,15 @@ public function createAuthServerConfig()
5862 $ clientId = $ _GET ['client_id ' ]; // FIXME: No request object here to get the client Id from.
5963 $ client = $ this ->getClient ($ clientId );
6064 $ keys = $ this ->getKeys ();
61- try {
62- $ config = (new ConfigFactory (
63- $ client ,
64- $ keys ['encryptionKey ' ],
65- $ keys ['privateKey ' ],
66- $ keys ['publicKey ' ],
67- $ this ->getOpenIdEndpoints ()
68- ))->create ();
69- } catch (Throwable $ e ) {
70- // var_dump($e);
71- }
7265
73- return $ config ;
74- }
66+ return (new ConfigFactory (
67+ $ client ,
68+ $ keys ['encryptionKey ' ],
69+ $ keys ['privateKey ' ],
70+ $ keys ['publicKey ' ],
71+ $ this ->getOpenIdEndpoints ()
72+ ))->create ();
73+ }
7574
7675 public function getClient ($ clientId )
7776 {
@@ -93,11 +92,9 @@ public function getClient($clientId)
9392
9493 public function createConfig ()
9594 {
96- // if (isset($_GET['client_id'])) {
9795 $ clientId = $ _GET ['client_id ' ];
9896 $ client = $ this ->getClient ($ clientId );
9997
100- // }
10198 return (new ConfigFactory (
10299 $ client ,
103100 $ this ->keys ['encryptionKey ' ],
@@ -106,6 +103,7 @@ public function createConfig()
106103 $ this ->openIdConfiguration
107104 ))->create ();
108105 }
106+
109107 public function checkApproval ($ clientId )
110108 {
111109 $ approval = Authorization::DENIED ;
@@ -121,6 +119,7 @@ public function checkApproval($clientId)
121119
122120 return $ approval ;
123121 }
122+
124123 public function getProfilePage () : string
125124 {
126125 return $ this ->baseUrl . "/profile/card#me " ; // FIXME: would be better to base this on the available routes if possible.
0 commit comments