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(io.javalin.http.Context ctx, ComboTokenReqJson jsonData, ComboTokenReqJson.LoginTokenData tokenData) Generates an authentication request from aComboTokenReqJsonobject.fromExternalRequest(io.javalin.http.Context ctx) Generates an authentication request from aContextobject.fromPasswordRequest(io.javalin.http.Context ctx, LoginAccountRequestJson jsonData) Generates an authentication request from aLoginAccountRequestJsonobject.fromTokenRequest(io.javalin.http.Context ctx, LoginTokenRequestJson jsonData) Generates an authentication request from aLoginTokenRequestJsonobject.This is the authenticator used for handling external authentication requests.This is the authenticator used for handling OAuth 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.verifyUser(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 identifier to identify the user. (For example: a JWT token)- Returns:
- The user's account if the verification was successful, null if the user was unable to be verified.
-
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.
-
getOAuthAuthenticator
OAuthAuthenticator getOAuthAuthenticator()This is the authenticator used for handling OAuth authentication requests.- Returns:
- An authenticator.
-
fromPasswordRequest
static AuthenticationSystem.AuthenticationRequest fromPasswordRequest(io.javalin.http.Context ctx, LoginAccountRequestJson jsonData) Generates an authentication request from aLoginAccountRequestJsonobject.- Parameters:
ctx- The Javalin context.jsonData- The JSON data.- Returns:
- An authentication request.
-
fromTokenRequest
static AuthenticationSystem.AuthenticationRequest fromTokenRequest(io.javalin.http.Context ctx, LoginTokenRequestJson jsonData) Generates an authentication request from aLoginTokenRequestJsonobject.- Parameters:
ctx- The Javalin context.jsonData- The JSON data.- Returns:
- An authentication request.
-
fromComboTokenRequest
static AuthenticationSystem.AuthenticationRequest fromComboTokenRequest(io.javalin.http.Context ctx, ComboTokenReqJson jsonData, ComboTokenReqJson.LoginTokenData tokenData) Generates an authentication request from aComboTokenReqJsonobject.- Parameters:
ctx- The Javalin context.jsonData- The JSON data.- Returns:
- An authentication request.
-
fromExternalRequest
Generates an authentication request from aContextobject.- Parameters:
ctx- The Javalin context.- Returns:
- An authentication request.
-