Skip to content

Commit a4b0af0

Browse files
authored
Release v1.2.0 (#57)
* ID-55: support multiple base directories for certs * Start work on next release * ID-56: read properties from stdin * ID-56: amend documentation * Release v1.2.0
1 parent 7fcfb9a commit a4b0af0

File tree

17 files changed

+156
-58
lines changed

17 files changed

+156
-58
lines changed

CHANGELOG.adoc

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,46 @@
11
= Changelog
22

3+
== Version 1.2.0
4+
[cols="1,2,<10a", options="header"]
5+
|===
6+
|ID|Type|Description
7+
|https://github.com/Axway-API-Management-Plus/apigw-maven-plugin/issues/55[#55]
8+
|Enhancement
9+
|Add support for multiple base directories for certificates.
10+
11+
|https://github.com/Axway-API-Management-Plus/apigw-maven-plugin/issues/56[#56]
12+
|Enhancement
13+
|Read properties from stdin.
14+
15+
If the filename of the `--prop` parameter is a single dash `-`, stdin will be used to read properties from a flat key/value JSON document.
16+
17+
.Example of flat key/value JSON
18+
[source, json]
19+
----
20+
{
21+
"prop1": "value1",
22+
"prop2": "value2"
23+
}
24+
----
25+
26+
[NOTE]
27+
====
28+
This feature can be used to read properties from external sources (e.g. AWS Secrets Manager or Hashicorp Vault).
29+
30+
[source, shell]
31+
----
32+
# Get properties from Vault key/value engine
33+
vault kv get -format=json kv/apim \| jq .data.data \| buildfed --prop - -p src/gw.pol -e src/gw.env -c config/gw.config.json
34+
----
35+
====
36+
37+
|===
38+
339
== Version 1.1.0
440
[cols="1,2,<10a", options="header"]
541
|===
642
|ID|Type|Description
7-
|https://github.com/Axway-API-Management-Plus/apigw-maven-plugin/pull/53[#53]
43+
|https://github.com/Axway-API-Management-Plus/apigw-maven-plugin/issues/53[#53]
844
|Enhancement
945
|The property configuration now supports JSON boolean values.
1046

doc/getting-started/getting-started.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
:sectnums:
66
:source-highlighter: prettify
77

8-
:mvn-plugin-ver: 1.1.0
8+
:mvn-plugin-ver: 1.2.0
99

1010
Here you get a simple introduction on how to use the _Maven Plugin for Axway API Gateway_.
1111
It assumes that you are familiar with https://maven.apache.org[Apache Maven] and that you are familiar with PolicyStudio and the API Gateway.

doc/manual/_config-tool.adoc

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ Options:
5757
Passphrase for output archive files [optional]
5858
-s, --simulate Enable simulation mode [optional]
5959
-b DIRECTORY, --base-dir=DIRECTORY
60-
Base directory for certificate files [optional]
60+
Base directory for certificate files [multiple]
6161
--secrets-file=FILEPATH
62-
Path of JSON file containing confidential propertiers
62+
Path of JSON file containing confidential properties
6363
[optional]
6464
--secrets-key=FILEPATH
6565
Path to key file to decrypt confidential properties [optional]
@@ -91,6 +91,9 @@ Multiple files are supported by specifying the parameter multiple times.
9191

9292
If a property occurs in multiple files the value from the last file is used.
9393

94+
Specify a single dash '-' as filename to read properties from `stdin`.
95+
The input must be a flat key/value JSON document (e.g., `{"p1": "v1", "p2": "v2"}`).
96+
9497
|--cert
9598
|An optional JSON file containing the certificate configuration.
9699

@@ -154,7 +157,11 @@ To avoid errors due to incompatible types (e.g. placeholder string used for an i
154157

155158
|-b, --base-dir
156159
|Base directory for certificate files.
157-
If specified relative path to certificate files is based on this directory.
160+
161+
Multiple directories can be specified by adding the parameter multiple times.
162+
163+
If specified, the given directories are scanned for certificate files.
164+
If multiple certificate files exists the first one will be used.
158165

159166
|--secrets-file
160167
|Path of JSON file containing confidential properties.

doc/manual/_reference.adoc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,12 @@ The plugin can also be configured in the `pom.xml` via the <configuration> eleme
413413
</configPropertFiles>
414414
415415
<configCertsBaseDir>${basedir}/src/main/axwgw/certs</configCertsBaseDir> <!--5-->
416-
417-
<configSecretsFile>${basedir}/src/main/axwgw/gateway.crypt.json</configSecretsFile> <!--6-->
418-
<configSecretsKey>${user.home}/secrets.key</configSecretsKey> <!--7-->
416+
<configCertsBaseDirs>
417+
<configCertsBaseDir>${basedir}/src/main/axwgw/certs/common</configCertsBaseDir> <!--6-->
418+
<configCertsBaseDir>${basedir}/src/main/axwgw/certs/ca</configCertsBaseDir>
419+
</configCertsBaseDirs>
420+
<configSecretsFile>${basedir}/src/main/axwgw/gateway.crypt.json</configSecretsFile> <!--7-->
421+
<configSecretsKey>${user.home}/secrets.key</configSecretsKey> <!--8-->
419422
</configuration>
420423
</plugin>
421424
<!- ... ->
@@ -425,5 +428,6 @@ The plugin can also be configured in the `pom.xml` via the <configuration> eleme
425428
<3> Location of a configuration file for properties.
426429
<4> Location of a list of configuration files for properties.
427430
<5> Base directory for certificate files.
428-
<6> Path to secrets file.
429-
<7> Key file to decrypt/encrypt values of secrets file.
431+
<6> Additional base directories for certificate files supported.
432+
<7> Path to secrets file.
433+
<8> Key file to decrypt/encrypt values of secrets file.

doc/manual/user-guide.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
= Maven Plugin for API Gateway Policy Development: User Guide
22
:Author: Martin Look
33
4-
:revnumber: 1.1.0
4+
:revnumber: 1.2.0
55
:toc:
66
:sectnums:
77
:source-highlighter: prettify
File renamed without changes.

example/config-tool/run.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ REM Define environment variables for field value and password configuration
88
SET INFO_NAME=Demo
99
SET NEW_SERVER_PASSWORD=changeme
1010

11-
CALL %BUILDFED% -v -e src\gateway.env -p src\gateway.pol -c config\gateway.config.json --cert=config\gateway.certs.json --prop=config\gateway.props.json --secrets-file=config\gateway.crypt.json --secrets-key=key.binary -D artifact:demo-1.0.0 -F info.descr:config\description.txt --output-fed=gateway.fed --passphrase-in=changeme --passphrase-out=changed --base-dir=config/certs
11+
CALL %BUILDFED% -v -e src\gateway.env -p src\gateway.pol -c config\gateway.config.json --cert=config\gateway.certs.json --prop=config\gateway.props.json --secrets-file=config\gateway.crypt.json --secrets-key=key.binary -D artifact:demo-1.0.0 -F info.descr:config\description.txt --output-fed=gateway.fed --passphrase-in=changeme --passphrase-out=changed --base-dir=config/certs/common --base-dir=config/certs
1212
ENDLOCAL

example/getting-started/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<packaging>pom</packaging>
88

99
<properties>
10-
<axway.maven.plugin.ver>1.1.0</axway.maven.plugin.ver>
10+
<axway.maven.plugin.ver>1.2.0</axway.maven.plugin.ver>
1111
</properties>
1212

1313
<modules>

pom.xml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<groupId>com.axway.maven.plugins</groupId>
2121
<artifactId>apigw-maven-plugin</artifactId>
22-
<version>1.1.0</version>
22+
<version>1.2.0</version>
2323
<packaging>maven-plugin</packaging>
2424

2525
<name>Axway API Gateway Maven Plugin</name>
@@ -65,6 +65,8 @@
6565
<maven.compiler.target>1.8</maven.compiler.target>
6666

6767
<jackson.version>[2.9.9.1,)</jackson.version>
68+
<karate.version>0.9.6</karate.version>
69+
<cucumber.version>5.4.0</cucumber.version>
6870

6971
<maven.wagon.http.pool>false</maven.wagon.http.pool>
7072
</properties>
@@ -111,6 +113,26 @@
111113
<artifactId>jackson-databind</artifactId>
112114
<version>${jackson.version}</version>
113115
</dependency>
116+
<dependency>
117+
<groupId>com.intuit.karate</groupId>
118+
<artifactId>karate-core</artifactId>
119+
<version>${karate.version}</version>
120+
</dependency>
121+
<dependency>
122+
<groupId>com.intuit.karate</groupId>
123+
<artifactId>karate-apache</artifactId>
124+
<version>${karate.version}</version>
125+
</dependency>
126+
<dependency>
127+
<groupId>com.intuit.karate</groupId>
128+
<artifactId>karate-junit5</artifactId>
129+
<version>${karate.version}</version>
130+
</dependency>
131+
<dependency>
132+
<groupId>net.masterthought</groupId>
133+
<artifactId>cucumber-reporting</artifactId>
134+
<version>${cucumber.version}</version>
135+
</dependency>
114136
</dependencies>
115137

116138
<build>

src/main/java/com/axway/maven/apigw/AbstractGatewayMojo.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,10 @@ public abstract class AbstractGatewayMojo extends AbstractMojo {
9898

9999
@Parameter(property = "axway.config.certs.basedir", required = false)
100100
protected File configCertsBaseDir = null;
101-
101+
102+
@Parameter(property = "axway.config.certs.basedirs", required = false)
103+
protected File[] configCertsBaseDirs = null;
104+
102105
@Parameter(property = "axway.tools.cfg.cert.expirationDays", required = false)
103106
protected int certExpirationDays = 10;
104107

@@ -308,4 +311,17 @@ protected Map<String, String> buildPolicyProperties() throws MojoExecutionExcept
308311

309312
return polProps;
310313
}
314+
315+
protected List<File> getCertificateBaseDirs() {
316+
ArrayList<File> baseDirs = new ArrayList<>();
317+
if (this.configCertsBaseDir != null) {
318+
baseDirs.add(this.configCertsBaseDir);
319+
}
320+
if (this.configCertsBaseDirs != null) {
321+
for (File f : this.configCertsBaseDirs) {
322+
baseDirs.add(f);
323+
}
324+
}
325+
return baseDirs;
326+
}
311327
}

0 commit comments

Comments
 (0)