Token Based Authentication #30
@ -35,8 +35,6 @@ public final class ClientConfig extends Config {
|
|||||||
put("server", "s", identity());
|
put("server", "s", identity());
|
||||||
put("port", "p", Integer::parseInt);
|
put("port", "p", Integer::parseInt);
|
||||||
put("localDB", "db", File::new);
|
put("localDB", "db", File::new);
|
||||||
put("user", "u", identity());
|
|
||||||
put("password", "pw", identity());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,28 +54,4 @@ public final class ClientConfig extends Config {
|
|||||||
* @since Envoy Client v0.1-alpha
|
* @since Envoy Client v0.1-alpha
|
||||||
*/
|
*/
|
||||||
public File getLocalDB() { return (File) items.get("localDB").get(); }
|
public File getLocalDB() { return (File) items.get("localDB").get(); }
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the user name
|
|
||||||
* @since Envoy Client v0.3-alpha
|
|
||||||
*/
|
|
||||||
public String getUser() {
|
|
||||||
final String user = (String) items.get("user").get();
|
|
||||||
return user.equals("") ? null : user;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the password
|
|
||||||
* @since Envoy Client v0.3-alpha
|
|
||||||
*/
|
|
||||||
public String getPassword() {
|
|
||||||
final String password = (String) items.get("password").get();
|
|
||||||
return password.equals("") ? null : password;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return {@code true} if user name and password are set
|
|
||||||
* @since Envoy Client v0.3-alpha
|
|
||||||
*/
|
|
||||||
public boolean hasLoginCredentials() { return getUser() != null && getPassword() != null; }
|
|
||||||
}
|
}
|
||||||
|
@ -79,16 +79,16 @@ public final class Startup extends Application {
|
|||||||
localDB.loadIDGenerator();
|
localDB.loadIDGenerator();
|
||||||
context.setLocalDB(localDB);
|
context.setLocalDB(localDB);
|
||||||
|
|
||||||
|
// Configure stage
|
||||||
stage.setTitle("Envoy");
|
stage.setTitle("Envoy");
|
||||||
stage.getIcons().add(IconUtil.loadIcon("envoy_logo"));
|
stage.getIcons().add(IconUtil.loadIcon("envoy_logo"));
|
||||||
|
|
||||||
|
// Create scene context
|
||||||
final var sceneContext = new SceneContext(stage);
|
final var sceneContext = new SceneContext(stage);
|
||||||
context.setSceneContext(sceneContext);
|
context.setSceneContext(sceneContext);
|
||||||
|
|
||||||
// Perform automatic login if configured
|
// Load login scene
|
||||||
if (config.hasLoginCredentials())
|
sceneContext.load(SceneInfo.LOGIN_SCENE);
|
||||||
performHandshake(new LoginCredentials(config.getUser(), config.getPassword(), false, Startup.VERSION, loadLastSync(config.getUser())));
|
|
||||||
else sceneContext.load(SceneInfo.LOGIN_SCENE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user