mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-01-03 22:30:31 +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;
|
package ru.gravit.launchserver.auth.provider;
|
||||||
|
|
||||||
import ru.gravit.launchserver.auth.AuthException;
|
import ru.gravit.launchserver.auth.AuthException;
|
||||||
|
import ru.gravit.utils.helper.SecurityHelper;
|
||||||
|
|
||||||
public final class RejectAuthProvider extends AuthProvider {
|
public final class RejectAuthProvider extends AuthProvider {
|
||||||
public RejectAuthProvider() {
|
public RejectAuthProvider() {
|
||||||
}
|
}
|
||||||
|
@ -10,9 +12,20 @@ public RejectAuthProvider(String message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String message;
|
private String message;
|
||||||
|
private String[] whitelist;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AuthProviderResult auth(String login, String password, String ip) throws AuthException {
|
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);
|
return authError(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue