use of org.jkiss.dbeaver.model.auth.DBAUserCredentialsProvider in project dbeaver by serge-rider.
the class AuthModelDatabaseNative method loadCredentials.
@NotNull
@Override
public CREDENTIALS loadCredentials(@NotNull DBPDataSourceContainer dataSource, @NotNull DBPConnectionConfiguration configuration) {
CREDENTIALS credentials = createCredentials();
DBPDataSourceProvider dataSourceProvider = dataSource.getDriver().getDataSourceProvider();
if (dataSourceProvider instanceof DBAUserCredentialsProvider) {
credentials.setUserName(((DBAUserCredentialsProvider) dataSourceProvider).getConnectionUserName(configuration));
credentials.setUserPassword(((DBAUserCredentialsProvider) dataSourceProvider).getConnectionUserPassword(configuration));
} else {
credentials.setUserName(configuration.getUserName());
credentials.setUserPassword(configuration.getUserPassword());
}
boolean allowsEmptyPassword = dataSource.getDriver().isAllowsEmptyPassword();
if (credentials.getUserPassword() == null && allowsEmptyPassword) {
credentials.setUserPassword("");
}
return credentials;
}
use of org.jkiss.dbeaver.model.auth.DBAUserCredentialsProvider in project dbeaver by dbeaver.
the class AuthModelDatabaseNative method loadCredentials.
@NotNull
@Override
public CREDENTIALS loadCredentials(@NotNull DBPDataSourceContainer dataSource, @NotNull DBPConnectionConfiguration configuration) {
CREDENTIALS credentials = createCredentials();
DBPDataSourceProvider dataSourceProvider = dataSource.getDriver().getDataSourceProvider();
if (dataSourceProvider instanceof DBAUserCredentialsProvider) {
credentials.setUserName(((DBAUserCredentialsProvider) dataSourceProvider).getConnectionUserName(configuration));
credentials.setUserPassword(((DBAUserCredentialsProvider) dataSourceProvider).getConnectionUserPassword(configuration));
} else {
credentials.setUserName(configuration.getUserName());
credentials.setUserPassword(configuration.getUserPassword());
}
boolean allowsEmptyPassword = dataSource.getDriver().isAllowsEmptyPassword();
if (credentials.getUserPassword() == null && allowsEmptyPassword) {
credentials.setUserPassword("");
}
return credentials;
}
Aggregations