本文整理汇总了Java中com.hivemq.spi.security.ClientCredentialsData类的典型用法代码示例。如果您正苦于以下问题:Java ClientCredentialsData类的具体用法?Java ClientCredentialsData怎么用?Java ClientCredentialsData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClientCredentialsData类属于com.hivemq.spi.security包,在下文中一共展示了ClientCredentialsData类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkCredentials
import com.hivemq.spi.security.ClientCredentialsData; //导入依赖的package包/类
@Override
public Boolean checkCredentials(final ClientCredentialsData clientData) throws AuthenticationException {
if (clientData.getUsername().isPresent() && clientData.getPassword().isPresent()) {
//You probably want to use caching here. You can either implement it your own,
//use a caching framework or use the HiveMQ @Cached annotation on this method
return lookupInDB(clientData);
}
return false;
}
示例2: checkCredentials
import com.hivemq.spi.security.ClientCredentialsData; //导入依赖的package包/类
/**
* Method which checks username/password from credential file against the provided username/password using a cache
*
* @param clientCredentialsData holds all data about the connecting client
* @return true, if the credentials are ok, false otherwise.
*/
@Override
public Boolean checkCredentials(final ClientCredentialsData clientCredentialsData) {
try {
return this.cache.get(new ClientCredentialWrapper(clientCredentialsData));
} catch (ExecutionException e) {
log.error("Unable to load from Cache", e);
return false;
}
}
示例3: ClientCredentialWrapper
import com.hivemq.spi.security.ClientCredentialsData; //导入依赖的package包/类
private ClientCredentialWrapper(ClientCredentialsData clientCredentialsData) {
inetAddress = clientCredentialsData.getInetAddress();
password = clientCredentialsData.getPassword();
clientId = clientCredentialsData.getClientId();
username = clientCredentialsData.getUsername();
}
示例4: checkCredentials
import com.hivemq.spi.security.ClientCredentialsData; //导入依赖的package包/类
/**
* Checks the credentials after a CONNECT message arrives.
* <p/>
* return <code>true</code> when the authentication with the credentials was successful, <code>false</code> otherwise
*
* @param clientData the client credentials
* @return <code>true</code> when the authentication was successful
* @throws AuthenticationException when you want the client to disconnect immediately with a given return code
*/
Boolean checkCredentials(ClientCredentialsData clientData) throws AuthenticationException;