added optional SSL encryption

This commit is contained in:
betasteward 2015-05-28 21:04:53 -04:00
parent a168d53966
commit b41cbe2703
11 changed files with 55 additions and 13 deletions

View file

@ -212,7 +212,7 @@ public class Main implements MageServer {
try {
instance = new Main(adminPassword, testMode);
server = new Server(instance);
server.start(config.getPort());
server.start(config.getPort(), config.isUseSSL());
// Parameter: serializationtype => jboss
// InvokerLocator serverLocator = new InvokerLocator(connection.getURI());
// if (!isAlreadyRunning(serverLocator)) {
@ -1320,7 +1320,7 @@ public class Main implements MageServer {
return (MatchType) Class.forName(plugin.getTypeName(), true, classLoader).newInstance();
} catch (ClassNotFoundException ex) {
logger.warn("Game type not found:" + plugin.getJar() + " - check plugin folder", ex);
} catch (Exception ex) {
} catch (MalformedURLException | InstantiationException | IllegalAccessException ex) {
logger.fatal("Error loading game type " + plugin.getJar(), ex);
}
return null;
@ -1333,7 +1333,7 @@ public class Main implements MageServer {
return (TournamentType) Class.forName(plugin.getTypeName(), true, classLoader).newInstance();
} catch (ClassNotFoundException ex) {
logger.warn("Tournament type not found:" + plugin.getName() + " / "+ plugin.getJar() + " - check plugin folder", ex);
} catch (Exception ex) {
} catch (MalformedURLException | InstantiationException | IllegalAccessException ex) {
logger.fatal("Error loading game type " + plugin.getJar(), ex);
}
return null;

View file

@ -61,6 +61,7 @@ public class Config {
maxUserNameLength = Integer.parseInt(p.getProperty("maxUserNameLength"));
userNamePattern = p.getProperty("userNamePattern");
saveGameActivated = Boolean.parseBoolean(p.getProperty("saveGameActivated"));
useSSL = Boolean.parseBoolean(p.getProperty("useSSL"));
}
public static final String remoteServer;
@ -76,5 +77,6 @@ public class Config {
public static final int maxUserNameLength;
public static final String userNamePattern;
public static final boolean saveGameActivated;
public static final boolean useSSL;
}

View file

@ -31,6 +31,7 @@
<xs:attribute name="userNamePattern" type="xs:string" use="required"/>
<xs:attribute name="maxAiOpponents" type="xs:string" use="optional"/>
<xs:attribute name="saveGameActivated" type="xs:boolean" use="optional"/>
<xs:attribute name="useSSL" type="xs:boolean" use="optional"/>
</xs:complexType>
</xs:element>

View file

@ -120,8 +120,12 @@ public class ConfigSettings {
}
public Boolean isSaveGameActivated() {
return config.getServer().isSaveGameActivated();
}
return config.getServer().isSaveGameActivated();
}
public Boolean isUseSSL() {
return config.getServer().isUseSSL();
}
public List<Plugin> getPlayerTypes() {
return config.getPlayerTypes().getPlayerType();

View file

@ -16,6 +16,7 @@
userNamePattern="[^a-z0-9_]"
maxAiOpponents="15"
saveGameActivated="false"
useSSL="true"
/>
<playerTypes>
<playerType name="Human" jar="Mage.Player.Human.jar" className="mage.player.human.HumanPlayer"/>