mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-31 20:59:54 +03:00
Whitelist для RejectAuthProvider
This commit is contained in:
parent
0862e3c541
commit
4c1fae008f
1 changed files with 13 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue