mirror of
https://github.com/Xtao-Labs/GCAuth-OAuth.git
synced 2024-11-21 22:58:10 +00:00
🐛 Adapt upstream breaking changes PR#956
This commit is contained in:
parent
008318fae1
commit
93991bb178
@ -10,7 +10,7 @@ sourceCompatibility = 17
|
||||
targetCompatibility = 17
|
||||
|
||||
group 'com.xtaolabs.gcauth_oauth'
|
||||
version '1.1.2'
|
||||
version '1.1.3'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
@ -38,11 +38,8 @@ public class GCAuth_OAuth extends Plugin {
|
||||
|
||||
HttpServer app = Grasscutter.getHttpServer();
|
||||
|
||||
app.addRouter(JsonHandler.class);
|
||||
app.addRouter(RequestHandler.class);
|
||||
app.addRouter(sdkHandler.class);
|
||||
app.addRouter(VerifyHandler.class);
|
||||
|
||||
app.getHandle().config.addStaticFiles("/gcauth_oauth", folder_name, Location.EXTERNAL);
|
||||
app.getHandle().config.addStaticFiles("gcauth_oauth", folder_name, Location.EXTERNAL);
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ public class GCAuthAuthenticationHandler implements AuthenticationSystem {
|
||||
private final Authenticator<LoginResultJson> tokenAuthenticator = new GCAuthenticators.TokenAuthenticator();
|
||||
private final Authenticator<ComboTokenResJson> sessionKeyAuthenticator = new DefaultAuthenticators.SessionKeyAuthenticator();
|
||||
private final GCAuthExternalAuthenticator externalAuthenticator = new GCAuthExternalAuthenticator();
|
||||
private final OAuthAuthenticator oAuthAuthenticator = new GCAuthenticators.OAuthAuthentication();
|
||||
|
||||
@Override
|
||||
public void createAccount(String username, String password) {
|
||||
@ -48,4 +49,9 @@ public class GCAuthAuthenticationHandler implements AuthenticationSystem {
|
||||
public ExternalAuthenticator getExternalAuthenticator() {
|
||||
return externalAuthenticator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OAuthAuthenticator getOAuthAuthenticator() {
|
||||
return this.oAuthAuthenticator;
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.xtaolabs.gcauth_oauth.handler;
|
||||
import emu.grasscutter.Grasscutter;
|
||||
import emu.grasscutter.auth.AuthenticationSystem;
|
||||
import emu.grasscutter.auth.Authenticator;
|
||||
import emu.grasscutter.auth.OAuthAuthenticator;
|
||||
import emu.grasscutter.database.DatabaseHelper;
|
||||
import emu.grasscutter.game.Account;
|
||||
import emu.grasscutter.server.http.objects.LoginResultJson;
|
||||
@ -84,4 +85,30 @@ public class GCAuthenticators {
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles authentication requests from OAuth sources.
|
||||
*/
|
||||
public static class OAuthAuthentication implements OAuthAuthenticator {
|
||||
@Override
|
||||
public void handleLogin(AuthenticationSystem.AuthenticationRequest request) {
|
||||
assert request.getResponse() != null;
|
||||
VerifyHandler.handle(request.getRequest(), request.getResponse());
|
||||
}
|
||||
|
||||
@Override public void handleDesktopRedirection(AuthenticationSystem.AuthenticationRequest request) {
|
||||
assert request.getResponse() != null;
|
||||
JsonHandler.handle(request.getRequest(), request.getResponse());
|
||||
}
|
||||
|
||||
@Override public void handleMobileRedirection(AuthenticationSystem.AuthenticationRequest request) {
|
||||
assert request.getResponse() != null;
|
||||
sdkHandler.handle(request.getRequest(), request.getResponse());
|
||||
}
|
||||
|
||||
@Override public void handleTokenProcess(AuthenticationSystem.AuthenticationRequest request) {
|
||||
assert request.getResponse() != null;
|
||||
request.getResponse().send("Authentication is not available with the default authentication method.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "GCAuth_OAuth",
|
||||
"description": "The in-game login system for Grasscutter is based on oauth and GCAuth.",
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.3",
|
||||
"author": ["omg-xtao"],
|
||||
"mainClass": "com.xtaolabs.gcauth_oauth.GCAuth_OAuth"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user