Package emu.grasscutter.auth
Interface AuthenticationSystem
- All Known Implementing Classes:
DefaultAuthentication
public interface AuthenticationSystem
Defines an authenticator for the server.
Can be changed by plugins.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classA data container that holds relevant data for authenticating a client. -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateAccount(String username, String password) Called when a user requests to make an account.fromComboTokenRequest(express.http.Request request, ComboTokenReqJson jsonData, ComboTokenReqJson.LoginTokenData tokenData) Generates an authentication request from aComboTokenReqJsonobject.fromExternalRequest(express.http.Request request, express.http.Response response) Generates an authentication request from aResponseobject.fromPasswordRequest(express.http.Request request, LoginAccountRequestJson jsonData) Generates an authentication request from aLoginAccountRequestJsonobject.fromTokenRequest(express.http.Request request, LoginTokenRequestJson jsonData) Generates an authentication request from aLoginTokenRequestJsonobject.This is the authenticator used for handling external authentication requests.This is the authenticator used for password authentication.This is the authenticator used for session authentication.This is the authenticator used for token authentication.voidresetPassword(String username) Called when a user requests to reset their password.booleanverifyUser(String details) Called by plugins to internally verify a user's identity.
-
Method Details
-
createAccount
Called when a user requests to make an account.- Parameters:
username- The provided username.password- The provided password. (SHA-256'ed)
-
resetPassword
Called when a user requests to reset their password.- Parameters:
username- The username of the account to reset.
-
verifyUser
Called by plugins to internally verify a user's identity.- Parameters:
details- A unique, one-time token to verify the user.- Returns:
- True if the user is verified, False otherwise.
-
getPasswordAuthenticator
Authenticator<LoginResultJson> getPasswordAuthenticator()This is the authenticator used for password authentication.- Returns:
- An authenticator.
-
getTokenAuthenticator
Authenticator<LoginResultJson> getTokenAuthenticator()This is the authenticator used for token authentication.- Returns:
- An authenticator.
-
getSessionKeyAuthenticator
Authenticator<ComboTokenResJson> getSessionKeyAuthenticator()This is the authenticator used for session authentication.- Returns:
- An authenticator.
-
getExternalAuthenticator
ExternalAuthenticator getExternalAuthenticator()This is the authenticator used for handling external authentication requests.- Returns:
- An authenticator.
-
fromPasswordRequest
static AuthenticationSystem.AuthenticationRequest fromPasswordRequest(express.http.Request request, LoginAccountRequestJson jsonData) Generates an authentication request from aLoginAccountRequestJsonobject.- Parameters:
request- The Express request.jsonData- The JSON data.- Returns:
- An authentication request.
-
fromTokenRequest
static AuthenticationSystem.AuthenticationRequest fromTokenRequest(express.http.Request request, LoginTokenRequestJson jsonData) Generates an authentication request from aLoginTokenRequestJsonobject.- Parameters:
request- The Express request.jsonData- The JSON data.- Returns:
- An authentication request.
-
fromComboTokenRequest
static AuthenticationSystem.AuthenticationRequest fromComboTokenRequest(express.http.Request request, ComboTokenReqJson jsonData, ComboTokenReqJson.LoginTokenData tokenData) Generates an authentication request from aComboTokenReqJsonobject.- Parameters:
request- The Express request.jsonData- The JSON data.- Returns:
- An authentication request.
-
fromExternalRequest
static AuthenticationSystem.AuthenticationRequest fromExternalRequest(express.http.Request request, express.http.Response response) Generates an authentication request from aResponseobject.- Parameters:
request- The Express request.response- the Express response.- Returns:
- An authentication request.
-