Skip to content

Commit

Permalink
Removed license requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
skavanagh committed Dec 5, 2019
1 parent 037e040 commit 1364ee1
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 279 deletions.
13 changes: 0 additions & 13 deletions src/main/java/io/bastillion/common/db/DBInitServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@
package io.bastillion.common.db;

import io.bastillion.common.util.AppConfig;
import io.bastillion.manage.db.LicenseDB;
import io.bastillion.manage.model.Auth;
import io.bastillion.manage.util.DBUtils;
import io.bastillion.manage.util.EncryptionUtil;
import io.bastillion.manage.util.LicenseUtil;
import io.bastillion.manage.util.SSHUtil;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.RandomStringUtils;
Expand Down Expand Up @@ -143,21 +141,10 @@ public void init(ServletConfig config) throws ServletException {
if(StringUtils.isNotEmpty(str)) {
defaultPassword = EncryptionUtil.hash(str.trim() + salt);
}
LicenseDB.saveLicense(LicenseUtil.generateForEC2());
}

//license key text file
file = new File(AppConfig.class.getClassLoader().getResource(".").getPath() + "../../../../LICENSE_KEY.txt");
if (file.exists()) {
String str = FileUtils.readFileToString(file, "UTF-8");
if(StringUtils.isNotEmpty(str)) {
LicenseDB.saveLicense(str.trim());
}
}

//insert default admin user
statement.executeUpdate("insert into users (username, password, user_type, salt) values('admin', '" + defaultPassword + "','"+ Auth.MANAGER+"','"+ salt+"')");

}

DBUtils.closeRs(rs);
Expand Down
22 changes: 0 additions & 22 deletions src/main/java/io/bastillion/manage/control/UserSettingsKtrl.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@

import io.bastillion.common.util.AuthUtil;
import io.bastillion.manage.db.AuthDB;
import io.bastillion.manage.db.LicenseDB;
import io.bastillion.manage.db.PrivateKeyDB;
import io.bastillion.manage.db.UserThemeDB;
import io.bastillion.manage.model.Auth;
import io.bastillion.manage.model.UserSettings;
import io.bastillion.manage.util.LicenseUtil;
import io.bastillion.manage.util.PasswordUtil;
import loophole.mvc.annotation.Kontrol;
import loophole.mvc.annotation.MethodType;
Expand Down Expand Up @@ -76,10 +74,6 @@ public class UserSettingsKtrl extends BaseKontroller {
Auth auth;
@Model(name = "userSettings")
UserSettings userSettings;
@Model(name = "license")
String license;
@Model(name ="expirationDt")
String expirationDt;



Expand All @@ -90,11 +84,6 @@ public UserSettingsKtrl(HttpServletRequest request, HttpServletResponse response
@Kontrol(path = "/admin/userSettings", method = MethodType.GET)
public String userSettings() {
userSettings = UserThemeDB.getTheme(AuthUtil.getUserId(getRequest().getSession()));
license = LicenseDB.getLicense();
expirationDt = LicenseUtil.getExpirationDt(license);
if(StringUtils.isNotEmpty(license) && !LicenseUtil.isValid(license)) {
addError("License is invalid or has expired");
}
return "/admin/user_settings.html";
}

Expand Down Expand Up @@ -130,17 +119,6 @@ public String themeSubmit() {
return "redirect:/admin/menu.html";
}

@Kontrol(path = "/admin/licenseSubmit", method = MethodType.POST)
public String licenseSubmit() {
String retVal = "/admin/user_settings.html";
if(LicenseUtil.isValid(license)) {
LicenseDB.saveLicense(license);
retVal = "redirect:/admin/menu.html";
} else {
addError("License is invalid or has expired");
}
return retVal;
}
/**
* Validates fields for password submit
*/
Expand Down
13 changes: 1 addition & 12 deletions src/main/java/io/bastillion/manage/control/UsersKtrl.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import io.bastillion.manage.model.Auth;
import io.bastillion.manage.model.SortedSet;
import io.bastillion.manage.model.User;
import io.bastillion.manage.util.LicenseUtil;
import io.bastillion.manage.util.PasswordUtil;
import loophole.mvc.annotation.Kontrol;
import loophole.mvc.annotation.MethodType;
Expand Down Expand Up @@ -85,17 +84,7 @@ public String saveUser() {
UserDB.resetSharedSecret(user.getId());
}
} else {

if(LicenseUtil.isValid() || UserDB.getUserSet(sortedSet).getItemList().size() < 6) {
UserDB.insertUser(user);
} else {
addError("Users can no longer be added without a valid license");

userId = AuthUtil.getUserId(getRequest().getSession());
sortedSet = UserDB.getUserSet(sortedSet);

retVal="/manage/view_users.html";
}
UserDB.insertUser(user);
}
return retVal;
}
Expand Down
128 changes: 0 additions & 128 deletions src/main/java/io/bastillion/manage/db/LicenseDB.java

This file was deleted.

92 changes: 0 additions & 92 deletions src/main/java/io/bastillion/manage/util/LicenseUtil.java

This file was deleted.

12 changes: 0 additions & 12 deletions src/main/webapp/admin/user_settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,6 @@ <h3>Public Key</h3>
<p>Public SSH Key used for application authentication when provisioning EC2 instances</p>
<pre style="white-space:pre-wrap;width:600px;" th:text="${publicKey}"></pre>

<form th:if="${#strings.equals(session.userType,'M')}" th:action="@{/admin/licenseSubmit.ktrl}" method="post"
autocomplete="off">
<h3>Software License</h3>
<p>Allows you to register an unlimited amount of systems and users.<br/>To purchase a license visit <a
href="https://www.bastillion.io/subscription">www.bastillion.io/subscription</a></p>

<input type="text" name="license" size="70" th:value="${license}"/>
<input type="hidden" name="_csrf" th:value="${session._csrf}"/>
<div id="theme_btn" class="btn btn-primary submit_btn">Apply</div>
<p th:if="${!#strings.equals(expirationDt, '')}">Your license is active until <span th:text="${expirationDt}"/></p>
</form>

</div>


Expand Down

0 comments on commit 1364ee1

Please sign in to comment.