Interface AuthenticationSystem

All Known Implementing Classes:
DefaultAuthentication

public interface AuthenticationSystem
Defines an authenticator for the server. Can be changed by plugins.
  • Method Details

    • createAccount

      void createAccount(String username, String password)
      Called when a user requests to make an account.
      Parameters:
      username - The provided username.
      password - The provided password. (SHA-256'ed)
    • resetPassword

      void resetPassword(String username)
      Called when a user requests to reset their password.
      Parameters:
      username - The username of the account to reset.
    • verifyUser

      Account verifyUser(String details)
      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 a LoginAccountRequestJson object.
      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 a LoginTokenRequestJson object.
      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 a ComboTokenReqJson object.
      Parameters:
      ctx - The Javalin context.
      jsonData - The JSON data.
      Returns:
      An authentication request.
    • fromExternalRequest

      static AuthenticationSystem.AuthenticationRequest fromExternalRequest(io.javalin.http.Context ctx)
      Generates an authentication request from a Context object.
      Parameters:
      ctx - The Javalin context.
      Returns:
      An authentication request.