use of org.jkiss.dbeaver.model.connection.DBPAuthModelDescriptor in project dbeaver by serge-rider.
the class ConnectionPageWithAuth method saveSettings.
@Override
public void saveSettings(DBPDataSourceContainer dataSource) {
DBPAuthModelDescriptor selectedAuthModel = authModelSelector.getSelectedAuthModel();
dataSource.getConnectionConfiguration().setAuthModelId(selectedAuthModel == null ? null : selectedAuthModel.getId());
authModelSelector.saveSettings(dataSource);
super.saveSettings(dataSource);
}
use of org.jkiss.dbeaver.model.connection.DBPAuthModelDescriptor in project dbeaver by dbeaver.
the class ConnectionPageWithAuth method saveSettings.
@Override
public void saveSettings(DBPDataSourceContainer dataSource) {
DBPAuthModelDescriptor selectedAuthModel = authModelSelector.getSelectedAuthModel();
dataSource.getConnectionConfiguration().setAuthModelId(selectedAuthModel == null ? null : selectedAuthModel.getId());
authModelSelector.saveSettings(dataSource);
super.saveSettings(dataSource);
}
use of org.jkiss.dbeaver.model.connection.DBPAuthModelDescriptor in project dbeaver by dbeaver.
the class AuthModelSelector method loadSettings.
public void loadSettings(DBPDataSourceContainer dataSourceContainer, DBPAuthModelDescriptor activeAuthModel, String defaultAuthModelId) {
this.activeDataSource = dataSourceContainer;
this.selectedAuthModel = activeAuthModel;
this.allAuthModels = activeDataSource.getDriver() == DriverDescriptor.NULL_DRIVER ? DataSourceProviderRegistry.getInstance().getAllAuthModels() : DataSourceProviderRegistry.getInstance().getApplicableAuthModels(activeDataSource.getDriver());
this.allAuthModels.removeIf(o -> modelFilter != null && !modelFilter.isValidElement(o));
this.allAuthModels.sort((Comparator<DBPAuthModelDescriptor>) (o1, o2) -> AuthModelDatabaseNative.ID.equals(o1.getId()) ? -1 : (AuthModelDatabaseNative.ID.equals(o2.getId()) ? 1 : o1.getName().compareTo(o2.getName())));
if (selectedAuthModel == null && !CommonUtils.isEmpty(defaultAuthModelId)) {
// Set default to native
for (DBPAuthModelDescriptor amd : allAuthModels) {
if (amd.getId().equals(defaultAuthModelId)) {
selectedAuthModel = amd;
break;
}
}
if (selectedAuthModel == null) {
// First one
selectedAuthModel = allAuthModels.get(0);
}
}
changeAuthModel();
}
Aggregations