Skip to content

Commit

Permalink
Fix Application with globalkeymanager and cross tenant subscription i…
Browse files Browse the repository at this point in the history
…mport fail through CURL command

Fixes wso2/api-manager#2800
  • Loading branch information
RusJaI committed Apr 22, 2024
1 parent 18b300f commit 5657a9c
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9382,11 +9382,12 @@ public List<KeyManagerConfigurationDTO> getKeyManagerConfigurationsByOrganizatio
public KeyManagerConfigurationDTO getKeyManagerConfigurationByID(String organization, String id)
throws APIManagementException {

final String query = "SELECT * FROM AM_KEY_MANAGER WHERE UUID = ? AND ORGANIZATION = ?";
final String query = "SELECT * FROM AM_KEY_MANAGER WHERE UUID = ? AND (ORGANIZATION = ? OR ORGANIZATION = ?)";
try (Connection conn = APIMgtDBUtil.getConnection();
PreparedStatement preparedStatement = conn.prepareStatement(query)) {
preparedStatement.setString(1, id);
preparedStatement.setString(2, organization);
preparedStatement.setString(3, APIConstants.GLOBAL_KEY_MANAGER_TENANT_DOMAIN);
try (ResultSet resultSet = preparedStatement.executeQuery()) {
if (resultSet.next()) {
KeyManagerConfigurationDTO keyManagerConfigurationDTO = new KeyManagerConfigurationDTO();
Expand Down Expand Up @@ -9440,7 +9441,6 @@ public boolean isIDPExistInOrg(String organization, String resourceId) throws AP
public KeyManagerConfigurationDTO getKeyManagerConfigurationByName(String organization, String name)
throws APIManagementException {

final String query = "SELECT * FROM AM_KEY_MANAGER WHERE NAME = ? AND ORGANIZATION = ?";
try (Connection conn = APIMgtDBUtil.getConnection()) {
return getKeyManagerConfigurationByName(conn, organization, name);
} catch (SQLException | IOException e) {
Expand All @@ -9454,10 +9454,11 @@ private KeyManagerConfigurationDTO getKeyManagerConfigurationByName(Connection c
String name)
throws SQLException, IOException, APIManagementException {

final String query = "SELECT * FROM AM_KEY_MANAGER WHERE NAME = ? AND ORGANIZATION = ?";
final String query = "SELECT * FROM AM_KEY_MANAGER WHERE NAME = ? AND (ORGANIZATION = ? OR ORGANIZATION = ?)";
try (PreparedStatement preparedStatement = connection.prepareStatement(query)) {
preparedStatement.setString(1, name);
preparedStatement.setString(2, organization);
preparedStatement.setString(3, APIConstants.GLOBAL_KEY_MANAGER_TENANT_DOMAIN);
try (ResultSet resultSet = preparedStatement.executeQuery()) {
if (resultSet.next()) {
KeyManagerConfigurationDTO keyManagerConfigurationDTO = new KeyManagerConfigurationDTO();
Expand Down

0 comments on commit 5657a9c

Please sign in to comment.