Package io.moquette.broker.security
Class ResourceAuthenticator
- java.lang.Object
-
- io.moquette.broker.security.ResourceAuthenticator
-
- All Implemented Interfaces:
IAuthenticator
- Direct Known Subclasses:
FileAuthenticator
public class ResourceAuthenticator extends Object implements IAuthenticator
Load user credentials from a text resource. Each line of the file is formatted as "[username]:[sha256(password)]". The username mustn't contains : char. To encode your password from command line on Linux systems, you could use:echo -n "yourpassword" | sha256sumNB -n is important because echo append a newline by default at the of string. -n avoid this behaviour.
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.LoggerLOG
-
Constructor Summary
Constructors Constructor Description ResourceAuthenticator(IResourceLoader resourceLoader, String resourceName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckValid(String clientId, String username, byte[] password)
-
-
-
Constructor Detail
-
ResourceAuthenticator
public ResourceAuthenticator(IResourceLoader resourceLoader, String resourceName)
-
-
Method Detail
-
checkValid
public boolean checkValid(String clientId, String username, byte[] password)
- Specified by:
checkValidin interfaceIAuthenticator
-
-