Class PreDefinedAuthenticator

java.lang.Object
com.thecoderscorner.menu.auth.PreDefinedAuthenticator
All Implemented Interfaces:
MenuAuthenticator

public class PreDefinedAuthenticator extends Object implements MenuAuthenticator
Implements the authentication interface using a pre-defined upfront set of name and UUID pairs that must be provided upfront. This implementation will never save authentication blocks to storage.
  • Constructor Details

  • Method Details

    • addAuthentication

      public CompletableFuture<Boolean> addAuthentication(String name, UUID uuid, boolean needsApproval)
      Description copied from interface: MenuAuthenticator
      Attempt to add authentication for user and UUID, if it fails to be added false will be returned.
      Specified by:
      addAuthentication in interface MenuAuthenticator
      Parameters:
      name - the user to add
      uuid - the uuid associated with the user
      needsApproval - true if this is being added from a remote connection and needs approval, otherwise false.
      Returns:
      true if added, otherwise false.
    • removeAuthentication

      public void removeAuthentication(String user)
      Description copied from interface: MenuAuthenticator
      Remove the authentication for the given user
      Specified by:
      removeAuthentication in interface MenuAuthenticator
      Parameters:
      user - the user to remove
    • authenticate

      public boolean authenticate(String user, UUID uuid)
      Description copied from interface: MenuAuthenticator
      Check if the user and UUID pair can connect to this board.
      Specified by:
      authenticate in interface MenuAuthenticator
      Parameters:
      user - the user to check for
      uuid - the UUID to check for
      Returns:
      true if the user and UUID are allowed, otherwise false
    • doesPasscodeMatch

      public boolean doesPasscodeMatch(String passcode)
      Description copied from interface: MenuAuthenticator
      Checks if the provided passcode matches with the security passcode and returns false if it does not match.
      Specified by:
      doesPasscodeMatch in interface MenuAuthenticator
      Parameters:
      passcode - the passcode to check
      Returns:
      true if matching, otherwise false
    • managementCapabilities

      public MenuAuthenticator.ManagementCapabilities managementCapabilities()
      Description copied from interface: MenuAuthenticator
      Indicates how this authenticator can be edited, some don't support any, some remove only.
      Specified by:
      managementCapabilities in interface MenuAuthenticator
      Returns:
      how the authenticator can be managed
    • getAllNames

      public List<String> getAllNames()
      Description copied from interface: MenuAuthenticator
      Gets a list of all apps/users stored in the system
      Specified by:
      getAllNames in interface MenuAuthenticator
      Returns:
      the list of users