From 4c1fae008f5e159dbe1d5b9056f1391a352a8164 Mon Sep 17 00:00:00 2001 From: Gravit Date: Wed, 26 Dec 2018 16:41:11 +0700 Subject: [PATCH] =?UTF-8?q?Whitelist=20=D0=B4=D0=BB=D1=8F=20RejectAuthProv?= =?UTF-8?q?ider?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/provider/RejectAuthProvider.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/RejectAuthProvider.java b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/RejectAuthProvider.java index 7d63c51a..56299bd0 100644 --- a/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/RejectAuthProvider.java +++ b/LaunchServer/src/main/java/ru/gravit/launchserver/auth/provider/RejectAuthProvider.java @@ -1,6 +1,8 @@ package ru.gravit.launchserver.auth.provider; import ru.gravit.launchserver.auth.AuthException; +import ru.gravit.utils.helper.SecurityHelper; + public final class RejectAuthProvider extends AuthProvider { public RejectAuthProvider() { } @@ -10,9 +12,20 @@ public RejectAuthProvider(String message) { } private String message; + private String[] whitelist; @Override public AuthProviderResult auth(String login, String password, String ip) throws AuthException { + if(whitelist != null) + { + for(String username : whitelist) + { + if(login.equals(username)) + { + return new AuthProviderResult(login, SecurityHelper.randomStringToken()); + } + } + } return authError(message); }