use of org.apache.ignite.plugin.security.SecurityCredentialsProvider in project ignite by apache.
the class CommandHandler method getSecurityCredentialsProvider.
/**
* @param userName User name for authorization.
* @param password Password for authorization.
* @param clientCfg Thin client configuration to connect to cluster.
* @return Security credentials provider with usage of given user name and password.
* @throws IgniteCheckedException If error occur.
*/
@NotNull
private SecurityCredentialsProvider getSecurityCredentialsProvider(String userName, String password, GridClientConfiguration clientCfg) throws IgniteCheckedException {
SecurityCredentialsProvider securityCredential = clientCfg.getSecurityCredentialsProvider();
if (securityCredential == null)
return new SecurityCredentialsBasicProvider(new SecurityCredentials(userName, password));
final SecurityCredentials credential = securityCredential.credentials();
credential.setLogin(userName);
credential.setPassword(password);
return securityCredential;
}
Aggregations