Skip to content

Commit 343dfd2

Browse files
author
Chris Wiechmann
committed
Merge branch 'develop' into test-with-7.7-20200130
2 parents 100f035 + 0b4907b commit 343dfd2

31 files changed

Lines changed: 287 additions & 67 deletions

File tree

CHANGELOG.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [Unreleased]
8+
### Fixed
9+
- apim.sh now starts the CLI in the current directory (See issue [#60](https://github.com/Axway-API-Management-Plus/apim-cli/issues/60))
10+
11+
### Changed
12+
- Added 7.7-July release to the list of tested releases
13+
- apim.sh & apim.bat script now support path with blanks. Thanks to [@cbrowet-axway](https://github.com/cbrowet-axway)
14+
- Handling NPE for Application credential search (See issue [#57](https://github.com/Axway-API-Management-Plus/apim-cli/issues/57))
15+
- If FE-Security is a Custom-Policy, the name of the Custom-Policy is now exported (See issue [#61](https://github.com/Axway-API-Management-Plus/apim-cli/issues/61))
16+
- Toggle ignoreCache added to the usage (See issue [#52](https://github.com/Axway-API-Management-Plus/apim-cli/issues/52))
17+
18+
## [1.2.1] 2020-07-22
19+
### Fixed
20+
- Outbound Method-Configuration not working (See issue [#50](https://github.com/Axway-API-Management-Plus/apim-cli/issues/50))
21+
22+
## [1.2.0] 2020-07-17
823
### Added
924
- Support to import and export organizations
1025
- Support to import and export users
@@ -26,7 +41,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2641

2742
### Fixed
2843
- Fixed NPE when API has no security configured (See issue [#46](https://github.com/Axway-API-Management-Plus/apim-cli/issues/46))
29-
- apim.sh changed to improve support on Mac/Linux systems. Identifed by [@cbrowet-axway](https://github.com/cbrowet-axway) (See issue [#42](https://github.com/Axway-API-Management-Plus/apim-cli/issues/42))
44+
- apim.sh changed to improve support on Mac/Linux systems. Identified by [@cbrowet-axway](https://github.com/cbrowet-axway) (See issue [#42](https://github.com/Axway-API-Management-Plus/apim-cli/issues/42))
3045
- Improving support for OpenAPI 3.x spec having no servers declared (See issue [#40](https://github.com/Axway-API-Management-Plus/apim-cli/issues/40))
3146
- API export with methods doesn't contain anymore the internal method-id (See issue [#39](https://github.com/Axway-API-Management-Plus/apim-cli/issues/39))
3247
- CLI tool is now taking over RC given by each module (See issue [#33](https://github.com/Axway-API-Management-Plus/apim-cli/issues/33))

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ The automated End-2-End test suite contains of __116__ different scenarios, whic
5656
| 7.7-20200130 | test-with-7.7-20200130 | [![Build Status](https://img.shields.io/travis/Axway-API-Management-Plus/apim-cli/test-with-7.7-20200130)](https://travis-ci.org/Axway-API-Management-Plus/apim-cli/branches)||
5757
| 7.7-20200331 | test-with-7.7-20200331 | [![Build Status](https://img.shields.io/travis/Axway-API-Management-Plus/apim-cli/test-with-7.7-20200331)](https://travis-ci.org/Axway-API-Management-Plus/apim-cli/branches)||
5858
| 7.7-20200530 | test-with-7.7-20200530 | [![Build Status](https://img.shields.io/travis/Axway-API-Management-Plus/apim-cli/test-with-7.7-20200530)](https://travis-ci.org/Axway-API-Management-Plus/apim-cli/branches)||
59+
| 7.7-20200730 | test-with-7.7-20200730 | [![Build Status](https://img.shields.io/travis/Axway-API-Management-Plus/apim-cli/test-with-7.7-20200730)](https://travis-ci.org/Axway-API-Management-Plus/apim-cli/branches)||
5960

6061
Version 7.5.3 is NOT supported. Version 7.6.2 SP3 is required.
6162

distribution/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.github.axway-api-management-plus.apim-cli</groupId>
77
<artifactId>parent</artifactId>
8-
<version>1.2.0-SNAPSHOT</version>
8+
<version>1.3.0-SNAPSHOT</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111

modules/apim-adapter/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.github.axway-api-management-plus.apim-cli</groupId>
66
<artifactId>parent</artifactId>
7-
<version>1.2.0-SNAPSHOT</version>
7+
<version>1.3.0-SNAPSHOT</version>
88
<relativePath>../../pom.xml</relativePath>
99
</parent>
1010

modules/apim-adapter/src/main/java/com/axway/apim/adapter/apis/APIFilter.java

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@
1717
import com.axway.apim.adapter.apis.APIFilter.Builder.APIType;
1818
import com.axway.apim.adapter.clientApps.ClientAppFilter;
1919
import com.axway.apim.api.API;
20+
import com.axway.apim.api.model.DeviceType;
21+
import com.axway.apim.api.model.InboundProfile;
2022
import com.axway.apim.api.model.OutboundProfile;
2123
import com.axway.apim.api.model.Policy;
24+
import com.axway.apim.api.model.SecurityDevice;
25+
import com.axway.apim.api.model.SecurityProfile;
2226
import com.axway.apim.lib.errorHandling.AppException;
27+
import com.axway.apim.lib.utils.Utils;
2328

2429
public class APIFilter {
2530

@@ -435,20 +440,43 @@ public boolean filter(API api) throws AppException {
435440
}
436441
}
437442
if(this.getPolicyName()!=null) {
438-
Pattern pattern = Pattern.compile(this.getPolicyName().replace("*", ".*"));
439-
Iterator<OutboundProfile> it = api.getOutboundProfiles().values().iterator();
440443
boolean requestedPolicyUsed = false;
441-
while(it.hasNext()) {
442-
OutboundProfile profile = it.next();
443-
for(Policy policy : profile.getAllPolices()) {
444-
if(policy.getName()==null) {
445-
LOG.warn("Cannot check policy: "+policy+" as policy name is empty.");
446-
continue;
444+
Pattern pattern = Pattern.compile(this.getPolicyName().replace("*", ".*"));
445+
if(api.getOutboundProfiles()!=null) {
446+
Iterator<OutboundProfile> it = api.getOutboundProfiles().values().iterator();
447+
while(it.hasNext()) {
448+
OutboundProfile profile = it.next();
449+
for(Policy policy : profile.getAllPolices()) {
450+
if(policy.getName()==null) {
451+
LOG.warn("Cannot check policy: "+policy+" as policy name is empty.");
452+
continue;
453+
}
454+
Matcher matcher = pattern.matcher(policy.getName());
455+
if(matcher.matches()) {
456+
requestedPolicyUsed = true;
457+
break;
458+
}
447459
}
448-
Matcher matcher = pattern.matcher(policy.getName());
449-
if(matcher.matches()) {
450-
requestedPolicyUsed = true;
451-
break;
460+
}
461+
}
462+
if(api.getInboundProfiles()!=null) {
463+
Iterator<InboundProfile> it = api.getInboundProfiles().values().iterator();
464+
while(it.hasNext()) {
465+
InboundProfile profile = it.next();
466+
if(profile.getSecurityProfile()!=null) {
467+
for(SecurityProfile securityProfile : api.getSecurityProfiles()) {
468+
if(securityProfile.getName().equals(profile.getSecurityProfile())) {
469+
for(SecurityDevice device : securityProfile.getDevices()) {
470+
if(device.getType()!=DeviceType.authPolicy) continue;
471+
String securityPolicy = device.getProperties().get("authenticationPolicy");
472+
Matcher matcher = pattern.matcher(Utils.getExternalPolicyName(securityPolicy));
473+
if(matcher.matches()) {
474+
requestedPolicyUsed = true;
475+
break;
476+
}
477+
}
478+
}
479+
}
452480
}
453481
}
454482
}

modules/apim-adapter/src/main/java/com/axway/apim/adapter/apis/APIManagerAPIAdapter.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import com.axway.apim.api.model.APIQuota;
5252
import com.axway.apim.api.model.Image;
5353
import com.axway.apim.api.model.Organization;
54+
import com.axway.apim.api.model.OutboundProfile;
5455
import com.axway.apim.api.model.Profile;
5556
import com.axway.apim.api.model.QuotaRestriction;
5657
import com.axway.apim.api.model.apps.ClientApplication;
@@ -352,9 +353,15 @@ private <ProfileType> void _translateMethodIds(Map<String, ProfileType> profiles
352353
}
353354
ProfileType profileWithType = profiles.get(key);
354355
Profile profile = (Profile)profileWithType;
355-
profile.setApiMethodId(method.getId());
356-
profile.setApiMethodName(method.getName());
357-
profile.setApiId(method.getVirtualizedApiId());
356+
if(profile instanceof OutboundProfile) {
357+
profile.setApiMethodId(method.getApiMethodId());
358+
profile.setApiMethodName(method.getName());
359+
profile.setApiId(method.getApiId());
360+
} else {
361+
profile.setApiMethodId(method.getId());
362+
profile.setApiMethodName(method.getName());
363+
profile.setApiId(method.getVirtualizedApiId());
364+
}
358365
if(mode==METHOD_TRANSLATION.AS_NAME) {
359366
updatedEntries.put(method.getName(), profileWithType);
360367
} else {

modules/apim-adapter/src/main/java/com/axway/apim/adapter/clientApps/APIMgrAppsAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public List<ClientApplication> getApplications(ClientAppFilter filter, boolean l
139139
addAPIAccess(app, filter.isIncludeAPIAccess());
140140
if(!filter.filter(app)) continue;
141141
filteredApps.add(app);
142-
if(logProgress && apps.size()>5) Utils.progressPercentage(i, apps.size(), "Laoding "+apps.size()+" Applications");
142+
if(logProgress && apps.size()>5) Utils.progressPercentage(i, apps.size(), "Loading "+apps.size()+" Applications");
143143
}
144144
if(logProgress && apps.size()>5) System.out.print("\n");
145145
} catch (Exception e) {

modules/apim-adapter/src/main/java/com/axway/apim/adapter/clientApps/ClientAppFilter.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,21 +201,25 @@ public boolean filter(ClientApplication app) throws AppException {
201201
for(ClientAppCredential cred : app.getCredentials()) {
202202
switch(cred.getCredentialType()) {
203203
case "oauth":
204-
match = filterCredential(((OAuth)cred).getClientId(), ((OAuth)cred).getRedirectUrls());
204+
match = filterCredential(((OAuth)cred).getClientId(), ((OAuth)cred).getRedirectUrls(), app.getName());
205205
break;
206206
case "extclients":
207-
match = filterCredential(((ExtClients)cred).getClientId(), null);
207+
match = filterCredential(((ExtClients)cred).getClientId(), null, app.getName());
208208
break;
209209
case "apikeys":
210-
match = filterCredential(((APIKey)cred).getApiKey(), null);
210+
match = filterCredential(((APIKey)cred).getApiKey(), null, app.getName());
211211
break;
212212
}
213213
if(match) break;
214214
}
215215
return match;
216216
}
217217

218-
private boolean filterCredential(String appCredential, String[] appRedirectUrls) {
218+
private boolean filterCredential(String appCredential, String[] appRedirectUrls, String appName) {
219+
if(appCredential==null) {
220+
LOG.warn("Inconsistent application: '"+appName+"' found. API-Key/Client-ID is NULL for credential.");
221+
return false;
222+
}
219223
if(this.credential!=null) {
220224
Pattern pattern = Pattern.compile(this.credential.replace("*", ".*"));
221225
Matcher matcher = pattern.matcher(appCredential);

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,6 @@ public boolean isRequestForAllOrgs() {
493493
* That means, when an API-Developer is defining ALL as the organization name this flag
494494
* is set to true and it becomes the desired state.
495495
* This method is used during creation of APIImportDefinition in APIImportConfig#handleAllOrganizations()
496-
* @see APIImportConfigAdapter
497496
* @param requestForAllOrgs when set to true, the APIs will be granted to ALL organizations.
498497
*/
499498
public void setRequestForAllOrgs(boolean requestForAllOrgs) {

modules/apim-adapter/src/main/java/com/axway/apim/lib/APIMCoreCLIOptions.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ public APIMCoreCLIOptions(String[] args) {
8585
option.setArgName("ALL");
8686
options.addOption(option);
8787

88+
option = new Option("ignoreCache", "The cache for REST-API calls against the API-Manager isn't used at all.");
89+
option.setRequired(false);
90+
options.addOption(option);
91+
8892
option = new Option("rollback", true, "Allows to disable the rollback feature");
8993
option.setRequired(false);
9094
option.setArgName("true");
@@ -98,10 +102,6 @@ public APIMCoreCLIOptions(String[] args) {
98102
option.setRequired(false);
99103
option.setArgName("true");
100104
internalOptions.addOption(option);
101-
102-
option = new Option("ignoreCache", "The cache for REST-API calls isn't used.");
103-
option.setRequired(false);
104-
internalOptions.addOption(option);
105105

106106
this.args = args;
107107
}

0 commit comments

Comments
 (0)