[FIX] Удаление whitelist профиля

This commit is contained in:
Gravit 2020-03-22 03:48:48 +07:00
parent 0ddf04b6aa
commit 58a208a3f5
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
5 changed files with 0 additions and 34 deletions

View file

@ -74,7 +74,6 @@ public AuthProviderPair getAuthProviderPair() {
public ExeConf launch4j; public ExeConf launch4j;
public NettyConfig netty; public NettyConfig netty;
public String whitelistRejectString;
public LauncherConf launcher; public LauncherConf launcher;
public CertificateConf certificate; public CertificateConf certificate;
public JarSignerConf sign; public JarSignerConf sign;
@ -282,7 +281,6 @@ public static LaunchServerConfig getDefault(LaunchServer.LaunchServerEnv env) {
newConfig.auth.put("std", a); newConfig.auth.put("std", a);
newConfig.protectHandler = new StdProtectHandler(); newConfig.protectHandler = new StdProtectHandler();
newConfig.binaryName = "Launcher"; newConfig.binaryName = "Launcher";
newConfig.whitelistRejectString = "Вас нет в белом списке";
newConfig.netty = new NettyConfig(); newConfig.netty = new NettyConfig();
newConfig.netty.fileServerEnabled = true; newConfig.netty.fileServerEnabled = true;

View file

@ -82,15 +82,6 @@ public void execute(ChannelHandlerContext ctx, Client clientData) throws Excepti
AuthProvider.authError(String.format("Illegal result: '%s'", aresult.username)); AuthProvider.authError(String.format("Illegal result: '%s'", aresult.username));
return; return;
} }
Collection<ClientProfile> profiles = server.getProfiles();
for (ClientProfile p : profiles) {
if (p.getTitle().equals(client)) {
if (!p.isWhitelistContains(login)) {
throw new AuthException(server.config.whitelistRejectString);
}
clientData.profile = p;
}
}
//if (clientData.profile == null) { //if (clientData.profile == null) {
// throw new AuthException("You profile not found"); // throw new AuthException("You profile not found");
//} //}

View file

@ -31,10 +31,6 @@ public void execute(ChannelHandlerContext ctx, Client client) {
Collection<ClientProfile> profiles = server.getProfiles(); Collection<ClientProfile> profiles = server.getProfiles();
for (ClientProfile p : profiles) { for (ClientProfile p : profiles) {
if (p.getTitle().equals(this.client)) { if (p.getTitle().equals(this.client)) {
if (!p.isWhitelistContains(client.username)) {
sendError(server.config.whitelistRejectString);
return;
}
client.profile = p; client.profile = p;
sendResult(new SetProfileRequestEvent(p)); sendResult(new SetProfileRequestEvent(p));
return; return;

View file

@ -24,15 +24,6 @@ public void execute(ChannelHandlerContext ctx, Client client) {
sendError("Access denied"); sendError("Access denied");
return; return;
} }
if (!client.permissions.canAdmin) {
for (ClientProfile p : server.getProfiles()) {
if (!client.profile.getTitle().equals(p.getTitle())) continue;
if (!p.isWhitelistContains(client.username)) {
sendError("You don't download this folder");
return;
}
}
}
HashedDir dir = server.updatesDirMap.get(dirName); HashedDir dir = server.updatesDirMap.get(dirName);
if (dir == null) { if (dir == null) {
sendError(String.format("Directory %s not found", dirName)); sendError(String.format("Directory %s not found", dirName));

View file

@ -120,8 +120,6 @@ public enum ClassLoaderConfig
private final Set<OptionalFile> updateOptional = new HashSet<>(); private final Set<OptionalFile> updateOptional = new HashSet<>();
@LauncherNetworkAPI @LauncherNetworkAPI
private boolean updateFastCheck; private boolean updateFastCheck;
@LauncherNetworkAPI
private boolean useWhitelist;
// Client launcher // Client launcher
@LauncherNetworkAPI @LauncherNetworkAPI
private String mainClass; private String mainClass;
@ -132,8 +130,6 @@ public enum ClassLoaderConfig
@LauncherNetworkAPI @LauncherNetworkAPI
private final List<String> clientArgs = new ArrayList<>(); private final List<String> clientArgs = new ArrayList<>();
@LauncherNetworkAPI @LauncherNetworkAPI
private final List<String> whitelist = new ArrayList<>();
@LauncherNetworkAPI
public SecurityManagerConfig securityManagerConfig = SecurityManagerConfig.CLIENT; public SecurityManagerConfig securityManagerConfig = SecurityManagerConfig.CLIENT;
@LauncherNetworkAPI @LauncherNetworkAPI
public ClassLoaderConfig classLoaderConfig = ClassLoaderConfig.LAUNCHER; public ClassLoaderConfig classLoaderConfig = ClassLoaderConfig.LAUNCHER;
@ -383,12 +379,6 @@ public boolean isUpdateFastCheck() {
} }
public boolean isWhitelistContains(String username) {
if (!useWhitelist) return true;
return whitelist.stream().anyMatch(profileCaseSensitive ? e -> e.equals(username) : e -> e.equalsIgnoreCase(username));
}
public void setTitle(String title) { public void setTitle(String title) {
this.title = title; this.title = title;
} }