Package com.thecoderscorner.menu.auth
Class PropertiesAuthenticator
java.lang.Object
com.thecoderscorner.menu.auth.PropertiesAuthenticator
- All Implemented Interfaces:
MenuAuthenticator
Stores authentication to a properties file and then validates against the stored values. By default, there are no
authentication pairs stored, and the secure passcode is "1234"
NOTE:
This is only suited to very simple use cases where the level of security required is not particularly high and
the file system of the device is completely secured. The authentication UUIDs are stored PLAIN TEXT.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.thecoderscorner.menu.auth.MenuAuthenticator
MenuAuthenticator.ManagementCapabilities -
Constructor Summary
ConstructorsConstructorDescriptionPropertiesAuthenticator(String location) PropertiesAuthenticator(String location, DialogManager dialogManager) -
Method Summary
Modifier and TypeMethodDescriptionaddAuthentication(String user, UUID uuid, boolean needsApproval) Adds an authentication token to the store, it assumes that all appropriate permission from the user has been sought.booleanauthenticate(String user, UUID uuid) Check if the user and UUID pair can connect to this board.booleandoesPasscodeMatch(String passcode) Checks if the provided passcode matches with the security passcode and returns false if it does not match.Gets a list of all apps/users stored in the systemIndicates how this authenticator can be edited, some don't support any, some remove only.voidremoveAuthentication(String user) Remove the authentication for the given uservoidsetDialogManager(DialogManager dialogManager)
-
Constructor Details
-
PropertiesAuthenticator
-
-
Method Details
-
authenticate
Description copied from interface:MenuAuthenticatorCheck if the user and UUID pair can connect to this board.- Specified by:
authenticatein interfaceMenuAuthenticator- Parameters:
user- the user to check foruuid- the UUID to check for- Returns:
- true if the user and UUID are allowed, otherwise false
-
addAuthentication
Adds an authentication token to the store, it assumes that all appropriate permission from the user has been sought.- Specified by:
addAuthenticationin interfaceMenuAuthenticator- Parameters:
user- the user to adduuid- the uuid associated with the userneedsApproval- true if this is being added from a remote connection and needs approval, otherwise false.- Returns:
- a future that can be tracked to indicate if the authentication was accepted
-
removeAuthentication
Description copied from interface:MenuAuthenticatorRemove the authentication for the given user- Specified by:
removeAuthenticationin interfaceMenuAuthenticator- Parameters:
user- the user to remove
-
doesPasscodeMatch
Description copied from interface:MenuAuthenticatorChecks if the provided passcode matches with the security passcode and returns false if it does not match.- Specified by:
doesPasscodeMatchin interfaceMenuAuthenticator- Parameters:
passcode- the passcode to check- Returns:
- true if matching, otherwise false
-
managementCapabilities
Description copied from interface:MenuAuthenticatorIndicates how this authenticator can be edited, some don't support any, some remove only.- Specified by:
managementCapabilitiesin interfaceMenuAuthenticator- Returns:
- how the authenticator can be managed
-
getAllNames
Description copied from interface:MenuAuthenticatorGets a list of all apps/users stored in the system- Specified by:
getAllNamesin interfaceMenuAuthenticator- Returns:
- the list of users