Search in sources :

Example 1 with SecurityCredentialsProvider

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;
}
Also used : SecurityCredentials(org.apache.ignite.plugin.security.SecurityCredentials) SecurityCredentialsProvider(org.apache.ignite.plugin.security.SecurityCredentialsProvider) SecurityCredentialsBasicProvider(org.apache.ignite.plugin.security.SecurityCredentialsBasicProvider) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

SecurityCredentials (org.apache.ignite.plugin.security.SecurityCredentials)1 SecurityCredentialsBasicProvider (org.apache.ignite.plugin.security.SecurityCredentialsBasicProvider)1 SecurityCredentialsProvider (org.apache.ignite.plugin.security.SecurityCredentialsProvider)1 NotNull (org.jetbrains.annotations.NotNull)1