Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2024-07-22 20:55:52 +02:00
parent 2158d62da1
commit d1b8a392f4
2 changed files with 3 additions and 4 deletions

View File

@@ -59,7 +59,7 @@ public class Backend extends PathHandler {
var json = json(ex);
var id = json.getString(CLIENT_ID);
clients.getClient(id).ifPresent(clients::remove);
return sendEmptyResponse(HTTP_OK,ex);
return sendEmptyResponse(HTTP_OK, ex);
}
private boolean doLogin(HttpExchange ex) throws IOException {

View File

@@ -207,7 +207,7 @@ public class FileStore implements ClientService, SessionService, UserService {
@Override
public Optional<Client> getClient(String clientId) {
var clients = json.getJSONObject(CLIENTS);
if (clients.has(clientId)) return Optional.of(toClient(clientId,clients.getJSONObject(clientId)));
if (clients.has(clientId)) return Optional.of(toClient(clientId, clients.getJSONObject(clientId)));
return Optional.empty();
}
@@ -217,14 +217,13 @@ public class FileStore implements ClientService, SessionService, UserService {
if (o instanceof String s) redirectUris.add(s);
}
return new Client(clientId, clientData.getString(NAME), clientData.getString(SECRET), redirectUris);
}
@Override
public List<Client> listClients() {
var clients = json.getJSONObject(CLIENTS);
var list = new ArrayList<Client>();
for (var clientId : clients.keySet()) list.add(toClient(clientId,clients.getJSONObject(clientId)));
for (var clientId : clients.keySet()) list.add(toClient(clientId, clients.getJSONObject(clientId)));
return list;
}