Skip to content

Commit

Permalink
Scanner filtering, file name parsing and HTTP auth (#139)
Browse files Browse the repository at this point in the history
* Add an exclude extension filter for the file polling module

* Support merging trailing parts of the file name parsing into the final
paramerter in the "format" attribute.

* Support merging extra parts of the parsed parmeter string

* Support HTTP authentication when connecting to partner servers.

* Document the enhancements for 2.7.0 release

* Support exclusion filters in directory polling

* Unit tests for file name parsing and file filtering

* Add additional partnership

* Fix the async port number

* Updated release versions

* Update release notes for 2.7.0
  • Loading branch information
uhurusurfa authored Mar 2, 2019
1 parent 58a7648 commit 06fd4c2
Show file tree
Hide file tree
Showing 18 changed files with 671 additions and 488 deletions.
2 changes: 1 addition & 1 deletion Bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>net.sf.openas2</groupId>
<artifactId>OpenAS2</artifactId>
<version>2.6.4</version>
<version>2.7.0</version>
</parent>

<artifactId>openas2-osgi</artifactId>
Expand Down
18 changes: 10 additions & 8 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
# OpenAS2 Server
# Version 2.6.4
# Version 2.7.0
# RELEASE NOTES
-----
The OpenAS2 project is pleased to announce the release of OpenAS2 2.6.4
The OpenAS2 project is pleased to announce the release of OpenAS2 2.7.0

The release download file is: OpenAS2Server-2.6.4.zip
The release download file is: OpenAS2Server-2.7.0.zip

The zip file contains a PDF document (OpenAS2HowTo.pdf) providing information on installing and using the application.

Version 2.6.4 - 2019-02-01
This is a minor bugfix release:
**IMPORTANT NOTE**: Please review upgrade notes below if you are upgrading
Version 2.7.0 - 2019-03-03
This is a minor enhancement release:
**IMPORTANT NOTE**: Please review upgrade notes if you are upgrading

1. Change the "Reporting-UA" MDN attribute to use the "http.user.agent" property value instead of the OpenAS2 application version if set.
2. Enhance documentation to show how to configure with multiple partners.
1. Add an exclude filter option for the file polling module to support large files using a temporary extension until file is copied to directory
2. Add support for including extra parts of a parsed file name into the final parameter in the "format" attribute for file name parsing.
3. Support HTTP authentication on a per partnership basis.
4. Document the use of HTTP authentication, file filters and file name parsing functionality.

##Upgrade Notes
See the openAS2HowTo appendix for the general process on upgrading OpenAS2.
Expand Down
2 changes: 1 addition & 1 deletion Remote/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>net.sf.openas2</groupId>
<artifactId>OpenAS2</artifactId>
<version>2.6.4</version>
<version>2.7.0</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion Server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>net.sf.openas2</groupId>
<artifactId>OpenAS2</artifactId>
<version>2.6.4</version>
<version>2.7.0</version>
</parent>

<artifactId>openas2-server</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions Server/src/config/partnerships.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<attribute name="subject" value="File $attributes.filename$ sent from $sender.name$ to $receiver.name$"/>
<attribute name="as2_url" value="http://localhost:10080"/>
<attribute name="as2_mdn_to" value="[email protected]"/>
<!-- <attribute name="as2_receipt_option" value="http://localhost:10080"/> ...for async MDN-->
<!-- <attribute name="as2_receipt_option" value="http://localhost:10081"/> ...for async MDN-->
<attribute name="as2_mdn_options" value="signed-receipt-protocol=optional, pkcs7-signature; signed-receipt-micalg=optional, SHA256"/>
<attribute name="encrypt" value="3DES"/>
<attribute name="sign" value="SHA1"/>
Expand All @@ -37,7 +37,7 @@
<attribute name="subject" value="File $attributes.filename$ sent from $sender.name$ to $receiver.name$"/>
<attribute name="as2_url" value="http://localhost:10080"/>
<attribute name="as2_mdn_to" value="[email protected]"/>
<!-- <attribute name="as2_receipt_option" value="http://localhost:10080"/> ...for async MDN-->
<!-- <attribute name="as2_receipt_option" value="http://localhost:10081"/> ...for async MDN-->
<attribute name="as2_mdn_options" value="signed-receipt-protocol=optional, pkcs7-signature; signed-receipt-micalg=optional, SHA256"/>
<attribute name="encrypt" value="3DES"/>
<attribute name="sign" value="SHA256"/>
Expand Down
24 changes: 21 additions & 3 deletions Server/src/main/java/org/openas2/params/ParameterParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,44 @@ public void setParameters(String encodedParams) throws InvalidParameterException
* <code>msg.sender.as2_id,msg.receiver.as2_id,msg.header.content-type</code>
* @param delimiters delimiters in string to parse, like "-."
* @param value string to parse, like <code>"NORINCO-WALMART.application/X12"</code>
* @param mergeExtraTokens if "value" string contains more tokens than the "foprmat" string merge the extra tokens into final token from "format" string
* @throws OpenAS2Exception - error in the parameter format string
*/
public void setParameters(String format, String delimiters, String value)
public void setParameters(String format, String delimiters, String value, boolean mergeExtraTokens)
throws OpenAS2Exception {
List<String> keys = parseKeys(format);

StringTokenizer valueTokens = new StringTokenizer(value, delimiters, false);
StringTokenizer valueTokens = new StringTokenizer(value, delimiters, true);
Iterator<String> keyIt = keys.iterator();
String key;
String tail = "";
String finalKey = "";
String tailDelim = "";

while (keyIt.hasNext()) {
if (!valueTokens.hasMoreTokens()) {
throw new OpenAS2Exception("String value does not match format: Format=" + format + " ::: Value=" + value + " ::: String delimiters=" + delimiters);
}

key = ((String) keyIt.next()).trim();
finalKey = key;

if (!key.equals("")) {
setParameter(key, valueTokens.nextToken());
String val = valueTokens.nextToken();
setParameter(key, val);
// Move to next non-delimiter token if more
if (valueTokens.hasMoreTokens()) tailDelim = valueTokens.nextToken();
finalKey = key;
tail = val;
}
}
if (mergeExtraTokens && valueTokens.hasMoreTokens()) {
while (valueTokens.hasMoreTokens()) {
tail = tail + tailDelim + valueTokens.nextToken();
if (valueTokens.hasMoreTokens()) tailDelim = valueTokens.nextToken();
}
setParameter(finalKey, tail);
}
}

/**
Expand Down Expand Up @@ -121,6 +138,7 @@ public String format(String format) throws InvalidParameterException {

protected List<String> parseKeys(String format) {
StringTokenizer tokens = new StringTokenizer(format, ",", false);

List<String> keys = new ArrayList<String>();

while (tokens.hasMoreTokens()) {
Expand Down
Loading

0 comments on commit 06fd4c2

Please sign in to comment.