implemented oidc management
This commit is contained in:
@@ -91,10 +91,21 @@ public class UserModule extends PathHandler {
|
||||
var head = path.pop();
|
||||
return switch (head){
|
||||
case CONNECTED -> deleteServiceConnection(ex,user);
|
||||
case null, default -> super.doGet(path,ex);
|
||||
case null -> super.doGet(path,ex);
|
||||
default -> deleteService(ex,user,head);
|
||||
};
|
||||
}
|
||||
|
||||
private boolean deleteService(HttpExchange ex, UmbrellaUser user, String serviceName) throws IOException {
|
||||
if (!(user instanceof DbUser dbUser && dbUser.permissions().contains(MANAGE_LOGIN_SERVICES))) return sendEmptyResponse(HTTP_UNAUTHORIZED,ex);
|
||||
try {
|
||||
logins.delete(serviceName);
|
||||
return sendEmptyResponse(HTTP_OK,ex);
|
||||
} catch (UmbrellaException e) {
|
||||
return sendContent(ex,e.statusCode(),e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private boolean deleteServiceConnection(HttpExchange ex, UmbrellaUser user) throws IOException {
|
||||
if (user == null) return sendContent(ex,HTTP_SERVER_ERROR,"Expected user object to be of type DbUser");
|
||||
JSONObject json;
|
||||
@@ -110,7 +121,7 @@ public class UserModule extends PathHandler {
|
||||
|
||||
try {
|
||||
logins.unlink(ForeignLogin.of(serviceId,foreignId,user.id()));
|
||||
return sendEmptyResponse(OK,ex);
|
||||
return sendEmptyResponse(HTTP_OK,ex);
|
||||
} catch (UmbrellaException e) {
|
||||
return send(ex,e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user