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
Allow for extension classes to post-process generated XML #321
Allow for extension classes to post-process generated XML #321
Conversation
While using this feature myself to implement SPID, it emerged that I can't add this change to this pull request right now, until the refactoring introduced in #307 is accepted. Here is just a preview: mauromol@c96a1d4 (but a more comprehensive change should most probably increase the An alternative but more invasive approach could be the following (I use the
However in this case, to avoid confusion, all the input-related getters in |
ab7e4d7
to
3c79c8c
Compare
I'm ok with the postProcessXml idea that will allow you to extend the behavior. But I don't see why in each class you need to recover the settings. If you are using the Auth class, you already have the getSettings method I believe that instead of adding settings to the class and create a return method, you could simply define postProcessXml as
That way you could even inject changes on the settings object |
I think that lowering the coupling between the message classes and the settings is a good idea, so adding the settings parameter to |
As a follow up to my previous comment, let's consider |
This change allows for any java-saml consumer to extend the standard classes used to generate SAML messages (AuthnRequest, LogoutRequest and LogoutResponse), as well as the metadata, and provide their own logic to post-process the default XML produced by java-saml. Any extension class will then be able to transform or enrich the generated XML as required, before the framework applies encoding, encryption or signing.
The various SAML message and metadata object classes have now a protected getter that allows for subclasses to access the settings specified at construction time. This is useful to ease extension, for instance when implementing postProcessXml, so that extensions don't need to save their own copy of the settings.
This reverts commit 91fb559.
9f2132f
to
423618a
Compare
@pitbulk I made |
This change allows for any java-saml consumer to extend the standard
classes used to generate SAML messages (AuthnRequest, LogoutRequest and
LogoutResponse), as well as the metadata, and provide their own logic to
post-process the default XML produced by java-saml. Any extension class
will then be able to transform or enrich the generated XML as required,
before the framework applies encoding, encryption or signing.
This is the implementation of the idea I was thinking of when writing #265 (comment). I think this is the most non-instrusive and not too dirty way to let java-saml be extended by consumers. Of course, this is just one step: if the consumer wants to use the
Auth
class as well, the other problem I mentioned in the above comment must be solved (please see #265 (comment) for a proposal).