Skip to content

Commit

Permalink
Merge pull request #1317 from virtualcell/1315-no-client-pswd
Browse files Browse the repository at this point in the history
remove all passwords from client
  • Loading branch information
jcschaff authored Jul 17, 2024
2 parents 126bde7 + 4a61faf commit cd007ba
Show file tree
Hide file tree
Showing 17 changed files with 242 additions and 445 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ private static Hashtable<KeyValue, UserLoginInfo> doQuery(String connectURL,Stri
}
String userkey = rset.getString("userkey");
if(userLoginInfo == null || !userLoginInfo.getUserName().equals(userid)){
userLoginInfo = new UserLoginInfo(userid,DigestedPassword.createAlreadyDigested(rset.getString("digestpw")));
userLoginInfo = new UserLoginInfo(userid);
userLoginInfo.setUser(new User(userid, new KeyValue(userkey)));
}
VCSimulationIdentifier vcSimulationIdentifier = new VCSimulationIdentifier(simJobSimRef, userLoginInfo.getUser());
Expand Down Expand Up @@ -1005,7 +1005,7 @@ private static void runSim(SimIDAndJobID simIDAndJobID) throws Exception{
return;
}
VCSimulationIdentifier vcSimulationIdentifier = new VCSimulationIdentifier(simIDAndJobID.simID, simIDAndJobID.user);
UserLoginInfo userLoginInfo = new UserLoginInfo(simIDAndJobID.user.getName(), new DigestedPassword("xoxoxox"));
UserLoginInfo userLoginInfo = new UserLoginInfo(simIDAndJobID.user.getName());
//getVcellClient().getClientServerManager().getConnectionStatus()
VCellConnection vcellConnection = userConnections.get(simIDAndJobID.user);
try{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ public enum AuthenticationPolicy {
public static final String HEALTH = "health";

public static final String HEALTH_CHECK = "check";
public static final String HEALTH_CHECK_LOGIN = "login";
public static final String HEALTH_CHECK_SIM = "sim";
public static final String HEALTH_CHECK_STATUS_TIMESTAMP = "status_timestamp";
public static final String HEALTH_CHECK_ALL = "all";
Expand Down
5 changes: 2 additions & 3 deletions vcell-api/src/main/java/org/vcell/rest/VCellApiMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,9 @@ public void onException(Exception e) {
boolean bIgnoreCertProblemsForHealthService = PropertyLoader.getBooleanProperty(PropertyLoader.sslIgnoreCertProblems, false);
User testUser = localAdminDbServer.getUser(TEST_USER);
UserInfo testUserInfo = localAdminDbServer.getUserInfo(testUser.getID()); // lookup hashed auth credentials in database.
String pathPrefixV0 = PropertyLoader.getRequiredProperty(PropertyLoader.vcellServerPrefixV0);
HealthService healthService = new HealthService(restEventService, "localhost", port, pathPrefixV0,
HealthService healthService = new HealthService(vcMessagingService_int, databaseServerImpl, restEventService,
bIgnoreCertProblemsForHealthService, bIgnoreHostMismatchForHealthService,
testUserInfo.userid, testUserInfo.digestedPassword0);
testUserInfo);
AdminService adminService = new AdminService(adminDbTopLevel, databaseServerImpl);
RpcService rpcService = new RpcService(vcMessagingService_int);
WadlApplication app = new VCellApiApplication(restDatabaseService, userService, rpcService, restEventService, adminService, templateConfiguration, healthService, javascriptDir);
Expand Down
17 changes: 3 additions & 14 deletions vcell-api/src/main/java/org/vcell/rest/health/HealthRestlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@ public final class HealthRestlet extends Restlet {
private final static Logger lg = LogManager.getLogger(HealthRestlet.class);

enum RequestType {
login,
sim,
all
};
}


public HealthRestlet(Context context) {
Expand All @@ -43,17 +42,15 @@ public void handle(Request req, Response response) {
String requestTypeString = form.getFirstValue(VCellApiApplication.HEALTH_CHECK, true);
RequestType requestType = null;
if (requestTypeString!=null) {
if (requestTypeString.equalsIgnoreCase(VCellApiApplication.HEALTH_CHECK_LOGIN)) {
requestType = RequestType.login;
}else if (requestTypeString.equalsIgnoreCase(VCellApiApplication.HEALTH_CHECK_SIM)) {
if (requestTypeString.equalsIgnoreCase(VCellApiApplication.HEALTH_CHECK_SIM)) {
requestType = RequestType.sim;
}else if (requestTypeString.equalsIgnoreCase(VCellApiApplication.HEALTH_CHECK_ALL)) {
requestType = RequestType.all;
}
}
if (requestType==null){
throw new RuntimeException("expecting /"+VCellApiApplication.HEALTH+"?"+VCellApiApplication.HEALTH_CHECK+"="+
"("+VCellApiApplication.HEALTH_CHECK_LOGIN+"|"+VCellApiApplication.HEALTH_CHECK_SIM+"|"+VCellApiApplication.HEALTH_CHECK_ALL+")"
"("+VCellApiApplication.HEALTH_CHECK_SIM+"|"+VCellApiApplication.HEALTH_CHECK_ALL+")"
+ "[&"+VCellApiApplication.HEALTH_CHECK_ALL_START_TIMESTAMP+"=<start_ms>]"
+ "[&"+VCellApiApplication.HEALTH_CHECK_ALL_END_TIMESTAMP+"=<end_ms>]"
+ "[&"+VCellApiApplication.HEALTH_CHECK_STATUS_TIMESTAMP+"=<status_ms>]");
Expand Down Expand Up @@ -92,14 +89,6 @@ public void handle(Request req, Response response) {
response.setEntity(new JsonRepresentation(healthEventsJSON));
break;
}
case login:{
NagiosStatus nagiosStatus = healthService.getLoginStatus(status_timestamp);
Gson gson = new Gson();
String statusJSON = gson.toJson(nagiosStatus);
response.setStatus(Status.SUCCESS_OK);
response.setEntity(new JsonRepresentation(statusJSON));
break;
}
case sim:{
NagiosStatus nagiosStatus = healthService.getRunsimStatus(status_timestamp);
Gson gson = new Gson();
Expand Down
Loading

0 comments on commit cd007ba

Please sign in to comment.