[BREAKING] Refactor OAuth handler

This commit is contained in:
KingRainbow44
2022-05-27 19:58:04 -04:00
parent 243ad3abe5
commit 52c86afef0
3 changed files with 21 additions and 22 deletions

View File

@@ -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();
}
}

View File

@@ -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
}
}