Skip to content

Commit e4ef641

Browse files
authored
Merge pull request #585 from Sermeh-Hidell/feature/show-outbound-authentication
Add outbound authentication to API exports wide and ultra
2 parents d517bcc + 8b1bf3d commit e4ef641

3 files changed

Lines changed: 59 additions & 3 deletions

File tree

modules/apis/src/main/java/com/axway/apim/api/export/impl/APIResultHandler.java

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,54 @@ protected static String getUsedSecurity(API api) {
156156
return usedSecurity.toString().replace("[", "").replace("]", "");
157157
}
158158

159+
protected static String getUsedOutboundAuthentication(API api) {
160+
161+
List<String> result = new ArrayList<>();
162+
163+
if (api.getOutboundProfiles() == null) {
164+
return "";
165+
}
166+
167+
for (OutboundProfile profile : api.getOutboundProfiles().values()) {
168+
169+
if (profile.getAuthenticationProfile() == null) {
170+
continue;
171+
}
172+
173+
for (AuthenticationProfile authProfile : api.getAuthenticationProfiles()) {
174+
175+
if (!authProfile.getName().equals(profile.getAuthenticationProfile())) {
176+
continue;
177+
}
178+
179+
String authType = authProfile.getType().getName();
180+
181+
if (!result.contains(authType)) {
182+
result.add(authType);
183+
}
184+
185+
if (authProfile.getType() == AuthType.oauth) {
186+
187+
String providerProfile =
188+
(String) authProfile.getParameters().get("providerProfile");
189+
190+
if (providerProfile != null) {
191+
providerProfile =
192+
Utils.getExternalPolicyName(
193+
providerProfile,
194+
Utils.FedKeyType.OAuthAppProfile);
195+
196+
if (!result.contains(providerProfile)) {
197+
result.add(providerProfile);
198+
}
199+
}
200+
}
201+
}
202+
}
203+
204+
return String.join(", ", result);
205+
}
206+
159207
protected static List<String> getUsedPolicies(API api, PolicyType type) {
160208
return getUsedPolicies(api).get(type);
161209
}

modules/apis/src/main/java/com/axway/apim/api/export/impl/CSVAPIExporter.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ private enum HeaderFields {
5252
"API V-Host",
5353
"API State",
5454
"Backend",
55+
"Inbound Security",
56+
"Outbound Security",
5557
"Request Policy",
5658
"Routing Policy",
5759
"Response Policy",
@@ -67,7 +69,8 @@ private enum HeaderFields {
6769
"API V-Host",
6870
"API State",
6971
"Backend",
70-
"Security",
72+
"Inbound Security",
73+
"Outbound Security",
7174
"Request Policy",
7275
"Routing Policy",
7376
"Response Policy",
@@ -207,6 +210,8 @@ private void writeWideToCSV(CSVPrinter csvPrinter, API api) throws IOException {
207210
api.getVhost(),
208211
api.getState(),
209212
getBackendPath(api),
213+
getUsedSecurity(api),
214+
getUsedOutboundAuthentication(api),
210215
getUsedPolicies(api, PolicyType.REQUEST).toString().replace("[", "").replace("]", ""),
211216
getUsedPolicies(api, PolicyType.ROUTING).toString().replace("[", "").replace("]", ""),
212217
getUsedPolicies(api, PolicyType.RESPONSE).toString().replace("[", "").replace("]", ""),
@@ -226,6 +231,7 @@ private void writeAPIUltraToCSV(CSVPrinter csvPrinter, API api, ClientApplicatio
226231
api.getState(),
227232
getBackendPath(api),
228233
getUsedSecurity(api),
234+
getUsedOutboundAuthentication(api),
229235
getUsedPolicies(api, PolicyType.REQUEST).toString().replace("[", "").replace("]", ""),
230236
getUsedPolicies(api, PolicyType.ROUTING).toString().replace("[", "").replace("]", ""),
231237
getUsedPolicies(api, PolicyType.RESPONSE).toString().replace("[", "").replace("]", ""),

modules/apis/src/main/java/com/axway/apim/api/export/impl/ConsoleAPIExporter.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ private void printWide(List<API> apis) {
7272
new Column().header("V-Host").with(API::getVhost),
7373
new Column().header("State").with(this::getState),
7474
new Column().header("Backend").headerAlign(HorizontalAlign.LEFT).dataAlign(HorizontalAlign.LEFT).with(APIResultHandler::getBackendPath),
75-
new Column().header("Security").with(APIResultHandler::getUsedSecurity),
75+
new Column().header("Inbound Security").with(APIResultHandler::getUsedSecurity),
76+
new Column().header("Outbound Security").with(APIResultHandler::getUsedOutboundAuthentication),
7677
new Column().header("Policies").dataAlign(HorizontalAlign.LEFT).maxWidth(30).with(this::getUsedPoliciesForConsole),
7778
new Column().header("Organization").dataAlign(HorizontalAlign.LEFT).with(api -> api.getOrganization().getName()),
7879
new Column().header(CREATED_ON).with(this::getFormattedDate)
@@ -89,7 +90,8 @@ private void printUltra(List<API> apis) {
8990
new Column().header("V-Host").with(API::getVhost),
9091
new Column().header("State").with(this::getState),
9192
new Column().header("Backend").headerAlign(HorizontalAlign.LEFT).dataAlign(HorizontalAlign.LEFT).with(APIResultHandler::getBackendPath),
92-
new Column().header("Security").with(APIResultHandler::getUsedSecurity),
93+
new Column().header("Inbound Security").with(APIResultHandler::getUsedSecurity),
94+
new Column().header("Outbound Security").with(APIResultHandler::getUsedOutboundAuthentication),
9395
new Column().header("Policies").dataAlign(HorizontalAlign.LEFT).maxWidth(30).with(this::getUsedPoliciesForConsole),
9496
new Column().header("Organization").dataAlign(HorizontalAlign.LEFT).with(api -> api.getOrganization().getName()),
9597
new Column().header("Orgs").with(this::getOrgCount),

0 commit comments

Comments
 (0)