Skip to content

Commit 9edfb22

Browse files
author
Chris Wiechmann
committed
Empty HTTP-Basic Password handling improved (Outbound)
1 parent e7f2575 commit 9edfb22

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

modules/apim-adapter/src/main/java/com/axway/apim/api/model/AuthenticationProfile.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,30 @@ public boolean equals(Object other) {
6464
Map<String, Object> thisParameters = this.getParameters();
6565
otherParameters.remove("_id_");
6666
thisParameters.remove("_id_");
67+
// Passwords are no longer exposed by API-Manager REST-API - Can't use it anymore to compare the state
68+
Object otherPassword = null;
69+
Object thisPassword = null;
6770
if(APIManagerAdapter.hasAPIManagerVersion("7.7 SP1") || APIManagerAdapter.hasAPIManagerVersion("7.6.2 SP5")) {
68-
// Password no longer exposed by API-Manager REST-API - Can't use it anymore to compare the state
69-
otherParameters.remove("password");
70-
thisParameters.remove("password");
71+
// Empty password handling - Make sure, there is a password set
72+
if(!thisParameters.containsKey("password") || thisParameters.get("password")==null) thisParameters.put("password", "");
73+
if(!otherParameters.containsKey("password") || otherParameters.get("password")==null) otherParameters.put("password", "");
74+
if(otherParameters.containsKey("password")) {
75+
otherPassword = otherParameters.get("password");
76+
otherParameters.remove("password");
77+
}
78+
if(thisParameters.containsKey("password")) {
79+
thisPassword = thisParameters.get("password");
80+
thisParameters.remove("password");
81+
}
7182
}
7283

7384
boolean rc = StringUtils.equals(authenticationProfile.getName(), this.getName())
7485
&& authenticationProfile.getIsDefault() == this.getIsDefault()
7586
&& StringUtils.equals(authenticationProfile.getType().name(),this.getType().name())
7687
&& otherParameters.equals(thisParameters);
88+
// Restore that password, that have been removed
89+
if(otherPassword!=null) otherParameters.put("password", otherPassword);
90+
if(thisPassword!=null) thisParameters.put("password", thisPassword);
7791
return rc;
7892
} else {
7993
return false;

modules/apis/src/main/java/com/axway/apim/apiimport/DesiredAPI.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import com.axway.apim.lib.errorHandling.AppException;
2020
import com.axway.apim.lib.errorHandling.ErrorCode;
2121
import com.axway.apim.lib.errorHandling.ErrorState;
22-
import com.fasterxml.jackson.annotation.JsonIgnore;
2322
import com.fasterxml.jackson.annotation.JsonProperty;
2423

2524
/**

0 commit comments

Comments
 (0)