Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do a "reverse" partnership lookup when receiving a message? #8

Closed
jochenberger opened this issue Sep 9, 2015 · 16 comments
Closed

Do a "reverse" partnership lookup when receiving a message? #8

jochenberger opened this issue Sep 9, 2015 · 16 comments

Comments

@jochenberger
Copy link
Collaborator

This is a question rather than an actual issue.
I have created a custom IPartnershipFactory that stores partnerships in a MongoDB collection. (I could contribute the code if you're interested).
I have noticed that for a local station L and a remote station R, I need two partnerships, one with sender L and recipient R and one with the parameters exchanged.
I have implemented getPartnershipByID(IStringMap, IStringMap) to use a reverse query and create the Partnership object in the "wrong" direction. I wonder if that should be done somewhere within the library code. because the library knows whether the message is incoming or outgoing.

@phax
Copy link
Owner

phax commented Sep 9, 2015

I don't really understand what you exactly want. You want to thave getPartnershipByID being publically available? Or you want something like getReversePartnership(Partnersip) comprable to getPartnership(Partnership)?

@jochenberger
Copy link
Collaborator Author

Okay, let me try again. ;-)
I think that an outgoing message from L to R should use the same Partnership as the MDN response. Currently, you'd need to add two partnerships, a? Sender L, Recipient R and b) Sender R, Recipient L.
Maybe the differentiation between "sender" and "recipient" is not the best choice here. If a partnership consisted of a "local" and "remote" part, the same partnership could be used for the message and the response.
But if you want to keep the terms, all places that handle incoming messages could to the lookup for the partnership the other way around and that's basically what I did in my implementation of getPartnershipByID.

@phax
Copy link
Owner

phax commented Sep 9, 2015

Okay- I think I'm getting a little closer to understanding. Your assumption is, that all partnerships are reversibly exchangable. This is not true concerning what I have seen so far.

If this is something that is special to your use case, I suggest to stick to your implementation :) I see no realistic way that the automatic reverse handling will work for everbody.

@jochenberger
Copy link
Collaborator Author

Yes, that's what I assumed. Sorry, I'm quite new to AS2, and I'm not familiar with all the possible setups. Could you please give an example where that would not work? I wonder what the difference could be. I can imagine different setups for sending and receiving messages but not for sending a message and receiving a DN.

@phax
Copy link
Owner

phax commented Sep 10, 2015

One possible example is that your are sending unsigned but expect a signed MDN back. In general, if the signing setup differs between message and MDN. Additionally there are attributes like 'subject' or 'as2_mdn_to' that might be differing.

@phax phax closed this as completed Sep 10, 2015
@jochenberger
Copy link
Collaborator Author

Hm, that still feels like a single partnership with outbound_signing_options and inbound_signing_options to me, but I guess that's a matter of taste. Thanks for the explanation.

@phax
Copy link
Owner

phax commented Sep 14, 2015

Exactly. You could group things for signing, encryption, transfer, resend etc. as it is done for the partners. But as this is a fork of OpenAS2 I want to provide some basic compatibility with it and stick to it :)
Concerning the release - I'm still investigating the problem, but I think we're coming closer and as soon as this is settled, the 2.2.0 release will go out!

@phax
Copy link
Owner

phax commented Sep 16, 2015

Do you have concrete plans on providing the MongoDB based partnership factory? Shall I wait for it, or will you come back to me when you're ready? Thanks

@jochenberger
Copy link
Collaborator Author

I've created a Gist for the current version: https://gist.github.com/jochenberger/e147a739a9e6e8ed58b1
But it doesn't adhere to the conventions of the library and doesn't have tests. That's going to take a while though I'm afraid.

@phax
Copy link
Owner

phax commented Sep 16, 2015

Do you mind if I make this a subproject in as2-lib and give you collaboration rights to push on that subproject?

@jochenberger
Copy link
Collaborator Author

You can do that, but I doubt that I'll find the time to work on this in the next few weeks. Can I use Gradle and Spock or do I have to use Maven?

@phax
Copy link
Owner

phax commented Sep 16, 2015

I would take care about the Maven stuff. Concerning the tests, if you can enable Spock only for that sub-project I have no strong feelings.
Is the FreeBSD license (as with the rest of as2-lib) okay for you?

@jochenberger
Copy link
Collaborator Author

I prefer Apache 2, but FreeBSD should be okay too.
I'll try to create a Spock test, we'll see if I can get it to work with Maven.

@phax
Copy link
Owner

phax commented Sep 17, 2015

OK. I made the subproject Apache 2 licensed - no problem.
https://github.com/phax/as2-lib/tree/master/as2-partnership-mongodb contains the sub-project including the Maven setup and a basic JUnit test with embedded MongoDB (but just testing Mongo and not the Partnership factory)

@jochenberger
Copy link
Collaborator Author

I added a basic test, seems to work. I'm having issues with Maven/Eclipse/Groovy however (Plugin execution not covered by lifecycle configuration: org.codehaus.gmavenplus:gmavenplus-plugin:1.4:compile (execution: default, phase: compile)), maybe you can get it to work.
I guess we should git-ignore Eclipse-generated files, like .settings/, .classpath, and .project and probably remove them from version control altogether. What do you think?

@phax
Copy link
Owner

phax commented Oct 6, 2015

thanks a lot for adding a test. If just added some minor cleansings when using this from within Eclipse. On the commandline it works just fine!
As I'm using Eclipse and there are no real contributors I prefer to leave the Eclipse settings in there. If there are other contributors adding a bit more I may theoretically remove the files/dirs you mentioned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants