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
13
README.md
13
README.md
@ -3,12 +3,13 @@
|
||||
Grasscutter Authentication System
|
||||
|
||||
### Version Compatibility
|
||||
| GCAuth | Grasscutter Development | Grasscutter Stable |
|
||||
|---------------|-------------------------|--------------------|
|
||||
| 2.2.1+ | 1.1.2-dev | - |
|
||||
| 2.1.4 - 2.1.6 | 1.1.1-dev | - |
|
||||
| 2.0.0 - 2.1.3 | 1.0.3-dev | 1.1.0 |
|
||||
| 1.0.0 | 1.0.2-dev | - |
|
||||
| GCAuth | Grasscutter Development | Grasscutter Stable |
|
||||
|---------------|--------------------------------------------------------------------------------------------------------------------------------|--------------------|
|
||||
| 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.0.0 - 2.1.3 | 1.0.3-dev | 1.1.0 |
|
||||
| 1.0.0 | 1.0.2-dev | - |
|
||||
|
||||
### Usage :
|
||||
- Place jar inside plugins folder of Grasscutter.
|
||||
|
@ -10,7 +10,7 @@ sourceCompatibility = 17
|
||||
targetCompatibility = 17
|
||||
|
||||
group 'me.exzork.gcauth'
|
||||
version '2.3.0'
|
||||
version '2.3.1'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
@ -56,7 +56,7 @@ public class GCAuthExternalAuthenticator implements ExternalAuthenticator {
|
||||
authResponse.success = false;
|
||||
authResponse.message = "UNKNOWN"; // ENG = "An unknown error has occurred..."
|
||||
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();
|
||||
}
|
||||
response.send(authResponse);
|
||||
@ -126,7 +126,7 @@ public class GCAuthExternalAuthenticator implements ExternalAuthenticator {
|
||||
authResponse.success = false;
|
||||
authResponse.message = "UNKNOWN"; // ENG = "An unknown error has occurred..."
|
||||
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();
|
||||
}
|
||||
if (authResponse.success) {
|
||||
@ -190,7 +190,7 @@ public class GCAuthExternalAuthenticator implements ExternalAuthenticator {
|
||||
authResponse.success = false;
|
||||
authResponse.message = "UNKNOWN"; // ENG = "An unknown error has occurred..."
|
||||
authResponse.jwt = "";
|
||||
Grasscutter.getLogger().error("[Dispatch] Error while changing user password.");
|
||||
GCAuth.getInstance().getLogger().error("[Dispatch] Error while changing user password.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
response.send(authResponse);
|
||||
|
@ -5,6 +5,7 @@ import emu.grasscutter.auth.AuthenticationSystem;
|
||||
import emu.grasscutter.auth.Authenticator;
|
||||
import emu.grasscutter.game.Account;
|
||||
import emu.grasscutter.server.http.objects.LoginResultJson;
|
||||
import me.exzork.gcauth.GCAuth;
|
||||
import me.exzork.gcauth.utils.Authentication;
|
||||
|
||||
public class GCAuthenticators {
|
||||
@ -31,7 +32,7 @@ public class GCAuthenticators {
|
||||
response.data.account.token = account.generateSessionKey();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ public final class Authentication {
|
||||
return JWT.create()
|
||||
.withClaim("token", otp)
|
||||
.withClaim("username", account.getUsername())
|
||||
.withClaim("uid", account.getPlayerUid())
|
||||
.withClaim("uid", account.getReservedPlayerUid())
|
||||
.withExpiresAt(Date.from(Instant.ofEpochSecond(System.currentTimeMillis() / 1000 + GCAuth.getInstance().getConfig().jwtExpiration)))
|
||||
.sign(key);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user