@@ -26,81 +26,6 @@ public function __construct(IConfig $config, IUrlGenerator $urlGenerator, IUserM
2626 parent ::__construct ($ config );
2727 }
2828
29- /**
30- * @param string $clientId
31- * @return array|null
32- */
33- public function getClientConfigById ($ clientId ) {
34- $ clients = (array )$ this ->config ->getAppValue ('solid ' ,'clients ' );
35- if (array_key_exists ($ clientId , $ clients )) {
36- return $ clients [$ clientId ];
37- }
38- return null ;
39- }
40-
41- /**
42- * @return array|null
43- */
44- public function getClients () {
45- $ clients = (array )$ this ->config ->getAppKeys ('solid ' );
46- return $ clients ;
47- }
48-
49- /**
50- * @param array $clientConfig
51- * @return string
52- */
53- public function saveClientConfig ($ clientConfig ) {
54- $ clients = (array )$ this ->config ->getAppValue ('solid ' , 'clients ' );
55- $ clientId = uuidv4 ();
56- $ clients [$ clientId ] = $ clientConfig ;
57- $ this ->config ->setAppValue ('solid ' ,'clients ' , $ clients );
58- return $ clientId ;
59- }
60-
61- /**
62- * @param string $clientId
63- * @param array $scopes
64- */
65- public function addScopesToClient ($ clientId , $ scopes ) {
66- $ clientScopes = $ this ->getClientScopes ($ clientId );
67- $ clientScopes = array_unique (array_merge ($ clientScopes , $ scopes ));
68- $ this ->setClientScopes ($ clientId , $ clientScopes );
69- }
70-
71- /**
72- * @param string $clientId
73- * @param array $scopes
74- */
75- public function setClientScopes ($ clientId , $ scopes ) {
76- $ clientScopes = (array )$ this ->config ->getAppValue ('solid ' , 'clientScopes ' );
77- $ clientScopes [$ clientId ] = $ scopes ;
78- $ this ->config ->setAppValue ('solid ' , 'clientScopes ' , $ clientScopes );
79- }
80-
81- /**
82- * @param string $clientId
83- * @return array
84- */
85- public function getClientScopes ($ clientId ) {
86- $ clientScopes = (array )$ this ->config ->getAppValue ('solid ' , 'clientScopes ' );
87- if (array_key_exists ($ clientId , $ clientScopes )) {
88- return $ clientScopes [$ clientId ];
89- }
90- return [];
91- }
92-
93- /**
94- * @param string $clientId
95- */
96- public function removeClientConfig ($ clientId ) {
97- $ clients = (array )$ this ->config ->getAppValue ('solid ' , 'clients ' );
98- unset($ clients [$ clientId ]);
99- $ this ->config ->setAppValue ('solid ' ,'clients ' , $ clients );
100- $ scopes = (array )$ this ->config ->getAppValue ('solid ' , 'clientScopes ' );
101- unset($ scopes [$ clientId ]);
102- $ this ->config ->setAppValue ('solid ' , 'clientScopes ' , $ scopes );
103- }
10429 public function getAllowedClients ($ userId ) {
10530 return json_decode ($ this ->config ->getUserValue ($ userId , 'solid ' , "allowedClients " , "[] " ), true );
10631 }
@@ -116,33 +41,6 @@ public function removeAllowedClient($userId, $clientId) {
11641 $ this ->config ->setUserValue ($ userId , "solid " , "allowedClients " , json_encode ($ allowedClients ));
11742 }
11843
119- public function saveClientRegistration ($ origin , $ clientData ) {
120- $ originHash = md5 ($ origin );
121- $ existingRegistration = $ this ->getClientRegistration ($ originHash );
122- if ($ existingRegistration && isset ($ existingRegistration ['redirect_uris ' ])) {
123- foreach ($ existingRegistration ['redirect_uris ' ] as $ uri ) {
124- $ clientData ['redirect_uris ' ][] = $ uri ;
125- }
126- $ clientData ['redirect_uris ' ] = array_unique ($ clientData ['redirect_uris ' ]);
127- }
128-
129- $ clientData ['client_name ' ] = $ origin ;
130- $ clientData ['client_secret ' ] = md5 (random_bytes (32 ));
131- $ this ->config ->setAppValue ('solid ' , "client- " . $ originHash , json_encode ($ clientData ));
132-
133- $ this ->config ->setAppValue ('solid ' , "client- " . $ origin , json_encode ($ clientData ));
134- return $ originHash ;
135- }
136-
137- public function removeClientRegistration ($ clientId ) {
138- $ this ->config ->deleteAppValue ('solid ' , "client- " . $ clientId );
139- }
140-
141- public function getClientRegistration ($ clientId ) {
142- $ data = $ this ->config ->getAppValue ('solid ' , "client- " . $ clientId , "{} " );
143- return json_decode ($ data , true );
144- }
145-
14644 public function getProfileData ($ userId ) {
14745 return $ this ->config ->getUserValue ($ userId , "solid " , "profileData " , "" );
14846 }
0 commit comments