mirror of
https://github.com/exzork/GCAuth.git
synced 2024-11-24 00:23:58 +00:00
change getPlayerUid and use plugin logger
This commit is contained in:
parent
ac1c4b57d2
commit
738a642dba
@ -4,8 +4,9 @@ Grasscutter Authentication System
|
|||||||
|
|
||||||
### Version Compatibility
|
### Version Compatibility
|
||||||
| GCAuth | Grasscutter Development | Grasscutter Stable |
|
| GCAuth | Grasscutter Development | Grasscutter Stable |
|
||||||
|---------------|-------------------------|--------------------|
|
|---------------|--------------------------------------------------------------------------------------------------------------------------------|--------------------|
|
||||||
| 2.2.1+ | 1.1.2-dev | - |
|
| 2.3.1+ | 1.1.2-dev ( [141b191](https://github.com/Grasscutters/Grasscutter/commit/ce07f56f9d10cc79c9b7104b66c2e4ff19cd4f53) and after ) | - |
|
||||||
|
| 2.2.1 - 2.3.0 | 1.1.2-dev ( before [141b191](https://github.com/Grasscutters/Grasscutter/commit/ce07f56f9d10cc79c9b7104b66c2e4ff19cd4f53) ) | - |
|
||||||
| 2.1.4 - 2.1.6 | 1.1.1-dev | - |
|
| 2.1.4 - 2.1.6 | 1.1.1-dev | - |
|
||||||
| 2.0.0 - 2.1.3 | 1.0.3-dev | 1.1.0 |
|
| 2.0.0 - 2.1.3 | 1.0.3-dev | 1.1.0 |
|
||||||
| 1.0.0 | 1.0.2-dev | - |
|
| 1.0.0 | 1.0.2-dev | - |
|
||||||
|
@ -10,7 +10,7 @@ sourceCompatibility = 17
|
|||||||
targetCompatibility = 17
|
targetCompatibility = 17
|
||||||
|
|
||||||
group 'me.exzork.gcauth'
|
group 'me.exzork.gcauth'
|
||||||
version '2.3.0'
|
version '2.3.1'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
@ -56,7 +56,7 @@ public class GCAuthExternalAuthenticator implements ExternalAuthenticator {
|
|||||||
authResponse.success = false;
|
authResponse.success = false;
|
||||||
authResponse.message = "UNKNOWN"; // ENG = "An unknown error has occurred..."
|
authResponse.message = "UNKNOWN"; // ENG = "An unknown error has occurred..."
|
||||||
authResponse.jwt = "";
|
authResponse.jwt = "";
|
||||||
Grasscutter.getLogger().error("[Dispatch] An error occurred while a user was logging in.");
|
GCAuth.getInstance().getLogger().error("[Dispatch] An error occurred while a user was logging in.");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
response.send(authResponse);
|
response.send(authResponse);
|
||||||
@ -126,7 +126,7 @@ public class GCAuthExternalAuthenticator implements ExternalAuthenticator {
|
|||||||
authResponse.success = false;
|
authResponse.success = false;
|
||||||
authResponse.message = "UNKNOWN"; // ENG = "An unknown error has occurred..."
|
authResponse.message = "UNKNOWN"; // ENG = "An unknown error has occurred..."
|
||||||
authResponse.jwt = "";
|
authResponse.jwt = "";
|
||||||
Grasscutter.getLogger().error("[Dispatch] An error occurred while creating an account.");
|
GCAuth.getInstance().getLogger().error("[Dispatch] An error occurred while creating an account.");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
if (authResponse.success) {
|
if (authResponse.success) {
|
||||||
@ -190,7 +190,7 @@ public class GCAuthExternalAuthenticator implements ExternalAuthenticator {
|
|||||||
authResponse.success = false;
|
authResponse.success = false;
|
||||||
authResponse.message = "UNKNOWN"; // ENG = "An unknown error has occurred..."
|
authResponse.message = "UNKNOWN"; // ENG = "An unknown error has occurred..."
|
||||||
authResponse.jwt = "";
|
authResponse.jwt = "";
|
||||||
Grasscutter.getLogger().error("[Dispatch] Error while changing user password.");
|
GCAuth.getInstance().getLogger().error("[Dispatch] Error while changing user password.");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
response.send(authResponse);
|
response.send(authResponse);
|
||||||
|
@ -5,6 +5,7 @@ import emu.grasscutter.auth.AuthenticationSystem;
|
|||||||
import emu.grasscutter.auth.Authenticator;
|
import emu.grasscutter.auth.Authenticator;
|
||||||
import emu.grasscutter.game.Account;
|
import emu.grasscutter.game.Account;
|
||||||
import emu.grasscutter.server.http.objects.LoginResultJson;
|
import emu.grasscutter.server.http.objects.LoginResultJson;
|
||||||
|
import me.exzork.gcauth.GCAuth;
|
||||||
import me.exzork.gcauth.utils.Authentication;
|
import me.exzork.gcauth.utils.Authentication;
|
||||||
|
|
||||||
public class GCAuthenticators {
|
public class GCAuthenticators {
|
||||||
@ -31,7 +32,7 @@ public class GCAuthenticators {
|
|||||||
response.data.account.token = account.generateSessionKey();
|
response.data.account.token = account.generateSessionKey();
|
||||||
response.data.account.email = account.getEmail();
|
response.data.account.email = account.getEmail();
|
||||||
|
|
||||||
Grasscutter.getLogger().info("[GCAuth] Client " + requestData.account + " logged in");
|
GCAuth.getInstance().getLogger().info("[GCAuth] Client " + requestData.account + " logged in");
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ public final class Authentication {
|
|||||||
return JWT.create()
|
return JWT.create()
|
||||||
.withClaim("token", otp)
|
.withClaim("token", otp)
|
||||||
.withClaim("username", account.getUsername())
|
.withClaim("username", account.getUsername())
|
||||||
.withClaim("uid", account.getPlayerUid())
|
.withClaim("uid", account.getReservedPlayerUid())
|
||||||
.withExpiresAt(Date.from(Instant.ofEpochSecond(System.currentTimeMillis() / 1000 + GCAuth.getInstance().getConfig().jwtExpiration)))
|
.withExpiresAt(Date.from(Instant.ofEpochSecond(System.currentTimeMillis() / 1000 + GCAuth.getInstance().getConfig().jwtExpiration)))
|
||||||
.sign(key);
|
.sign(key);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user