Skip to content

Commit

Permalink
#3853 Fixed issue with password storage.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wouter1 committed May 3, 2016
1 parent 3cb7931 commit ae4f880
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 364 deletions.
4 changes: 2 additions & 2 deletions environment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>eishub</groupId>
<artifactId>tygronenv</artifactId>
<version>1.0.2</version>
<version>1.0.3</version>
<name>${environmentname}env</name>
<description>EIS-Tygron connector</description>
<url>http://www.github.com/eishub/${environmentname}</url>
Expand Down Expand Up @@ -60,7 +60,7 @@
<dependency>
<groupId>nl.tygron</groupId>
<artifactId>sdk</artifactId>
<version>2016.5.0.0</version>
<version>2016.5.0.2</version>
</dependency>
<dependency>
<groupId>eishub</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package tygronenv.connection;

import javax.security.auth.login.LoginException;

import eis.exceptions.ManagementException;
import login.Login;
import nl.tytech.core.client.net.ServicesManager;
import nl.tytech.core.net.Network;
import nl.tytech.core.net.serializable.ProjectData;
import nl.tytech.core.net.serializable.User;
import nl.tytech.core.net.serializable.User.AccessLevel;
import nl.tytech.core.util.SettingsManager;
import tygronenv.configuration.Configuration;
import tygronenv.settings.Settings;

/**
* The top level connection with the server. Creates connection, checks
Expand All @@ -19,6 +21,8 @@
*/
public class ServerConnection {

private final static String SERVER = "preview.tygron.com";

/**
* True if project is created by us. False if someone else created the
* project.
Expand All @@ -40,22 +44,27 @@ public class ServerConnection {
* @throws ManagementException
*/
public ServerConnection(Configuration config) throws ManagementException {
Settings credentials = new Settings();

// setup settings
SettingsManager.setup(SettingsManager.class, Network.AppType.EDITOR);
SettingsManager.setServerIP(credentials.getServerIp());
SettingsManager.setServerIP(SERVER);

String result = ServicesManager.testServerConnection();
if (result != null) {
throw new ManagementException("Server is actively refusing to connect:" + result);
}

ServicesManager.setSessionLoginCredentials(credentials.getUserName(), credentials.getPassword());
Login login;
try {
login = new Login();
} catch (LoginException e) {
throw new ManagementException("login failed", e);
}

User user = ServicesManager.getMyUserAccount();

if (user == null) {
throw new ManagementException("failed to attach user" + credentials.getUserName()
throw new ManagementException("failed to attach user" + login.getUserName()
+ ". Wrong name/pass? Please check the configuration.cfg file");
}

Expand Down
111 changes: 0 additions & 111 deletions environment/src/main/java/tygronenv/settings/Settings.java

This file was deleted.

11 changes: 7 additions & 4 deletions environment/src/test/java/tygronenv/TestEnvironment.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.HashMap;
import java.util.Map;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

Expand All @@ -20,6 +21,12 @@ public void before() {
env = new EisEnv();
}

@After
public void after() throws ManagementException, InterruptedException {
env.kill();
env = null;
}

@Test
public void testBasicConnect() throws ManagementException {
Map<String, Parameter> parameters = new HashMap<String, Parameter>();
Expand All @@ -36,7 +43,6 @@ public void testConnectAndKill() throws ManagementException {
// any stakeholder so not specified.
// any slot so not specified.
env.init(parameters);
env.kill();
}

@Test
Expand All @@ -46,7 +52,6 @@ public void testGetStakeHolder() throws ManagementException {
parameters.put("stakeholder", new Identifier("MUNICIPALITY"));
// any slot so not specified.
env.init(parameters);
env.kill();
}

@Test(expected = ManagementException.class)
Expand All @@ -56,7 +61,6 @@ public void testGetWrongStakeHolder() throws ManagementException {
parameters.put("stakeholder", new Identifier("BADSTAKEHOLDER"));
// any slot so not specified.
env.init(parameters);
env.kill();
}

@Test(expected = ManagementException.class)
Expand All @@ -66,7 +70,6 @@ public void testGetUnavailableStakeHolder() throws ManagementException {
parameters.put("stakeholder", new Identifier("FARMER"));
// any slot so not specified.
env.init(parameters);
env.kill();
}

}
Loading

0 comments on commit ae4f880

Please sign in to comment.