mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2026-02-06 18:17:00 +01:00
[BREAKING] Refactor OAuth handler
This commit is contained in:
@@ -131,16 +131,4 @@ public interface AuthenticationSystem {
|
||||
return AuthenticationRequest.builder().request(request)
|
||||
.response(response).build();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generates an authentication request from a {@link Response} object.
|
||||
* @param request The Express request.
|
||||
* @param jsonData The JSON data.
|
||||
* @return An authentication request.
|
||||
*/
|
||||
static AuthenticationRequest fromOAuthRequest(Request request, Response response) {
|
||||
return AuthenticationRequest.builder().request(request)
|
||||
.response(response).build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,15 +14,22 @@ public interface OAuthAuthenticator {
|
||||
void handleLogin(AuthenticationRequest request);
|
||||
|
||||
/**
|
||||
* Called when an client requests to redirect to login page.
|
||||
* Called when a client requests to redirect to login page.
|
||||
* @param request The authentication request.
|
||||
*/
|
||||
void handleDesktopRedirection(AuthenticationRequest request);
|
||||
void handleMobileRedirection(AuthenticationRequest request);
|
||||
void handleRedirection(AuthenticationRequest request, ClientType clientType);
|
||||
|
||||
/**
|
||||
* Called when an OAuth login requests callback.
|
||||
* @param request The authentication request.
|
||||
*/
|
||||
void handleTokenProcess(AuthenticationRequest request);
|
||||
|
||||
/**
|
||||
* The type of the client.
|
||||
* Used for handling redirection.
|
||||
*/
|
||||
enum ClientType {
|
||||
DESKTOP, MOBILE
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user