Skip to content

Commit 4097fe7

Browse files
author
rathnapandi
committed
- Fix issue #470
1 parent fc40ce3 commit 4097fe7

File tree

6 files changed

+196
-8
lines changed

6 files changed

+196
-8
lines changed

modules/apis/src/main/java/com/axway/apim/apiimport/actions/CreateNewAPI.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ public String execute(APIChangeState changes, boolean reCreation) throws AppExce
8181
serviceProfile.setBasePath(backendBasePath);
8282
}
8383
}
84+
//Copy password as gateway responds with empty password for ssl and basic
85+
createdAPI.setAuthenticationProfiles(desiredAPI.getAuthenticationProfiles());
8486
// But without updating the Swagger, as we have just imported it!
8587
createdAPI = apiAdapter.updateAPIProxy(createdAPI);
8688
// If an image is included, update it

modules/apis/src/main/java/com/axway/apim/apiimport/actions/UpdateExistingAPI.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public void execute(APIChangeState changes) throws AppException {
3838
// Copy all desired proxy changes into the actual API
3939
APIChangeState.copyChangedProps(desiredAPI, actualAPI, changes.getAllChanges());
4040
actualAPI.setApiMethods(null);
41+
actualAPI.setAuthenticationProfiles(desiredAPI.getAuthenticationProfiles());
4142
List<APIMethod> desiredAPIMethods = desiredAPI.getApiMethods();
4243
ManageApiMethods manageApiMethods = new ManageApiMethods();
4344
manageApiMethods.isMethodMismatch(actualAPIMethods, desiredAPIMethods);

modules/apis/src/test/java/com/axway/apim/APIImportAppTest.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package com.axway.apim;
22

3+
import com.axway.apim.api.API;
4+
import com.axway.apim.apiimport.APIImportConfigAdapter;
5+
import com.axway.apim.apiimport.lib.params.APIImportParams;
36
import org.testng.Assert;
47
import org.testng.annotations.AfterClass;
58
import org.testng.annotations.BeforeClass;
@@ -40,4 +43,22 @@ public void importApiMCliVersion() {
4043
int returnCode = APIImportApp.importAPI(args);
4144
Assert.assertEquals(returnCode, 0);
4245
}
46+
47+
@Test
48+
public void testEmptyPassword() throws Exception {
49+
APIImportParams params = new APIImportParams();
50+
ClassLoader classLoader = this.getClass().getClassLoader();
51+
String confFile = classLoader.getResource("com/axway/apim/test/files/serviceprofile/empty_password.json").getFile();
52+
params.setConfig(confFile);
53+
params.setUsername("admin");
54+
params.setPassword("admin");
55+
params.setAPIManagerURL("https://localhost:8075");
56+
APIImportConfigAdapter configAdapter = new APIImportConfigAdapter(params);
57+
// Creates an API-Representation of the desired API
58+
API desiredAPI = configAdapter.getDesiredAPI();
59+
Assert.assertEquals("",desiredAPI.getAuthenticationProfiles().get(0).getParameters().get("password"));
60+
// ObjectMapper mapper = new ObjectMapper();
61+
//
62+
// System.out.println(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(desiredAPI.getAuthenticationProfiles()));
63+
}
4364
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{
2+
"name": "Test EGA API-2263",
3+
"path": "/test-ega-api-2263",
4+
"state": "published",
5+
"version": "1.0",
6+
"organization": "orga",
7+
"clintOrganizations": [
8+
"Information Technology"
9+
],
10+
"tags": {
11+
"ci": [
12+
"test"
13+
]
14+
},
15+
"backendBasepath": "https://localhost/omnichannelapi",
16+
"apiDefinition": "test-ega-api-2263.json",
17+
"summary": "",
18+
"securityProfiles": [
19+
{
20+
"name": "_default",
21+
"isDefault": true,
22+
"devices": [
23+
{
24+
"type": "oauth",
25+
"name": "OAuth",
26+
"order": 1,
27+
"properties": {
28+
"tokenStore": "OAuth Access Token Store",
29+
"accessTokenLocation": "HEADER",
30+
"authorizationHeaderPrefix": "Bearer",
31+
"accessTokenLocationQueryString": "",
32+
"scopesMustMatch": "Any",
33+
"scopes": "resource.WRITE, resource.READ",
34+
"removeCredentialsOnSuccess": true,
35+
"implicitGrantEnabled": true,
36+
"implicitGrantLoginEndpointUrl": "https://10.129.144.201:8089/api/oauth/authorize",
37+
"implicitGrantLoginTokenName": "access_token",
38+
"authCodeGrantTypeEnabled": true,
39+
"authCodeGrantTypeRequestEndpointUrl": "https://10.129.144.201:8089/api/oauth/authorize",
40+
"authCodeGrantTypeRequestClientIdName": "client_id",
41+
"authCodeGrantTypeRequestSecretName": "client_secret",
42+
"authCodeGrantTypeTokenEndpointUrl": "https://10.129.144.201:8089/api/oauth/token",
43+
"authCodeGrantTypeTokenEndpointTokenName": "access_code",
44+
"clientCredentialsGrantTypeEnabled": "true",
45+
"clientCredentialsGrantTypeTokenEndpointUrl": "https://localhost:8089/api/oauth/token",
46+
"clientCredentialsGrantTypeTokenName": "access_token"
47+
}
48+
}
49+
]
50+
}
51+
],
52+
"authenticationProfiles": [
53+
{
54+
"name": "_default",
55+
"isDefault": true,
56+
"parameters": {
57+
"username": "HZ4/ojqfoV/ADrzG3NIIHobwudKiliMh",
58+
"password": ""
59+
},
60+
"type": "http_basic"
61+
}
62+
],
63+
"customProperties": {
64+
"customProperty1": "public",
65+
"customProperty2": "1",
66+
"customProperty3": "true",
67+
"customProperty4": "true"
68+
}
69+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
{
2+
"openapi": "3.0.0",
3+
"info":
4+
{
5+
"title": "Test EGA API-2263",
6+
"version": "1.0",
7+
"description": "Test EGA API-2263",
8+
"contact":
9+
{
10+
"name": "Axway",
11+
"email": "[email protected]",
12+
"url" : "https://axway.com"
13+
}
14+
},
15+
"servers":
16+
[
17+
{
18+
"description": "DEV",
19+
"url": "https://api-gw-dev.axway.com:8443/test-ega-api-2263"
20+
},
21+
{
22+
"description": "QA",
23+
"url": "https://api-gw-qa.axway.com/test-ega-api-2263"
24+
},
25+
{
26+
"description": "PROD",
27+
"url": "https://api-gw.axway.com/test-ega-api-2263"
28+
}
29+
],
30+
"paths":
31+
{
32+
"/healthcheck":
33+
{
34+
"get":
35+
{
36+
"summary": "Healthcheck",
37+
"tags":
38+
[
39+
"Healthcheck"
40+
],
41+
"responses":
42+
{
43+
"200":
44+
{
45+
"description": "OK",
46+
"content":
47+
{
48+
"application/json":
49+
{
50+
"schema":
51+
{
52+
"type": "object",
53+
"properties":
54+
{
55+
"status":
56+
{
57+
"type": "string"
58+
}
59+
}
60+
}
61+
}
62+
}
63+
}
64+
},
65+
"operationId": "get-healthcheck",
66+
"description": "The healthcheck confirms that everything is working!",
67+
"x-internal": false
68+
}
69+
}
70+
},
71+
"components":
72+
{
73+
"schemas":
74+
{},
75+
"securitySchemes":
76+
{
77+
"apiKey":
78+
{
79+
"type": "apiKey",
80+
"in": "header",
81+
"name": "KeyId",
82+
"description": "API Key"
83+
},
84+
"http":
85+
{
86+
"type": "http",
87+
"scheme": "basic",
88+
"description": "HTTP Basic"
89+
}
90+
}
91+
},
92+
"tags":
93+
[
94+
{
95+
"name": "Healthcheck",
96+
"description": "Healthcheck"
97+
},
98+
{
99+
"name": "Function",
100+
"description": "(Sandbox)"
101+
}
102+
]
103+
}

modules/spectoconfig/src/test/java/com/axway/apim/config/GenerateTemplateTest.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,12 @@
55
import com.axway.apim.api.model.APIMethod;
66
import com.axway.apim.api.model.InboundProfile;
77
import com.axway.apim.api.model.SecurityProfile;
8-
import com.axway.apim.lib.error.AppException;
9-
import com.axway.apim.lib.error.ErrorCode;
10-
import com.fasterxml.jackson.annotation.JsonInclude;
118
import com.fasterxml.jackson.databind.JsonNode;
129
import com.fasterxml.jackson.databind.ObjectMapper;
13-
import com.fasterxml.jackson.databind.ser.FilterProvider;
14-
import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
15-
import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;
1610
import com.jayway.jsonpath.DocumentContext;
1711
import com.jayway.jsonpath.JsonPath;
1812
import io.swagger.v3.oas.models.OpenAPI;
1913
import io.swagger.v3.parser.OpenAPIV3Parser;
20-
import io.swagger.v3.parser.core.models.SwaggerParseResult;
2114
import org.eclipse.jetty.http.HttpVersion;
2215
import org.eclipse.jetty.server.*;
2316
import org.eclipse.jetty.servlet.ServletHandler;
@@ -38,7 +31,6 @@
3831
import java.security.NoSuchAlgorithmException;
3932
import java.security.cert.CertificateEncodingException;
4033
import java.util.ArrayList;
41-
import java.util.HashMap;
4234
import java.util.List;
4335
import java.util.Map;
4436
import java.util.concurrent.Executors;

0 commit comments

Comments
 (0)