Skip to content
This repository was archived by the owner on Oct 17, 2024. It is now read-only.

Commit 7090c7a

Browse files
authored
Merge pull request #9 from Axway-API-Management-Plus/spring-boot-2
Spring boot 2
2 parents 714dbc4 + c3cd346 commit 7090c7a

File tree

61 files changed

+994
-34512
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+994
-34512
lines changed

README.md

Lines changed: 36 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
- Axway Service Broker for Pivotal Cloud Foundry based on [Fully brokered Architecture](https://docs.pivotal.io/pivotalcf/1-12/services/route-services.html#fully-brokered)
44

55

6-
## API Management Version Compatibilty
7-
This artefact was successfully tested for the following versions:
8-
- Axway AMPLIFY API Management 7.6.2 SP3 and 7.7
6+
## API Management Version Compatibility
7+
This artifact successfully tested with following versions:
8+
- Axway AMPLIFY API Management 7.6.2 SP3 and v7.7.20200330
9+
- cf 2.8.1
910

1011

1112
## Prerequisites
@@ -33,7 +34,18 @@ This artefact was successfully tested for the following versions:
3334
service_instance_id:{
3435
label: 'Service Instance Id'
3536
}
37+
},
38+
api: {
39+
cfBindingId:{
40+
label: 'Cloud Foundry Binding Id',
41+
permissions: {
42+
admin: { read: true, write: true, visible:true },
43+
oadmin: { read: true, write: false, visible:true },
44+
user: { read: true, write: false, visible:true }
45+
}
46+
}
3647
}
48+
3749
}
3850
```
3951

@@ -46,12 +58,12 @@ This artefact was successfully tested for the following versions:
4658
```
4759
Build the project (output from `cf push` command provides fully qualified URL as output)
4860
```bash
49-
$mvn clean install
61+
$mvn clean package
5062
```
5163

5264
or you can use the following command if you want to skip testing step:
5365
```bash
54-
$mvn clean install -Dmaven.test.skip=true
66+
$mvn clean package -Dmaven.test.skip=true
5567
```
5668
Now, you can push your app to PCF:
5769
```bash
@@ -111,10 +123,9 @@ This artefact was successfully tested for the following versions:
111123

112124
$cf set-env axway-apim-service-broker cf_admin_username admin@axway.com
113125
$cf set-env axway-apim-service-broker cf_admin_password changme
114-
$cf set-env axway-apim-service-broker login_host https://login.sys.pie-25.cfplatformeng.com/oauth/token
115-
$cf set-env axway-apim-service-broker cc_host https://api.sys.pie-25.cfplatformeng.com
126+
$cf set-env axway-apim-service-broker api_host uaa.sys.industry.cf-app.com
116127

117-
$cf set-env axway-apim-service-broker TRUST_CERTS login.sys.pie-25.cfplatformeng.com,api.sys.pie-25.cfplatformeng.com //If your PCF instance uses self-signed certs, you may need to use this environment variable to prevent some security errors
128+
$cf set-env axway-apim-service-broker TRUST_CERTS uaa.sys.industry.cf-app.com //If your PCF instance uses self-signed certs, you may need to use this environment variable to prevent some security errors
118129
```
119130

120131
- Refresh Service Broker Instance to read the new environment variable
@@ -165,10 +176,10 @@ $cf push
165176

166177
```json
167178
{
168-
"apiname": "pcftest",
169-
"type":": "swagger",
170-
"uri": "/v2/api-docs"
171-
}
179+
"apiname": "pcftest",
180+
"type": "swagger",
181+
"uri": "/v2/api-docs"
182+
}
172183

173184
```
174185
`apiName` is optional. If `apiName` is not specified, Service broker fetch the API Name and from swagger or WSDL.
@@ -185,34 +196,38 @@ $cf push
185196

186197
- Test the Pivotal Application
187198

188-
Try to access your apps endpoint. To verify that the request goes through API Gateway, open Axway API Gateway Manager and look at the traffic tab. You should see two entries:
189-
- One that comes from GoRouter (PCF)
190-
- The second one comes as a riderect from API Gateway itself
199+
Try to access your PCF application endpoint. To verify that the request goes through API Gateway, open Axway API Gateway Manager and look at the traffic tab. You should see two entries:
200+
- One comes from GoRouter (PCF) to API Gateway
201+
- The second one comes as a redirect from API Gateway itself
191202

192-
- Un-bind Application from Axway Service broker
203+
204+
205+
206+
## Axway Service Broker uninstallation
207+
208+
- Unbind Route - Un-bind Application from Axway Service broker
193209

194210
```bash
195211
$cf unbind-route-service cfapps.pie-25.cfplatformeng.com AxwayAPIM --hostname greeting-app-tournois-postresurrection
196212
```
197213

198214
The route unbinding command invokes Axway Service Broker and Service Broker does the following:
199215
1. If API is in Published state, it will throw an error.
200-
2. If API is in un-published state, delete frontend, backend API.
201-
216+
2. If API is in un-published state, delete front end API, backend API.
202217

203-
## Axway Service Broker uninstallation
204-
218+
- Delete Service
205219
```bash
206220
$cf delete-service AxwayAPIM
207221
```
208222

209-
The delete service command does the following:
223+
Cloud Foundry delete service command does the following:
210224
1. If the service has binded application or routes, it throws an error.
211225
2. Delete Frontend and Backend APIs
212226
3. Delete applications
213227
4. Delete User
214228
5. Delete Organization
215229

230+
- Delete Service Broker
216231
```bash
217232
$cf delete-service-broker axway-apim-service-broker
218233
```

manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ applications:
33
- name: axway-apim-service-broker
44
memory: 1G
55
random-route: true
6-
path: target/apim-service-broker-1.1.8.jar
6+
path: target/apim-service-broker-1.2.0.jar
77

param.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"apiname": "pcftest",
33
"type":"swagger",
4-
"uri": "http://greeting-app-talkative-squirrel.apps.tokyo.cf-app.com/api/v3/swagger.json"
4+
"uri": "http://greeting-app-grumpy-llama-dx.apps.industry.cf-app.com/v3/swagger.json"
55
}

pom.xml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,48 @@
55
<modelVersion>4.0.0</modelVersion>
66
<groupId>com.axway.apim</groupId>
77
<artifactId>apim-service-broker</artifactId>
8-
<version>1.1.8</version>
8+
<version>1.2.0</version>
99
<packaging>jar</packaging>
1010
<name>axway-apim-service-broker</name>
1111
<description>Axway APIM Service Broker</description>
1212
<parent>
1313
<groupId>org.springframework.boot</groupId>
1414
<artifactId>spring-boot-starter-parent</artifactId>
15-
<version>1.5.19.RELEASE</version>
15+
<version>2.3.0.RELEASE</version>
1616
<relativePath />
1717
<!-- lookup parent from repository -->
1818
</parent>
1919
<properties>
2020
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2121
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
2222
<java.version>1.8</java.version>
23-
<service-broker.version>1.0.2.RELEASE</service-broker.version>
23+
<service-broker.version>1.0.3.RELEASE</service-broker.version>
2424
<commons-io.version>2.5</commons-io.version>
25-
<springframework.cloud>1.2.6.RELEASE</springframework.cloud>
25+
<springframework.cloud>2.2.2.RELEASE</springframework.cloud>
2626
<cloudfoundry.certificate.truster>1.0.1.RELEASE</cloudfoundry.certificate.truster>
2727
<commons.validator>1.6</commons.validator>
28+
<cloudfoundry-client.version>4.6.0.RELEASE</cloudfoundry-client.version>
2829
</properties>
2930
<dependencies>
3031
<dependency>
3132
<groupId>org.springframework.boot</groupId>
32-
<artifactId>spring-boot-starter</artifactId>
33+
<artifactId>spring-boot-starter-web</artifactId>
3334
</dependency>
35+
3436
<dependency>
35-
<groupId>org.springframework.cloud</groupId>
36-
<artifactId>spring-cloud-cloudfoundry-service-broker</artifactId>
37-
<version>${service-broker.version}</version>
37+
<groupId>org.springframework.boot</groupId>
38+
<artifactId>spring-boot-starter-security</artifactId>
39+
</dependency>
40+
41+
<!-- <dependency>-->
42+
<!-- <groupId>org.springframework.cloud</groupId>-->
43+
<!-- <artifactId>spring-cloud-cloudfoundry-service-broker</artifactId>-->
44+
<!-- <version>${service-broker.version}</version>-->
45+
<!-- </dependency>-->
46+
<dependency>
47+
<groupId>org.cloudfoundry</groupId>
48+
<artifactId>cloudfoundry-client-reactor</artifactId>
49+
<version>${cloudfoundry-client.version}</version>
3850
</dependency>
3951
<dependency>
4052
<groupId>commons-io</groupId>
@@ -57,10 +69,10 @@
5769
</dependency>
5870
<!-- <dependency><groupId>org.cloudfoundry</groupId><artifactId>cloudfoundry-client</artifactId><version>2.13.0.RELEASE</version></dependency><dependency><groupId>org.cloudfoundry</groupId><artifactId>cloudfoundry-util</artifactId><version>2.13.0.RELEASE</version></dependency> -->
5971
<!-- https://mvnrepository.com/artifact/org.springframework.security.oauth/spring-security-oauth2 -->
60-
<dependency>
61-
<groupId>org.springframework.security.oauth</groupId>
62-
<artifactId>spring-security-oauth2</artifactId>
63-
</dependency>
72+
<!-- <dependency>-->
73+
<!-- <groupId>org.springframework.security.oauth</groupId>-->
74+
<!-- <artifactId>spring-security-oauth2</artifactId>-->
75+
<!-- </dependency>-->
6476
<dependency>
6577
<groupId>io.pivotal.spring.cloud</groupId>
6678
<artifactId>cloudfoundry-certificate-truster</artifactId>

src/main/java/com/axway/apim/servicebroker/config/AxwayConfig.java

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,19 @@
44
import javax.net.ssl.HttpsURLConnection;
55
import javax.net.ssl.SSLSession;
66

7+
import com.axway.apim.servicebroker.service.*;
78
import org.springframework.beans.factory.annotation.Value;
89
import org.springframework.boot.web.client.RestTemplateBuilder;
9-
import org.springframework.cloud.servicebroker.model.BrokerApiVersion;
1010
import org.springframework.context.annotation.Bean;
1111
import org.springframework.context.annotation.Configuration;
1212
import org.springframework.web.client.RestTemplate;
1313

1414
import com.axway.apim.servicebroker.exception.AxwayAPIGatewayErrorHandler;
15-
import com.axway.apim.servicebroker.service.AxwayAPIClient;
16-
import com.axway.apim.servicebroker.service.AxwayApplicationClient;
17-
import com.axway.apim.servicebroker.service.AxwayOrganzationClient;
18-
import com.axway.apim.servicebroker.service.AxwayUserClient;
1915
import com.axway.apim.servicebroker.util.Util;
2016
import com.fasterxml.jackson.databind.ObjectMapper;
2117

22-
//import com.axway.apim.servicebroker.exception.AxwayAPIGatewayErrorHandler;
18+
import java.time.Duration;
19+
2320

2421
@Configuration
2522
public class AxwayConfig {
@@ -52,19 +49,19 @@ public boolean verify(String hostname, SSLSession session) {
5249
HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
5350
//RestTemplate restClient = new RestTemplate();
5451
RestTemplate restClient = restTemplateBuilder
55-
.setConnectTimeout(connectTimeout)
56-
.setReadTimeout(readTimeout)
57-
.basicAuthorization(username, new String(password))
52+
.setConnectTimeout(Duration.ofMillis(connectTimeout))
53+
.setReadTimeout(Duration.ofMillis(readTimeout))
54+
.basicAuthentication(username, new String(password))
5855
.detectRequestFactory(false)
5956
.build();
6057
restClient.setErrorHandler(new AxwayAPIGatewayErrorHandler());
6158
return restClient;
6259
}
6360

64-
@Bean
65-
public BrokerApiVersion brokerApiVersion() {
66-
return new BrokerApiVersion();
67-
}
61+
// @Bean
62+
// public BrokerApiVersion brokerApiVersion() {
63+
// return new BrokerApiVersion();
64+
// }
6865

6966
@Bean
7067
public ObjectMapper objectMapper() {
@@ -90,6 +87,11 @@ public AxwayApplicationClient axwayApplicationClient() {
9087
return axwayApplicationClient;
9188
}
9289

90+
@Bean
91+
public ServiceBrokerHelper serviceBrokerHelper(){
92+
return new ServiceBrokerHelper();
93+
}
94+
9395
@Bean
9496
public AxwayAPIClient axwayAPIClient() {
9597
AxwayAPIClient axwayAPIClient = new AxwayAPIClient();
@@ -102,7 +104,7 @@ public Util util() {
102104
}
103105

104106
@Bean
105-
public String url() {
107+
public String apiManagerURL() {
106108
return url;
107109
}
108110
}

src/main/java/com/axway/apim/servicebroker/config/CFResourceOwnerPasswordAccessTokenProvider.java

Lines changed: 0 additions & 91 deletions
This file was deleted.

0 commit comments

Comments
 (0)