summaryrefslogtreecommitdiffstats
path: root/neethi
diff options
context:
space:
mode:
Diffstat (limited to 'neethi')
-rw-r--r--neethi/AUTHORS0
-rw-r--r--neethi/COPYING203
-rw-r--r--neethi/ChangeLog0
-rw-r--r--neethi/INSTALL0
-rw-r--r--neethi/Makefile.am3
-rw-r--r--neethi/NEWS0
-rw-r--r--neethi/README0
-rwxr-xr-xneethi/autogen.sh51
-rw-r--r--neethi/configure.ac73
-rw-r--r--neethi/include/axis2_rm_assertion.h267
-rw-r--r--neethi/include/axis2_rm_assertion_builder.h48
-rw-r--r--neethi/include/neethi_all.h81
-rw-r--r--neethi/include/neethi_assertion.h208
-rw-r--r--neethi/include/neethi_assertion_builder.h46
-rw-r--r--neethi/include/neethi_constants.h87
-rw-r--r--neethi/include/neethi_engine.h144
-rw-r--r--neethi/include/neethi_exactlyone.h81
-rw-r--r--neethi/include/neethi_includes.h55
-rw-r--r--neethi/include/neethi_mtom_assertion_checker.h43
-rw-r--r--neethi/include/neethi_operator.h95
-rw-r--r--neethi/include/neethi_policy.h126
-rw-r--r--neethi/include/neethi_reference.h69
-rw-r--r--neethi/include/neethi_registry.h71
-rw-r--r--neethi/include/neethi_util.h53
-rw-r--r--neethi/include/rp_algorithmsuite.h218
-rw-r--r--neethi/include/rp_algorithmsuite_builder.h45
-rw-r--r--neethi/include/rp_asymmetric_binding.h88
-rw-r--r--neethi/include/rp_asymmetric_binding_builder.h46
-rw-r--r--neethi/include/rp_binding_commons.h126
-rw-r--r--neethi/include/rp_bootstrap_policy_builder.h44
-rw-r--r--neethi/include/rp_builders.h64
-rw-r--r--neethi/include/rp_defines.h232
-rw-r--r--neethi/include/rp_element.h69
-rw-r--r--neethi/include/rp_encryption_token_builder.h48
-rw-r--r--neethi/include/rp_header.h69
-rw-r--r--neethi/include/rp_https_token.h85
-rw-r--r--neethi/include/rp_https_token_builder.h45
-rw-r--r--neethi/include/rp_includes.h52
-rw-r--r--neethi/include/rp_initiator_token_builder.h45
-rw-r--r--neethi/include/rp_issued_token.h124
-rw-r--r--neethi/include/rp_issued_token_builder.h50
-rw-r--r--neethi/include/rp_layout.h63
-rw-r--r--neethi/include/rp_layout_builder.h45
-rw-r--r--neethi/include/rp_policy_creator.h52
-rw-r--r--neethi/include/rp_property.h95
-rw-r--r--neethi/include/rp_protection_token_builder.h48
-rw-r--r--neethi/include/rp_rampart_config.h217
-rw-r--r--neethi/include/rp_rampart_config_builder.h45
-rw-r--r--neethi/include/rp_recipient_token_builder.h45
-rw-r--r--neethi/include/rp_saml_token.h97
-rw-r--r--neethi/include/rp_saml_token_builder.h44
-rw-r--r--neethi/include/rp_secpolicy.h213
-rw-r--r--neethi/include/rp_secpolicy_builder.h44
-rw-r--r--neethi/include/rp_security_context_token.h143
-rw-r--r--neethi/include/rp_security_context_token_builder.h47
-rw-r--r--neethi/include/rp_signature_token_builder.h48
-rw-r--r--neethi/include/rp_signed_encrypted_elements.h86
-rw-r--r--neethi/include/rp_signed_encrypted_items.h70
-rw-r--r--neethi/include/rp_signed_encrypted_parts.h98
-rw-r--r--neethi/include/rp_signed_encrypted_parts_builder.h55
-rw-r--r--neethi/include/rp_supporting_tokens.h132
-rw-r--r--neethi/include/rp_supporting_tokens_builder.h49
-rw-r--r--neethi/include/rp_symmetric_asymmetric_binding_commons.h117
-rw-r--r--neethi/include/rp_symmetric_binding.h99
-rw-r--r--neethi/include/rp_symmetric_binding_builder.h45
-rw-r--r--neethi/include/rp_token.h134
-rw-r--r--neethi/include/rp_token_identifier.h46
-rw-r--r--neethi/include/rp_transport_binding.h76
-rw-r--r--neethi/include/rp_transport_binding_builder.h46
-rw-r--r--neethi/include/rp_transport_token_builder.h45
-rw-r--r--neethi/include/rp_trust10.h108
-rw-r--r--neethi/include/rp_trust10_builder.h45
-rw-r--r--neethi/include/rp_username_token.h138
-rw-r--r--neethi/include/rp_username_token_builder.h45
-rw-r--r--neethi/include/rp_wss10.h96
-rw-r--r--neethi/include/rp_wss10_builder.h45
-rw-r--r--neethi/include/rp_wss11.h129
-rw-r--r--neethi/include/rp_wss11_builder.h45
-rw-r--r--neethi/include/rp_x509_token.h142
-rw-r--r--neethi/include/rp_x509_token_builder.h45
-rw-r--r--neethi/src/Makefile.am53
-rw-r--r--neethi/src/all.c183
-rw-r--r--neethi/src/assertion.c424
-rw-r--r--neethi/src/assertion_builder.c513
-rw-r--r--neethi/src/engine.c1390
-rw-r--r--neethi/src/exactlyone.c188
-rw-r--r--neethi/src/mtom_assertion_checker.c75
-rw-r--r--neethi/src/operator.c216
-rw-r--r--neethi/src/policy.c446
-rw-r--r--neethi/src/reference.c104
-rw-r--r--neethi/src/registry.c131
-rw-r--r--neethi/src/rmpolicy/Makefile.am13
-rw-r--r--neethi/src/rmpolicy/rm_assertion.c511
-rw-r--r--neethi/src/rmpolicy/rm_assertion_builder.c562
-rw-r--r--neethi/src/samples/test1.xml4
-rw-r--r--neethi/src/samples/test10.xml1
-rw-r--r--neethi/src/samples/test11.xml1
-rw-r--r--neethi/src/samples/test12.xml1
-rw-r--r--neethi/src/samples/test13.xml1
-rw-r--r--neethi/src/samples/test14.xml1
-rw-r--r--neethi/src/samples/test15.xml1
-rw-r--r--neethi/src/samples/test16.xml1
-rw-r--r--neethi/src/samples/test17.xml1
-rw-r--r--neethi/src/samples/test18.xml1
-rw-r--r--neethi/src/samples/test19.xml1
-rw-r--r--neethi/src/samples/test2.xml1
-rw-r--r--neethi/src/samples/test20.xml1
-rw-r--r--neethi/src/samples/test21.xml10
-rw-r--r--neethi/src/samples/test22.xml1
-rw-r--r--neethi/src/samples/test23.xml1
-rw-r--r--neethi/src/samples/test24.xml1
-rw-r--r--neethi/src/samples/test25.xml7
-rw-r--r--neethi/src/samples/test3.xml20
-rw-r--r--neethi/src/samples/test4.xml1
-rw-r--r--neethi/src/samples/test5.xml1
-rw-r--r--neethi/src/samples/test6.xml1
-rw-r--r--neethi/src/samples/test7.xml1
-rw-r--r--neethi/src/samples/test8.xml4
-rw-r--r--neethi/src/samples/test9.xml1
-rw-r--r--neethi/src/secpolicy/Makefile.am1
-rw-r--r--neethi/src/secpolicy/builder/Makefile.am25
-rw-r--r--neethi/src/secpolicy/builder/algorithmsuite_builder.c82
-rw-r--r--neethi/src/secpolicy/builder/asymmetric_binding_builder.c234
-rw-r--r--neethi/src/secpolicy/builder/bootstrap_policy_builder.c61
-rw-r--r--neethi/src/secpolicy/builder/encryption_token_builder.c175
-rw-r--r--neethi/src/secpolicy/builder/https_token_builder.c56
-rw-r--r--neethi/src/secpolicy/builder/initiator_token_builder.c138
-rw-r--r--neethi/src/secpolicy/builder/issued_token_builder.c164
-rw-r--r--neethi/src/secpolicy/builder/layout_builder.c74
-rw-r--r--neethi/src/secpolicy/builder/protection_token_builder.c175
-rw-r--r--neethi/src/secpolicy/builder/rampart_config_builder.c213
-rw-r--r--neethi/src/secpolicy/builder/recipient_token_builder.c139
-rw-r--r--neethi/src/secpolicy/builder/saml_token_builder.c155
-rw-r--r--neethi/src/secpolicy/builder/secpolicy_builder.c241
-rw-r--r--neethi/src/secpolicy/builder/security_context_token_builder.c231
-rw-r--r--neethi/src/secpolicy/builder/signature_token_builder.c175
-rw-r--r--neethi/src/secpolicy/builder/signed_encrypted_parts_builder.c209
-rw-r--r--neethi/src/secpolicy/builder/supporting_tokens_builder.c203
-rw-r--r--neethi/src/secpolicy/builder/symmetric_binding_builder.c245
-rw-r--r--neethi/src/secpolicy/builder/token_identifier.c78
-rw-r--r--neethi/src/secpolicy/builder/transport_binding_builder.c196
-rw-r--r--neethi/src/secpolicy/builder/transport_token_builder.c138
-rw-r--r--neethi/src/secpolicy/builder/trust10_builder.c139
-rw-r--r--neethi/src/secpolicy/builder/username_token_builder.c150
-rw-r--r--neethi/src/secpolicy/builder/wss10_builder.c135
-rw-r--r--neethi/src/secpolicy/builder/wss11_builder.c147
-rw-r--r--neethi/src/secpolicy/builder/x509_token_builder.c168
-rw-r--r--neethi/src/secpolicy/model/Makefile.am21
-rw-r--r--neethi/src/secpolicy/model/algorithmsuite.c627
-rw-r--r--neethi/src/secpolicy/model/asymmetric_binding.c160
-rw-r--r--neethi/src/secpolicy/model/binding_commons.c245
-rw-r--r--neethi/src/secpolicy/model/element.c112
-rw-r--r--neethi/src/secpolicy/model/header.c123
-rw-r--r--neethi/src/secpolicy/model/https_token.c153
-rw-r--r--neethi/src/secpolicy/model/issued_token.c211
-rw-r--r--neethi/src/secpolicy/model/layout.c99
-rw-r--r--neethi/src/secpolicy/model/property.c265
-rw-r--r--neethi/src/secpolicy/model/rampart_config.c446
-rw-r--r--neethi/src/secpolicy/model/saml_token.c160
-rw-r--r--neethi/src/secpolicy/model/secpolicy.c493
-rw-r--r--neethi/src/secpolicy/model/security_context_token.c239
-rw-r--r--neethi/src/secpolicy/model/signed_encrypted_elements.c180
-rw-r--r--neethi/src/secpolicy/model/signed_encrypted_items.c136
-rw-r--r--neethi/src/secpolicy/model/signed_encrypted_parts.c176
-rw-r--r--neethi/src/secpolicy/model/supporting_tokens.c300
-rw-r--r--neethi/src/secpolicy/model/symmetric_asymmetric_binding_commons.c192
-rw-r--r--neethi/src/secpolicy/model/symmetric_binding.c216
-rw-r--r--neethi/src/secpolicy/model/token.c190
-rw-r--r--neethi/src/secpolicy/model/transport_binding.c137
-rw-r--r--neethi/src/secpolicy/model/trust10.c201
-rw-r--r--neethi/src/secpolicy/model/ut.c214
-rw-r--r--neethi/src/secpolicy/model/wss10.c178
-rw-r--r--neethi/src/secpolicy/model/wss11.c256
-rw-r--r--neethi/src/secpolicy/model/x509_token.c231
-rw-r--r--neethi/src/util.c95
-rw-r--r--neethi/test/Makefile.am14
-rw-r--r--neethi/test/main.c362
-rw-r--r--neethi/test/policies/1.5symmetric_binding_policy.xml75
-rw-r--r--neethi/test/policies/Policy-for-Endpoint-1A.xml12
-rw-r--r--neethi/test/policies/Policy-for-Endpoint-1B.xml12
-rw-r--r--neethi/test/policies/Policy-for-Endpoint-2A.xml12
-rw-r--r--neethi/test/policies/Policy-for-Endpoint-2B.xml12
-rw-r--r--neethi/test/policies/Policy-for-Input-in-Operation-1A-in-relation-to-Endpoint-1A.xml10
-rw-r--r--neethi/test/policies/Policy-for-Input-in-Operation-1A-in-relation-to-Endpoint-1B.xml10
-rw-r--r--neethi/test/policies/Policy-for-Input-in-Operation-1B-in-relation-to-Endpoint-1A.xml10
-rw-r--r--neethi/test/policies/Policy-for-Input-in-Operation-1B-in-relation-to-Endpoint-1B.xml10
-rw-r--r--neethi/test/policies/Policy-for-Input-in-Operation-2A-in-relation-to-Endpoint-2A.xml10
-rw-r--r--neethi/test/policies/Policy-for-Input-in-Operation-2A-in-relation-to-Endpoint-2B.xml10
-rw-r--r--neethi/test/policies/Policy-for-Input-in-Operation-2B-in-relation-to-Endpoint-2A.xml10
-rw-r--r--neethi/test/policies/Policy-for-Input-in-Operation-2B-in-relation-to-Endpoint-2B.xml10
-rw-r--r--neethi/test/policies/Policy-for-Operation-1A-in-relation-to-Endpoint-1A.xml10
-rw-r--r--neethi/test/policies/Policy-for-Operation-1A-in-relation-to-Endpoint-1B.xml10
-rw-r--r--neethi/test/policies/Policy-for-Operation-1B-in-relation-to-Endpoint-1A.xml10
-rw-r--r--neethi/test/policies/Policy-for-Operation-1B-in-relation-to-Endpoint-1B.xml10
-rw-r--r--neethi/test/policies/Policy-for-Operation-2A-in-relation-to-Endpoint-2A.xml10
-rw-r--r--neethi/test/policies/Policy-for-Operation-2A-in-relation-to-Endpoint-2B.xml10
-rw-r--r--neethi/test/policies/Policy-for-Operation-2B-in-relation-to-Endpoint-2A.xml10
-rw-r--r--neethi/test/policies/Policy-for-Operation-2B-in-relation-to-Endpoint-2B.xml10
-rw-r--r--neethi/test/policies/Policy-for-OutFault-in-Operation-1A-in-relation-to-Endpoint-1A.xml11
-rw-r--r--neethi/test/policies/Policy-for-OutFault-in-Operation-1A-in-relation-to-Endpoint-1B.xml11
-rw-r--r--neethi/test/policies/Policy-for-OutFault-in-Operation-1B-in-relation-to-Endpoint-1A.xml11
-rw-r--r--neethi/test/policies/Policy-for-OutFault-in-Operation-1B-in-relation-to-Endpoint-1B.xml11
-rw-r--r--neethi/test/policies/Policy-for-OutFault-in-Operation-2A-in-relation-to-Endpoint-2A.xml11
-rw-r--r--neethi/test/policies/Policy-for-OutFault-in-Operation-2A-in-relation-to-Endpoint-2B.xml11
-rw-r--r--neethi/test/policies/Policy-for-OutFault-in-Operation-2B-in-relation-to-Endpoint-2A.xml11
-rw-r--r--neethi/test/policies/Policy-for-OutFault-in-Operation-2B-in-relation-to-Endpoint-2B.xml11
-rw-r--r--neethi/test/policies/Policy-for-Output-in-Operation-1A-in-relation-to-Endpoint-1A.xml10
-rw-r--r--neethi/test/policies/Policy-for-Output-in-Operation-1A-in-relation-to-Endpoint-1B.xml10
-rw-r--r--neethi/test/policies/Policy-for-Output-in-Operation-1B-in-relation-to-Endpoint-1A.xml10
-rw-r--r--neethi/test/policies/Policy-for-Output-in-Operation-1B-in-relation-to-Endpoint-1B.xml10
-rw-r--r--neethi/test/policies/Policy-for-Output-in-Operation-2A-in-relation-to-Endpoint-2A.xml10
-rw-r--r--neethi/test/policies/Policy-for-Output-in-Operation-2A-in-relation-to-Endpoint-2B.xml10
-rw-r--r--neethi/test/policies/Policy-for-Output-in-Operation-2B-in-relation-to-Endpoint-2A.xml10
-rw-r--r--neethi/test/policies/Policy-for-Output-in-Operation-2B-in-relation-to-Endpoint-2B.xml10
-rw-r--r--neethi/test/policies/Policy-for-Service-1.xml9
-rw-r--r--neethi/test/policies/Policy-for-Service-2.xml9
-rw-r--r--neethi/test/policies/PolicyAttachments.wsdl448
-rw-r--r--neethi/test/policies/asymmetric_binding_policy.xml70
-rw-r--r--neethi/test/policies/rm-1.0.xml21
-rw-r--r--neethi/test/policies/rm-1.1.xml27
-rw-r--r--neethi/test/policies/symmetric_binding_policy.xml75
-rw-r--r--neethi/test/security_context_token/build.sh3
-rw-r--r--neethi/test/security_context_token/security_context_token_test.c54
-rw-r--r--neethi/test/test-policy.xml10
-rw-r--r--neethi/test/test-resources/different-level-policies.xml109
-rw-r--r--neethi/test/test-resources/echo-services.xml115
-rw-r--r--neethi/test/test-resources/message-services-sc.xml116
-rw-r--r--neethi/test/test-resources/services-1.xml51
-rw-r--r--neethi/test/test-resources/services-2.xml76
-rw-r--r--neethi/test/test-resources/services-3.xml88
-rw-r--r--neethi/test/test-resources/services-4.xml89
-rw-r--r--neethi/test/test-resources/services-5.xml89
-rw-r--r--neethi/test/test-resources/services-6.xml86
-rw-r--r--neethi/test/test-resources/services-7.xml89
-rw-r--r--neethi/test/test-resources/services-8.xml89
-rw-r--r--neethi/test/test-resources/services-9.xml87
-rw-r--r--neethi/test/test-resources/services-sc-1.xml176
-rw-r--r--neethi/test/test-resources/services-sc-2.xml186
-rw-r--r--neethi/test/test.c239
239 files changed, 24751 insertions, 0 deletions
diff --git a/neethi/AUTHORS b/neethi/AUTHORS
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/neethi/AUTHORS
diff --git a/neethi/COPYING b/neethi/COPYING
new file mode 100644
index 0000000..6b0b127
--- /dev/null
+++ b/neethi/COPYING
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
diff --git a/neethi/ChangeLog b/neethi/ChangeLog
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/neethi/ChangeLog
diff --git a/neethi/INSTALL b/neethi/INSTALL
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/neethi/INSTALL
diff --git a/neethi/Makefile.am b/neethi/Makefile.am
new file mode 100644
index 0000000..32865c7
--- /dev/null
+++ b/neethi/Makefile.am
@@ -0,0 +1,3 @@
+SUBDIRS = src test
+includedir=$(prefix)/include/axis2-1.6.0
+include_HEADERS=$(top_builddir)/include/*.h
diff --git a/neethi/NEWS b/neethi/NEWS
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/neethi/NEWS
diff --git a/neethi/README b/neethi/README
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/neethi/README
diff --git a/neethi/autogen.sh b/neethi/autogen.sh
new file mode 100755
index 0000000..1800ea5
--- /dev/null
+++ b/neethi/autogen.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+echo -n 'Running libtoolize...'
+if [ `uname -s` = Darwin ]
+then
+ LIBTOOLIZE=glibtoolize
+else
+ LIBTOOLIZE=libtoolize
+fi
+
+if $LIBTOOLIZE --force > /dev/null 2>&1; then
+
+ echo 'done.'
+else
+ echo 'failed.'
+ exit 1
+fi
+
+echo -n 'Running aclocal...'
+if aclocal > /dev/null 2>&1; then
+ echo 'done.'
+else
+ echo 'failed.'
+ exit 1
+fi
+
+echo -n 'Running autoheader...'
+if autoheader > /dev/null 2>&1; then
+ echo 'done.'
+else
+ echo 'failed.'
+ exit 1
+fi
+
+echo -n 'Running autoconf...'
+if autoconf > /dev/null 2>&1; then
+ echo 'done.'
+else
+ echo 'failed.'
+ exit 1
+fi
+
+echo -n 'Running automake...'
+if automake --add-missing > /dev/null 2>&1; then
+ echo 'done.'
+else
+ echo 'failed.'
+ exit 1
+fi
+
+echo 'done'
diff --git a/neethi/configure.ac b/neethi/configure.ac
new file mode 100644
index 0000000..f3a317c
--- /dev/null
+++ b/neethi/configure.ac
@@ -0,0 +1,73 @@
+dnl run autogen.sh to generate the configure script.
+
+AC_PREREQ(2.59)
+
+AC_INIT(neethi-src, 1.6.0)
+AC_CANONICAL_SYSTEM
+AM_CONFIG_HEADER(config.h)
+dnl AM_INIT_AUTOMAKE([tar-ustar])
+AM_INIT_AUTOMAKE
+m4_ifdef([_A][M_PROG_TAR],[_A][M_SET_OPTION([tar-ustar])])
+AC_PREFIX_DEFAULT(/usr/local/neethi)
+
+dnl Checks for programs.
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_CPP
+AC_PROG_LIBTOOL
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+
+dnl check for flavours of varargs macros (test from GLib)
+AC_MSG_CHECKING(for ISO C99 varargs macros in C)
+AC_TRY_COMPILE([],[
+int a(int p1, int p2, int p3);
+#define call_a(...) a(1,__VA_ARGS__)
+call_a(2,3);
+],axis2c_have_iso_c_varargs=yes,axis2c_have_iso_c_varargs=no)
+AC_MSG_RESULT($axis2c_have_iso_c_varargs)
+
+dnl Checks for libraries.
+AC_CHECK_LIB(dl, dlopen)
+
+#CFLAGS="$CFLAGS -ansi -Wall -D_LARGEFILE64_SOURCE -Wno-implicit-function-declaration"
+CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
+if test "$GCC" = "yes"; then
+ CFLAGS="$CFLAGS -ansi -Wall -Werror -Wno-implicit-function-declaration "
+fi
+
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([stdio.h stdlib.h string.h])
+AC_CHECK_HEADERS([sys/socket.h])
+dnl This is a check to see if we are running MacOS X
+dnl It may be better to do a Darwin check
+AC_CHECK_HEADER([sys/appleapiopts.h],
+ [AC_DEFINE([IS_MACOSX],[1],[Define to 1 if compiling on MacOS X])],
+ [])
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+dnl AC_C_CONST
+
+dnl Checks for library functions.
+dnl AC_FUNC_MALLOC
+dnl AC_FUNC_REALLOC
+#AC_CHECK_FUNCS([memmove])
+
+VERSION_NO="6:0:6"
+
+AC_SUBST(VERSION_NO)
+
+
+AC_CONFIG_FILES([Makefile \
+ src/Makefile \
+ src/secpolicy/Makefile \
+ src/secpolicy/model/Makefile \
+ src/secpolicy/builder/Makefile \
+ src/rmpolicy/Makefile \
+ test/Makefile
+ ])
+
+AC_OUTPUT
diff --git a/neethi/include/axis2_rm_assertion.h b/neethi/include/axis2_rm_assertion.h
new file mode 100644
index 0000000..81f612d
--- /dev/null
+++ b/neethi/include/axis2_rm_assertion.h
@@ -0,0 +1,267 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef AXIS2_RM_ASSERTION_H
+#define AXIS2_RM_ASSERTION_H
+
+/** @defgroup axis2_rm_assertion
+ * @ingroup axis2_rm_assertion
+ * @{
+ */
+
+#include <neethi_includes.h>
+#include <neethi_policy.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct axis2_rm_assertion_t axis2_rm_assertion_t;
+
+
+ AXIS2_EXTERN axis2_rm_assertion_t *AXIS2_CALL
+ axis2_rm_assertion_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ axis2_rm_assertion_free(
+ axis2_rm_assertion_t * rm_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ axis2_rm_assertion_get_is_sequence_str(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ axis2_rm_assertion_set_is_sequence_str(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_bool_t is_sequence_str);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ axis2_rm_assertion_get_is_sequence_transport_security(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ axis2_rm_assertion_set_is_sequence_transport_security(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_bool_t is_sequence_transport_security);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ axis2_rm_assertion_get_is_exactly_once(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ axis2_rm_assertion_set_is_exactly_once(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_bool_t is_exactly_once);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ axis2_rm_assertion_get_is_atleast_once(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ axis2_rm_assertion_set_is_atleast_once(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_bool_t is_atleast_once);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ axis2_rm_assertion_get_is_atmost_once(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ axis2_rm_assertion_set_is_atmost_once(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_bool_t is_atmost_once);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ axis2_rm_assertion_get_is_inorder(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ axis2_rm_assertion_set_is_inorder(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_bool_t is_inorder);
+
+ AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+ axis2_rm_assertion_get_inactivity_timeout(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ axis2_rm_assertion_set_inactivity_timeout(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* inactivity_timeout);
+
+ AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+ axis2_rm_assertion_get_retrans_interval(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ axis2_rm_assertion_set_retrans_interval(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* retrans_interval);
+
+ AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+ axis2_rm_assertion_get_ack_interval(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ axis2_rm_assertion_set_ack_interval(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* ack_interval);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ axis2_rm_assertion_get_is_exp_backoff(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ axis2_rm_assertion_set_is_exp_backoff(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_bool_t is_exp_backoff);
+
+ AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+ axis2_rm_assertion_get_storage_mgr(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ axis2_rm_assertion_set_storage_mgr(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* storage_mgr);
+
+ AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+ axis2_rm_assertion_get_message_types_to_drop(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ axis2_rm_assertion_set_message_types_to_drop(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* message_types_to_drop);
+
+ AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+ axis2_rm_assertion_get_max_retrans_count(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ axis2_rm_assertion_set_max_retrans_count(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* max_retrans_count);
+
+ AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+ axis2_rm_assertion_get_sender_sleep_time(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ axis2_rm_assertion_set_sender_sleep_time(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* sender_sleep_time);
+
+ AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+ axis2_rm_assertion_get_invoker_sleep_time(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ axis2_rm_assertion_set_invoker_sleep_time(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* invoker_sleep_time);
+
+ AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+ axis2_rm_assertion_get_polling_wait_time(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ axis2_rm_assertion_set_polling_wait_time(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* polling_wait_time);
+
+ AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+ axis2_rm_assertion_get_terminate_delay(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ axis2_rm_assertion_set_terminate_delay(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* terminate_delay);
+
+ AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+ axis2_rm_assertion_get_sandesha2_db(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ axis2_rm_assertion_set_sandesha2_db(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* sandesha2_db);
+
+ AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+ axis2_rm_assertion_get_spec_version(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ axis2_rm_assertion_set_spec_version(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* spec_version);
+
+ AXIS2_EXTERN axis2_rm_assertion_t* AXIS2_CALL
+ axis2_rm_assertion_get_from_policy(
+ const axutil_env_t *env,
+ neethi_policy_t *policy);
+
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/axis2_rm_assertion_builder.h b/neethi/include/axis2_rm_assertion_builder.h
new file mode 100644
index 0000000..276030b
--- /dev/null
+++ b/neethi/include/axis2_rm_assertion_builder.h
@@ -0,0 +1,48 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef AXIS2_RM_ASSERTION_BUILDER_H
+#define AXIS2_RM_ASSERTION_BUILDER_H
+
+/** @defgroup axis2_rm_assertion_builder
+ * @ingroup axis2_rm_assertion_builder
+ * @{
+ */
+
+#include <neethi_constants.h>
+#include <axis2_rm_assertion.h>
+#include <neethi_assertion.h>
+#include <neethi_includes.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+ #define RM_SPEC_VERSION_1_0 "Spec_2005_02"
+ #define RM_SPEC_VERSION_1_1 "Spec_2007_02"
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ axis2_rm_assertion_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *rm_assertion_node,
+ axiom_element_t *rm_assertion_ele);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/neethi_all.h b/neethi/include/neethi_all.h
new file mode 100644
index 0000000..83c518c
--- /dev/null
+++ b/neethi/include/neethi_all.h
@@ -0,0 +1,81 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NEETHI_ALL_H
+#define NEETHI_ALL_H
+
+/**
+ * @file neethi_all.h
+ * @struct for operator all
+ */
+
+#include <axis2_defines.h>
+#include <axutil_env.h>
+#include <neethi_operator.h>
+#include <neethi_includes.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct neethi_all_t neethi_all_t;
+
+ AXIS2_EXTERN neethi_all_t *AXIS2_CALL
+ neethi_all_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ neethi_all_free(
+ neethi_all_t * neethi_all,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+ neethi_all_get_policy_components(
+ neethi_all_t * neethi_all,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_all_add_policy_components(
+ neethi_all_t * all,
+ axutil_array_list_t * arraylist,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_all_add_operator(
+ neethi_all_t * neethi_all,
+ const axutil_env_t * env,
+ neethi_operator_t * op);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ neethi_all_is_empty(
+ neethi_all_t * all,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_all_serialize(
+ neethi_all_t * neethi_all,
+ axiom_node_t * parent,
+ const axutil_env_t * env);
+
+ /** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NEETHI_ALL_H */
diff --git a/neethi/include/neethi_assertion.h b/neethi/include/neethi_assertion.h
new file mode 100644
index 0000000..5a4fa97
--- /dev/null
+++ b/neethi/include/neethi_assertion.h
@@ -0,0 +1,208 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NEETHI_ASSERTION_H
+#define NEETHI_ASSERTION_H
+
+/**
+ * @file neethi_assertion.h
+ * @common struct for policy assertions.
+ */
+
+#include <axis2_defines.h>
+#include <axutil_env.h>
+#include <neethi_includes.h>
+#include <neethi_operator.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef enum
+ {
+ ASSERTION_TYPE_TRANSPORT_BINDING = 0,
+ ASSERTION_TYPE_TRANSPORT_TOKEN,
+ ASSERTION_TYPE_ALGORITHM_SUITE,
+ ASSERTION_TYPE_INCLUDE_TIMESTAMP,
+ ASSERTION_TYPE_LAYOUT,
+ ASSERTION_TYPE_SUPPORTING_TOKENS,
+ ASSERTION_TYPE_HTTPS_TOKEN,
+ ASSERTION_TYPE_WSS_USERNAME_TOKEN_10,
+ ASSERTION_TYPE_WSS_USERNAME_TOKEN_11,
+ ASSERTION_TYPE_USERNAME_TOKEN,
+ ASSERTION_TYPE_X509_TOKEN,
+ ASSERTION_TYPE_SAML_TOKEN,
+ ASSERTION_TYPE_ISSUED_TOKEN,
+ ASSERTION_TYPE_SECURITY_CONTEXT_TOKEN,
+ ASSERTION_TYPE_REQUIRE_EXTERNAL_URI,
+ ASSERTION_TYPE_SC10_SECURITY_CONTEXT_TOKEN,
+ ASSERTION_TYPE_SC13_SECURITY_CONTEXT_TOKEN,
+ ASSERTION_TYPE_ISSUER,
+ ASSERTION_TYPE_BOOTSTRAP_POLICY,
+ ASSERTION_TYPE_MUST_SUPPORT_REF_KEY_IDENTIFIER,
+ ASSERTION_TYPE_MUST_SUPPORT_REF_ISSUER_SERIAL,
+ ASSERTION_TYPE_MUST_SUPPORT_REF_EXTERNAL_URI,
+ ASSERTION_TYPE_MUST_SUPPORT_REF_EMBEDDED_TOKEN,
+ ASSERTION_TYPE_WSS10,
+ ASSERTION_TYPE_WSS11,
+ ASSERTION_TYPE_TRUST10,
+ ASSERTION_TYPE_RAMPART_CONFIG,
+ ASSERTION_TYPE_ASSYMMETRIC_BINDING,
+ ASSERTION_TYPE_SYMMETRIC_BINDING,
+ ASSERTION_TYPE_INITIATOR_TOKEN,
+ ASSERTION_TYPE_RECIPIENT_TOKEN,
+ ASSERTION_TYPE_PROTECTION_TOKEN,
+ ASSERTION_TYPE_ENCRYPTION_TOKEN,
+ ASSERTION_TYPE_SIGNATURE_TOKEN,
+ ASSERTION_TYPE_ENCRYPT_BEFORE_SIGNING,
+ ASSERTION_TYPE_SIGN_BEFORE_ENCRYPTING,
+ ASSERTION_TYPE_ENCRYPT_SIGNATURE,
+ ASSERTION_TYPE_PROTECT_TOKENS,
+ ASSERTION_TYPE_ONLY_SIGN_ENTIRE_HEADERS_AND_BODY,
+ ASSERTION_TYPE_REQUIRE_KEY_IDENTIFIRE_REFERENCE,
+ ASSERTION_TYPE_REQUIRE_ISSUER_SERIAL_REFERENCE,
+ ASSERTION_TYPE_REQUIRE_EMBEDDED_TOKEN_REFERENCE,
+ ASSERTION_TYPE_REQUIRE_THUMBPRINT_REFERENCE,
+ ASSERTION_TYPE_REQUIRE_EXTERNAL_REFERENCE,
+ ASSERTION_TYPE_REQUIRE_INTERNAL_REFERENCE,
+ ASSERTION_TYPE_MUST_SUPPORT_REF_THUMBPRINT,
+ ASSERTION_TYPE_MUST_SUPPORT_REF_ENCRYPTED_KEY,
+ ASSERTION_TYPE_REQUIRE_SIGNATURE_CONFIRMATION,
+ ASSERTION_TYPE_WSS_X509_V1_TOKEN_10,
+ ASSERTION_TYPE_WSS_X509_V3_TOKEN_10,
+ ASSERTION_TYPE_WSS_SAML_V10_TOKEN_V10,
+ ASSERTION_TYPE_WSS_SAML_V10_TOKEN_V11,
+ ASSERTION_TYPE_WSS_SAML_V11_TOKEN_V10,
+ ASSERTION_TYPE_WSS_SAML_V11_TOKEN_V11,
+ ASSERTION_TYPE_WSS_SAML_V20_TOKEN_V11,
+ ASSERTION_TYPE_SIGNED_ENCRYPTED_PARTS,
+ ASSERTION_TYPE_REQUIRE_DERIVED_KEYS_SC10,
+ ASSERTION_TYPE_REQUIRE_DERIVED_KEYS_SC13,
+ ASSERTION_TYPE_MUST_SUPPORT_CLIENT_CHALLENGE,
+ ASSERTION_TYPE_MUST_SUPPORT_SERVER_CHALLENGE,
+ ASSERTION_TYPE_REQUIRE_CLIENT_ENTROPY,
+ ASSERTION_TYPE_REQUIRE_SERVER_ENTROPHY,
+ ASSERTION_TYPE_MUST_SUPPORT_ISSUED_TOKENS,
+ ASSERTION_TYPE_OPTIMIZED_MIME_SERIALIZATION,
+ ASSERTION_TYPE_RM_ASSERTION,
+ ASSERTION_TYPE_UNKNOWN
+ } neethi_assertion_type_t;
+
+ typedef struct neethi_assertion_t neethi_assertion_t;
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ neethi_assertion_create(
+ const axutil_env_t * env);
+
+ neethi_assertion_t *AXIS2_CALL
+ neethi_assertion_create_with_args(
+ const axutil_env_t * env,
+ AXIS2_FREE_VOID_ARG free_func,
+ void *value,
+ neethi_assertion_type_t type);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ neethi_assertion_free(
+ neethi_assertion_t * neethi_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN neethi_assertion_type_t AXIS2_CALL
+ neethi_assertion_get_type(
+ neethi_assertion_t * neethi_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void *AXIS2_CALL
+ neethi_assertion_get_value(
+ neethi_assertion_t * neethi_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_assertion_set_value(
+ neethi_assertion_t * neethi_assertion,
+ const axutil_env_t * env,
+ void *value,
+ neethi_assertion_type_t type);
+
+ AXIS2_EXTERN axiom_element_t *AXIS2_CALL
+ neethi_assertion_get_element(
+ neethi_assertion_t * neethi_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_assertion_set_element(
+ neethi_assertion_t * neethi_assertion,
+ const axutil_env_t * env,
+ axiom_element_t * element);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ neethi_assertion_get_is_optional(
+ neethi_assertion_t * neethi_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_assertion_set_is_optional(
+ neethi_assertion_t * neethi_assertion,
+ const axutil_env_t * env,
+ axis2_bool_t is_optional);
+
+ AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+ neethi_assertion_get_policy_components(
+ neethi_assertion_t * neethi_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_assertion_add_policy_components(
+ neethi_assertion_t * neethi_assertion,
+ axutil_array_list_t * arraylist,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_assertion_add_operator(
+ neethi_assertion_t * neethi_assertion,
+ const axutil_env_t * env,
+ neethi_operator_t * op);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ neethi_assertion_is_empty(
+ neethi_assertion_t * neethi_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+ neethi_assertion_get_node(
+ neethi_assertion_t * neethi_assertion,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_assertion_set_node(
+ neethi_assertion_t * neethi_assertion,
+ const axutil_env_t * env,
+ axiom_node_t * node);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_assertion_serialize(
+ neethi_assertion_t * assertion,
+ axiom_node_t * parent,
+ const axutil_env_t * env);
+
+ /** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NEETHI_ASSERTION_H */
diff --git a/neethi/include/neethi_assertion_builder.h b/neethi/include/neethi_assertion_builder.h
new file mode 100644
index 0000000..8014fcd
--- /dev/null
+++ b/neethi/include/neethi_assertion_builder.h
@@ -0,0 +1,46 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NEETHI_ASSERTION_BUILDER_H
+#define NEETHI_ASSERTION_BUILDER_H
+
+/** @defgroup neethi_assertion_builder
+ * @ingroup neethi_assertion_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <neethi_assertion.h>
+#include <rp_builders.h>
+#include <axis2_rm_assertion_builder.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ neethi_assertion_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/neethi_constants.h b/neethi/include/neethi_constants.h
new file mode 100644
index 0000000..6351f00
--- /dev/null
+++ b/neethi/include/neethi_constants.h
@@ -0,0 +1,87 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NEETHI_CONSTANTS_H
+#define NEETHI_CONSTANTS_H
+
+#define NEETHI_EXACTLYONE "ExactlyOne"
+#define NEETHI_ALL "All"
+#define NEETHI_POLICY "Policy"
+#define NEETHI_REFERENCE "PolicyReference"
+#define NEETHI_URI "URI"
+#define NEETHI_NAMESPACE "http://schemas.xmlsoap.org/ws/2004/09/policy"
+#define NEETHI_POLICY_15_NAMESPACE "http://www.w3.org/ns/ws-policy"
+#define NEETHI_PREFIX "wsp"
+#define NEETHI_WSU_NS "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+#define NEETHI_ID "Id"
+#define NEETHI_WSU_NS_PREFIX "wsu"
+#define NEETHI_NAME "Name"
+#define AXIS2_OPTIMIZED_MIME_SERIALIZATION "OptimizedMimeSerialization"
+#define AXIS2_MTOM_POLICY_NS "http://schemas.xmlsoap.org/ws/2004/09/policy/optimizedmimeserialization"
+#define AXIS2_RM_POLICY_10_NS "http://schemas.xmlsoap.org/ws/2005/02/rm/policy"
+#define AXIS2_RM_POLICY_11_NS "http://docs.oasis-open.org/ws-rx/wsrmp/200702"
+#define AXIS2_SANDESHA2_NS "http://ws.apache.org/sandesha2/c/policy"
+
+/* Reliable messaging related constatnts */
+
+/* RMPolicy 1.0 */
+
+#define AXIS2_RM_RMASSERTION "RMAssertion"
+#define AXIS2_RM_INACTIVITY_TIMEOUT "InactivityTimeout"
+#define AXIS2_RM_BASE_RETRANSMISSION_INTERVAL "BaseRetransmissionInterval"
+#define AXIS2_RM_EXPONENTIAL_BACK_OFF "ExponentialBackoff"
+#define AXIS2_RM_ACKNOWLEDGEMENT_INTERVAL "AcknowledgementInterval"
+
+/* RM policy 1.1 */
+
+#define AXIS2_RM_SEQUENCE_STR "SequenceSTR"
+#define AXIS2_RM_SEQUENCE_TRANSPORT_SECURITY "SequenceTransportSecurity"
+#define AXIS2_RM_DELIVERY_ASSURANCE "DeliveryAssurance"
+#define AXIS2_RM_EXACTLY_ONCE "ExactlyOnce"
+#define AXIS2_RM_AT_LEAST_ONCE "AtLeastOnce"
+#define AXIS2_RM_AT_MOST_ONCE "AtMostOnce"
+#define AXIS2_RM_IN_ORDER "InOrder"
+
+/* Sandesha2/C specific */
+
+#define AXIS2_RM_SANDESHA2_DB "sandesha2_db"
+#define AXIS2_RM_STORAGE_MANAGER "StorageManager"
+#define AXIS2_RM_MESSAGE_TYPES_TO_DROP "MessageTypesToDrop"
+#define AXIS2_RM_MAX_RETRANS_COUNT "MaxRetransCount"
+#define AXIS2_RM_SENDER_SLEEP_TIME "SenderSleepTime"
+#define AXIS2_RM_INVOKER_SLEEP_TIME "InvokerSleepTime"
+#define AXIS2_RM_POLLING_WAIT_TIME "PollingWaitTime"
+#define AXIS2_RM_TERMINATE_DELAY "TerminateDelay"
+
+
+/**
+* @file neethi_constants.h
+* @brief includes all the string constants
+*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*NEETHI_INCLUDES_H */
diff --git a/neethi/include/neethi_engine.h b/neethi/include/neethi_engine.h
new file mode 100644
index 0000000..4ea34e3
--- /dev/null
+++ b/neethi/include/neethi_engine.h
@@ -0,0 +1,144 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NEETHI_ENGINE_H
+#define NEETHI_ENGINE_H
+
+/*neethis_engine.c contains all the useful functions
+ * for dealing with a neethi_policy object
+ */
+
+
+
+/**
+ * @file neethi_engine.h
+ * @contains neethi_policy creation logic.
+ */
+
+#include <axis2_defines.h>
+#include <axutil_env.h>
+#include <neethi_includes.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_all.h>
+#include <neethi_exactlyone.h>
+#include <neethi_reference.h>
+#include <neethi_registry.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /**
+ * Given an axiom model this function will return
+ * a neethi_policy object.
+ * @param env pointer to environment struct
+ * @param node to an axiom_node
+ * @param node to an axiom_element
+ * @return pointer to a neethi_policy_t struct
+ */
+
+ AXIS2_EXTERN neethi_policy_t *AXIS2_CALL
+ neethi_engine_get_policy(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+ /**
+ * Given a neethi_policy object this will return the
+ * normalized policy object.
+ * @param env pointer to environment struct
+ * @param deep to specify whether assertion level normalization
+ needed.
+ * @param neethi_policy_t to the policy which is not
+ normalized.
+ * @return pointer to a normalized neethi_policy_t struct
+ */
+
+ /*This function will return a new neethi_policy struct.
+ So it is callers responsibility to free the neethi_policy
+ which is passed as an argument. */
+
+ AXIS2_EXTERN neethi_policy_t *AXIS2_CALL
+ neethi_engine_get_normalize(
+ const axutil_env_t * env,
+ axis2_bool_t deep,
+ neethi_policy_t * neethi_policy);
+
+ /**
+ * Given a neethi_policy object this will return the
+ * normalized policy object.
+ * @param env pointer to environment struct
+ * @param deep to specify whether assertion level normalization
+ needed.
+ * @param neethi_policy_t to the policy which is not
+ normalized.
+ * @param registry neethi_registry_t struct which contains
+ policy objects.
+ * @return pointer to a normalized neethi_policy_t struct
+ */
+
+ /*This function will return a new neethi_policy struct.
+ So it is callers responsibility to free the neethi_policy
+ which is passed as an argument. */
+
+
+ AXIS2_EXTERN neethi_policy_t *AXIS2_CALL
+ neethi_engine_normalize(
+ const axutil_env_t * env,
+ neethi_policy_t * neethi_policy,
+ neethi_registry_t * registry,
+ axis2_bool_t deep);
+
+ /*Givnen to normalized policy objects this function will
+ retun the merged policy object.
+ * @param env pointer to environment struct
+ * @param neethi_policy1 pointer neethi_policy_t struct as an
+ * input for merge.
+ * @param neethi_policy2 pointer neethi_policy_t struct as an
+ * input for merge.
+ * @return pointer to a merged policy of both inputs.*/
+
+ /*The input for this function should be two normalized policies
+ otherwise the output may be wrong.*/
+
+ AXIS2_EXTERN neethi_policy_t *AXIS2_CALL
+ neethi_engine_merge(
+ const axutil_env_t * env,
+ neethi_policy_t * neethi_policy1,
+ neethi_policy_t * neethi_policy2);
+
+ /*Given a policy object this function will give the
+ * corresponding axiom model for that policy object.
+ * @param policy pointer to the neethi_policy_t struct.
+ * @param env pointer to environment struct
+ */
+
+ AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+ neethi_engine_serialize(
+ neethi_policy_t * policy,
+ const axutil_env_t * env);
+
+ /** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NEETHI_ENGINE_H */
diff --git a/neethi/include/neethi_exactlyone.h b/neethi/include/neethi_exactlyone.h
new file mode 100644
index 0000000..fc3d065
--- /dev/null
+++ b/neethi/include/neethi_exactlyone.h
@@ -0,0 +1,81 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NEETHI_EXACTLYONE_H
+#define NEETHI_EXACTLYONE_H
+
+/**
+ * @file neethi_exactlyone.h
+ * @struct for operator exactlyone
+ */
+
+#include <axis2_defines.h>
+#include <axutil_env.h>
+#include <neethi_operator.h>
+#include <neethi_includes.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct neethi_exactlyone_t neethi_exactlyone_t;
+
+ AXIS2_EXTERN neethi_exactlyone_t *AXIS2_CALL
+ neethi_exactlyone_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ neethi_exactlyone_free(
+ neethi_exactlyone_t * neethi_exactlyone,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+ neethi_exactlyone_get_policy_components(
+ neethi_exactlyone_t * neethi_exactlyone,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_exactlyone_add_policy_components(
+ neethi_exactlyone_t * exactlyone,
+ axutil_array_list_t * arraylist,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_exactlyone_add_operator(
+ neethi_exactlyone_t * neethi_exactlyone,
+ const axutil_env_t * env,
+ neethi_operator_t * op);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ neethi_exactlyone_is_empty(
+ neethi_exactlyone_t * exactlyone,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_exactlyone_serialize(
+ neethi_exactlyone_t * neethi_exactlyone,
+ axiom_node_t * parent,
+ const axutil_env_t * env);
+
+ /** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NEETHI_EXACTLYONE_H */
diff --git a/neethi/include/neethi_includes.h b/neethi/include/neethi_includes.h
new file mode 100644
index 0000000..88550af
--- /dev/null
+++ b/neethi/include/neethi_includes.h
@@ -0,0 +1,55 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NEETHI_INCLUDES_H
+#define NEETHI_INCLUDES_H
+
+#include <axis2_util.h>
+#include <axutil_allocator.h>
+#include <axutil_string.h>
+#include <axutil_array_list.h>
+#include <axis2_const.h>
+#include <axutil_error.h>
+#include <axutil_utils_defines.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+#include <axutil_env.h>
+#include <axiom.h>
+#include <axiom_soap.h>
+#include <axutil_qname.h>
+#include <axutil_hash.h>
+#include <neethi_constants.h>
+#include <axutil_hash.h>
+#include <rp_defines.h>
+
+/**
+* @file neethi_includes.h
+* @brief includes most useful headers for policy
+*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*NEETHI_INCLUDES_H */
diff --git a/neethi/include/neethi_mtom_assertion_checker.h b/neethi/include/neethi_mtom_assertion_checker.h
new file mode 100644
index 0000000..2081f41
--- /dev/null
+++ b/neethi/include/neethi_mtom_assertion_checker.h
@@ -0,0 +1,43 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NEETHI_MTOM_ASSERTION_CHECKER_H
+#define NEETHI_MTOM_ASSERTION_CHECKER_H
+
+
+#include <axis2_defines.h>
+#include <axutil_env.h>
+#include <neethi_policy.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ neethi_is_mtom_required(
+ const axutil_env_t *env,
+ neethi_policy_t *policy);
+
+
+ /** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/neethi/include/neethi_operator.h b/neethi/include/neethi_operator.h
new file mode 100644
index 0000000..9b38f70
--- /dev/null
+++ b/neethi/include/neethi_operator.h
@@ -0,0 +1,95 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NEETHI_OPERATOR_H
+#define NEETHI_OPERATOR_H
+
+/**
+ * @file neethi_operator.h
+ * @common struct for policy operators.
+ */
+
+#include <axis2_defines.h>
+#include <axutil_env.h>
+#include <neethi_includes.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef enum
+ {
+ OPERATOR_TYPE_POLICY = 0,
+ OPERATOR_TYPE_ALL,
+ OPERATOR_TYPE_EXACTLYONE,
+ OPERATOR_TYPE_REFERENCE,
+ OPERATOR_TYPE_ASSERTION,
+ OPERATOR_TYPE_UNKNOWN
+ } neethi_operator_type_t;
+
+ typedef struct neethi_operator_t neethi_operator_t;
+
+ AXIS2_EXTERN neethi_operator_t *AXIS2_CALL
+ neethi_operator_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ neethi_operator_free(
+ neethi_operator_t * neethi_operator,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN neethi_operator_type_t AXIS2_CALL
+ neethi_operator_get_type(
+ neethi_operator_t * neethi_operator,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void *AXIS2_CALL
+ neethi_operator_get_value(
+ neethi_operator_t * neethi_operator,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_operator_set_value(
+ neethi_operator_t * neethi_operator,
+ const axutil_env_t * env,
+ void *value,
+ neethi_operator_type_t type);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_operator_serialize(
+ neethi_operator_t * neethi_operator,
+ const axutil_env_t * env,
+ axiom_node_t * parent);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_operator_set_value_null(
+ neethi_operator_t * neethi_operator,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_operator_increment_ref(
+ neethi_operator_t * neethi_operator,
+ const axutil_env_t * env);
+
+ /** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NEETHI_OPERATOR_H */
diff --git a/neethi/include/neethi_policy.h b/neethi/include/neethi_policy.h
new file mode 100644
index 0000000..bdc2b52
--- /dev/null
+++ b/neethi/include/neethi_policy.h
@@ -0,0 +1,126 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NEETHI_POLICY_H
+#define NEETHI_POLICY_H
+
+/**
+ * @file neethi_policy.h
+ * @struct for operator neethi_policy
+ */
+
+#include <axis2_defines.h>
+#include <axutil_env.h>
+#include <neethi_operator.h>
+#include <neethi_includes.h>
+#include <neethi_exactlyone.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct neethi_policy_t neethi_policy_t;
+
+ AXIS2_EXTERN neethi_policy_t *AXIS2_CALL
+ neethi_policy_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ neethi_policy_free(
+ neethi_policy_t * neethi_policy,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+ neethi_policy_get_policy_components(
+ neethi_policy_t * neethi_policy,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_policy_add_policy_components(
+ neethi_policy_t * neethi_policy,
+ axutil_array_list_t * arraylist,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_policy_add_operator(
+ neethi_policy_t * neethi_policy,
+ const axutil_env_t * env,
+ neethi_operator_t * op);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ neethi_policy_is_empty(
+ neethi_policy_t * neethi_policy,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN neethi_exactlyone_t *AXIS2_CALL
+ neethi_policy_get_exactlyone(
+ neethi_policy_t * normalized_neethi_policy,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+ neethi_policy_get_alternatives(
+ neethi_policy_t * neethi_policy,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ neethi_policy_get_name(
+ neethi_policy_t * neethi_policy,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_policy_set_name(
+ neethi_policy_t * neethi_policy,
+ const axutil_env_t * env,
+ axis2_char_t * name);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ neethi_policy_get_id(
+ neethi_policy_t * neethi_policy,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_policy_set_id(
+ neethi_policy_t * neethi_policy,
+ const axutil_env_t * env,
+ axis2_char_t * id);
+
+ AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+ neethi_policy_serialize(
+ neethi_policy_t * neethi_policy,
+ axiom_node_t * parent,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_policy_set_root_node(
+ neethi_policy_t * policy,
+ const axutil_env_t * env,
+ axiom_node_t * root_node);
+
+ AXIS2_EXTERN axutil_hash_t *AXIS2_CALL
+ neethi_policy_get_attributes(
+ neethi_policy_t *neethi_policy,
+ const axutil_env_t *env);
+
+
+ /** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NEETHI_POLICY_H */
diff --git a/neethi/include/neethi_reference.h b/neethi/include/neethi_reference.h
new file mode 100644
index 0000000..42b07c4
--- /dev/null
+++ b/neethi/include/neethi_reference.h
@@ -0,0 +1,69 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NEETHI_REFERENCE_H
+#define NEETHI_REFERENCE_H
+
+/**
+ * @file neethi_reference.h
+ * @struct for operator reference
+ */
+
+#include <axis2_defines.h>
+#include <axutil_env.h>
+#include <neethi_includes.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct neethi_reference_t neethi_reference_t;
+
+ AXIS2_EXTERN neethi_reference_t *AXIS2_CALL
+ neethi_reference_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ neethi_reference_free(
+ neethi_reference_t * neethi_reference,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ neethi_reference_get_uri(
+ neethi_reference_t * neethi_reference,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_reference_set_uri(
+ neethi_reference_t * neethi_reference,
+ const axutil_env_t * env,
+ axis2_char_t * uri);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_reference_serialize(
+ neethi_reference_t * neethi_reference,
+ axiom_node_t * parent,
+ const axutil_env_t * env);
+
+ /** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NEETHI_REFERENCE_H */
diff --git a/neethi/include/neethi_registry.h b/neethi/include/neethi_registry.h
new file mode 100644
index 0000000..fd6e1d1
--- /dev/null
+++ b/neethi/include/neethi_registry.h
@@ -0,0 +1,71 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NEETHI_REGISTRY_H
+#define NEETHI_REGISTRY_H
+
+/**
+ * @file neethi_registry.h
+ * @struct for operator registry
+ */
+
+#include <axis2_defines.h>
+#include <axutil_env.h>
+#include <neethi_includes.h>
+#include <neethi_policy.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct neethi_registry_t neethi_registry_t;
+
+ AXIS2_EXTERN neethi_registry_t *AXIS2_CALL
+ neethi_registry_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN neethi_registry_t *AXIS2_CALL
+ neethi_registry_create_with_parent(
+ const axutil_env_t * env,
+ neethi_registry_t * parent);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ neethi_registry_free(
+ neethi_registry_t * neethi_registry,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_registry_register(
+ neethi_registry_t * neethi_registry,
+ const axutil_env_t * env,
+ axis2_char_t * key,
+ neethi_policy_t * value);
+
+ AXIS2_EXTERN neethi_policy_t *AXIS2_CALL
+ neethi_registry_lookup(
+ neethi_registry_t * neethi_registry,
+ const axutil_env_t * env,
+ axis2_char_t * key);
+
+ /** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NEETHI_REGISTRY_H */
diff --git a/neethi/include/neethi_util.h b/neethi/include/neethi_util.h
new file mode 100644
index 0000000..6cdf620
--- /dev/null
+++ b/neethi/include/neethi_util.h
@@ -0,0 +1,53 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef NEETHI_UTIL_H
+#define NEETHI_UTIL_H
+
+/**
+ * @file neethi_util.h
+ * @policy creation utilities
+ */
+
+#include <axis2_defines.h>
+#include <axutil_env.h>
+#include <neethi_includes.h>
+#include <neethi_policy.h>
+#include <neethi_engine.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_policy_t *AXIS2_CALL
+ neethi_util_create_policy_from_file(
+ const axutil_env_t * env,
+ axis2_char_t * file_name);
+
+ AXIS2_EXTERN neethi_policy_t *AXIS2_CALL
+ neethi_util_create_policy_from_om(
+ const axutil_env_t * env,
+ axiom_node_t * root_node);
+
+ /** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NEETHI_UTIL_H */
diff --git a/neethi/include/rp_algorithmsuite.h b/neethi/include/rp_algorithmsuite.h
new file mode 100644
index 0000000..682abf4
--- /dev/null
+++ b/neethi/include/rp_algorithmsuite.h
@@ -0,0 +1,218 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_ALGORITHMSUITE_H
+#define RP_ALGORITHMSUITE_H
+
+/** @defgroup rp_algoruthmsuite
+ * @ingroup rp_algorithmsuite
+ * @{
+ */
+
+#include <rp_includes.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_algorithmsuite_t rp_algorithmsuite_t;
+
+ AXIS2_EXTERN rp_algorithmsuite_t *AXIS2_CALL
+ rp_algorithmsuite_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_algorithmsuite_free(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_algorithmsuite_get_algosuite_string(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_algorithmsuite_set_algosuite(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env,
+ axis2_char_t * algosuite_string);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_algorithmsuite_get_symmetric_signature(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_algorithmsuite_set_symmetric_signature(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env,
+ axis2_char_t * symmetric_signature);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_algorithmsuite_get_asymmetric_signature(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_algorithmsuite_set_asymmetric_signature(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env,
+ axis2_char_t * asymmetric_signature);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_algorithmsuite_get_computed_key(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_algorithmsuite_set_computed_key(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env,
+ axis2_char_t * computed_key);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_algorithmsuite_get_digest(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_algorithmsuite_get_encryption(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN int AXIS2_CALL
+ rp_algorithmsuite_get_max_symmetric_keylength(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_algorithmsuite_set_max_symmetric_keylength(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env,
+ int max_symmetric_keylength);
+
+ AXIS2_EXTERN int AXIS2_CALL
+ rp_algorithmsuite_get_min_symmetric_keylength(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN int AXIS2_CALL
+ rp_algorithmsuite_get_max_asymmetric_keylength(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_algorithmsuite_set_max_asymmetric_keylength(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env,
+ int max_asymmetric_keylength);
+
+ AXIS2_EXTERN int AXIS2_CALL
+ rp_algorithmsuite_get_min_asymmetric_keylength(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_algorithmsuite_set_min_asymmetric_keylength(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env,
+ int min_asymmetric_keylength);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_algorithmsuite_get_symmetrickeywrap(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_algorithmsuite_get_asymmetrickeywrap(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_algorithmsuite_get_signature_key_derivation(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_algorithmsuite_get_encryption_key_derivation(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_algorithmsuite_get_soap_normalization(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_algorithmsuite_set_soap_normalization(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env,
+ axis2_char_t * soap_normalization);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_algorithmsuite_get_str_transformation(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_algorithmsuite_set_str_transformation(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env,
+ axis2_char_t * str_transformation);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_algorithmsuite_get_c14n(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_algorithmsuite_set_c14n(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env,
+ axis2_char_t * c14n);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_algorithmsuite_get_xpath(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_algorithmsuite_set_xpath(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env,
+ axis2_char_t * xpath);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_algorithmsuite_increment_ref(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN int AXIS2_CALL
+ rp_algorithmsuite_get_encryption_derivation_keylength(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN int AXIS2_CALL
+ rp_algorithmsuite_get_signature_derivation_keylength(
+ rp_algorithmsuite_t * algorithmsuite,
+ const axutil_env_t * env);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_algorithmsuite_builder.h b/neethi/include/rp_algorithmsuite_builder.h
new file mode 100644
index 0000000..72140b1
--- /dev/null
+++ b/neethi/include/rp_algorithmsuite_builder.h
@@ -0,0 +1,45 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_ALGORITHMSUITE_BUILDER_H
+#define RP_ALGORITHMSUITE_BUILDER_H
+
+/** @defgroup rp_algorithmsuite_builder
+ * @ingroup rp_algorithmsuite_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_algorithmsuite.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ rp_algorithmsuite_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_asymmetric_binding.h b/neethi/include/rp_asymmetric_binding.h
new file mode 100644
index 0000000..d41706d
--- /dev/null
+++ b/neethi/include/rp_asymmetric_binding.h
@@ -0,0 +1,88 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_ASYMMETRIC_BINDING_H
+#define RP_ASYMMETRIC_BINDING_H
+
+/** @defgroup rp_asymmetric_binding
+ * @ingroup rp_asymmetric_binding
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_symmetric_asymmetric_binding_commons.h>
+#include <rp_property.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_asymmetric_binding_t rp_asymmetric_binding_t;
+
+ AXIS2_EXTERN rp_asymmetric_binding_t *AXIS2_CALL
+ rp_asymmetric_binding_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_asymmetric_binding_free(
+ rp_asymmetric_binding_t * asymmetric_binding,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN rp_symmetric_asymmetric_binding_commons_t *AXIS2_CALL
+ rp_asymmetric_binding_get_symmetric_asymmetric_binding_commons(
+ rp_asymmetric_binding_t * asymmetric_binding,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_asymmetric_binding_set_symmetric_asymmetric_binding_commons(
+ rp_asymmetric_binding_t * asymmetric_binding,
+ const axutil_env_t * env,
+ rp_symmetric_asymmetric_binding_commons_t *
+ symmetric_asymmetric_binding_commons);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_asymmetric_binding_set_initiator_token(
+ rp_asymmetric_binding_t * asymmetric_binding,
+ const axutil_env_t * env,
+ rp_property_t * initiator_token);
+
+ AXIS2_EXTERN rp_property_t *AXIS2_CALL
+ rp_asymmetric_binding_get_initiator_token(
+ rp_asymmetric_binding_t * asymmetric_binding,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_asymmetric_binding_set_recipient_token(
+ rp_asymmetric_binding_t * asymmetric_binding,
+ const axutil_env_t * env,
+ rp_property_t * recipient_token);
+
+ AXIS2_EXTERN rp_property_t *AXIS2_CALL
+ rp_asymmetric_binding_get_recipient_token(
+ rp_asymmetric_binding_t * asymmetric_binding,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_asymmetric_binding_increment_ref(
+ rp_asymmetric_binding_t * asymmetric_binding,
+ const axutil_env_t * env);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_asymmetric_binding_builder.h b/neethi/include/rp_asymmetric_binding_builder.h
new file mode 100644
index 0000000..ec70175
--- /dev/null
+++ b/neethi/include/rp_asymmetric_binding_builder.h
@@ -0,0 +1,46 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_ASYMMETRIC_BINDING_BUILDER_H
+#define RP_ASYMMETRIC_BINDING_BUILDER_H
+
+/** @defgroup rp_asymmetric_binding_builder
+ * @ingroup rp_asymmetric_binding_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_asymmetric_binding.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+
+ rp_asymmetric_binding_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_binding_commons.h b/neethi/include/rp_binding_commons.h
new file mode 100644
index 0000000..4d7da8a
--- /dev/null
+++ b/neethi/include/rp_binding_commons.h
@@ -0,0 +1,126 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_BINDING_COMMONS_H
+#define RP_BINDING_COMMONS_H
+
+/** @defgroup rp_binding_commons
+ * @ingroup rp_binding_commons
+ * @{
+ */
+#include <rp_includes.h>
+#include <rp_algorithmsuite.h>
+#include <rp_layout.h>
+#include <rp_supporting_tokens.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_binding_commons_t rp_binding_commons_t;
+
+ AXIS2_EXTERN rp_binding_commons_t *AXIS2_CALL
+ rp_binding_commons_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_binding_commons_free(
+ rp_binding_commons_t * binding_commons,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN rp_algorithmsuite_t *AXIS2_CALL
+ rp_binding_commons_get_algorithmsuite(
+ rp_binding_commons_t * binding_commons,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_binding_commons_set_algorithmsuite(
+ rp_binding_commons_t * binding_commons,
+ const axutil_env_t * env,
+ rp_algorithmsuite_t * algorithmsuite);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_binding_commons_get_include_timestamp(
+ rp_binding_commons_t * binding_commons,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_binding_commons_set_include_timestamp(
+ rp_binding_commons_t * binding_commons,
+ const axutil_env_t * env,
+ axis2_bool_t include_timestamp);
+
+ AXIS2_EXTERN rp_layout_t *AXIS2_CALL
+ rp_binding_commons_get_layout(
+ rp_binding_commons_t * binding_commons,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_binding_commons_set_layout(
+ rp_binding_commons_t * binding_commons,
+ const axutil_env_t * env,
+ rp_layout_t * layout);
+
+ AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+ rp_binding_commons_get_signed_supporting_tokens(
+ rp_binding_commons_t * binding_commons,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_binding_commons_set_signed_supporting_tokens(
+ rp_binding_commons_t * binding_commons,
+ const axutil_env_t * env,
+ rp_supporting_tokens_t * signed_supporting_tokens);
+
+ AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+ rp_binding_commons_get_signed_endorsing_supporting_tokens(
+ rp_binding_commons_t * binding_commons,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_binding_commons_set_signed_endorsing_supporting_tokens(
+ rp_binding_commons_t * binding_commons,
+ const axutil_env_t * env,
+ rp_supporting_tokens_t * signed_endorsing_supporting_tokens);
+
+ AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+ rp_binding_commons_get_endorsing_supporting_tokens(
+ rp_binding_commons_t * binding_commons,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_binding_commons_set_endorsing_supporting_tokens(
+ rp_binding_commons_t * binding_commons,
+ const axutil_env_t * env,
+ rp_supporting_tokens_t * endorsing_supporting_tokens);
+
+ AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+ rp_binding_commons_get_supporting_tokens(
+ rp_binding_commons_t * binding_commons,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_binding_commons_set_supporting_tokens(
+ rp_binding_commons_t * binding_commons,
+ const axutil_env_t * env,
+ rp_supporting_tokens_t * supporting_tokens);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_bootstrap_policy_builder.h b/neethi/include/rp_bootstrap_policy_builder.h
new file mode 100644
index 0000000..20b3a0b
--- /dev/null
+++ b/neethi/include/rp_bootstrap_policy_builder.h
@@ -0,0 +1,44 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_BOOTSTRAP_POLICY_BUILDER_H
+#define RP_BOOTSTRAP_POLICY_BUILDER_H
+
+/** @defgroup rp_bootstrap_policy_builder
+ * @ingroup rp_bootstrap_policy_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ rp_bootstrap_policy_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_builders.h b/neethi/include/rp_builders.h
new file mode 100644
index 0000000..1903611
--- /dev/null
+++ b/neethi/include/rp_builders.h
@@ -0,0 +1,64 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_BUILDERS_H
+#define RP_BUILDERS_H
+
+#include <rp_algorithmsuite_builder.h>
+#include <rp_defines.h>
+#include <rp_layout_builder.h>
+#include <rp_supporting_tokens_builder.h>
+#include <rp_token_identifier.h>
+#include <rp_transport_binding_builder.h>
+#include <rp_transport_token_builder.h>
+#include <rp_username_token_builder.h>
+#include <rp_wss10_builder.h>
+#include <rp_wss11_builder.h>
+#include <rp_trust10_builder.h>
+#include <rp_https_token_builder.h>
+#include <rp_x509_token_builder.h>
+#include <rp_issued_token_builder.h>
+#include <rp_saml_token_builder.h>
+#include <rp_security_context_token_builder.h>
+#include <rp_bootstrap_policy_builder.h>
+#include <rp_recipient_token_builder.h>
+#include <rp_initiator_token_builder.h>
+#include <rp_asymmetric_binding_builder.h>
+#include <rp_signed_encrypted_parts_builder.h>
+#include <rp_rampart_config_builder.h>
+#include <rp_symmetric_binding_builder.h>
+#include <rp_protection_token_builder.h>
+#include <rp_encryption_token_builder.h>
+#include <rp_signature_token_builder.h>
+
+/**
+* @file rp_builders.h
+* @all the secpolicy builders
+*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*RP_BUILDERS_H */
diff --git a/neethi/include/rp_defines.h b/neethi/include/rp_defines.h
new file mode 100644
index 0000000..33e218e
--- /dev/null
+++ b/neethi/include/rp_defines.h
@@ -0,0 +1,232 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_DEFINES_H
+#define RP_DEFINES_H
+
+/** @defgroup rp_defines
+ * @ingroup rp_defines
+ * @{
+ */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#define RP_POLICY "Policy"
+#define RP_EXACTLY_ONE "ExactlyOne"
+#define RP_ALL "All"
+
+#define RP_SYMMETRIC_BINDING "SymmetricBinding"
+#define RP_ASYMMETRIC_BINDING "AsymmetricBinding"
+#define RP_TRANSPORT_BINDING "TransportBinding"
+
+#define RP_SIGNED_SUPPORTING_TOKENS "SignedSupportingTokens"
+#define RP_SIGNED_ENDORSING_SUPPORTING_TOKENS "SignedEndorsingSupportingTokens"
+#define RP_SUPPORTING_TOKENS "SupportingTokens"
+#define RP_ENDORSING_SUPPORTING_TOKENS "EndorsingSupportingTokens"
+
+#define RP_SIGNED_PARTS "SignedParts"
+#define RP_SIGNED_ELEMENTS "SignedElements"
+#define RP_ENCRYPTED_PARTS "EncryptedParts"
+#define RP_ENCRYPTED_ELEMENTS "EncryptedElements"
+#define RP_SIGNED_ITEMS "SignedItems"
+#define RP_ENCRYPTED_ITEMS "EncryptedItems"
+
+#define RP_BODY "Body"
+#define RP_HEADER "Header"
+#define RP_NAME "Name"
+#define RP_NAMESPACE "Namespace"
+#define RP_ELEMENT "Element"
+#define RP_ATTACHMENTS "Attachments"
+
+#define RP_XPATH "XPath"
+#define RP_XPATH_VERSION "XPathVersion"
+
+#define RP_WSS10 "Wss10"
+#define RP_WSS11 "Wss11"
+#define RP_TRUST10 "Trust10"
+#define RP_TRUST13 "Trust13"
+
+#define RP_MUST_SUPPORT_REF_KEY_IDENTIFIER "MustSupportRefKeyIdentifier"
+#define RP_MUST_SUPPORT_REF_ISSUER_SERIAL "MustSupportRefIssuerSerial"
+#define RP_MUST_SUPPORT_REF_EXTERNAL_URI "MustSupportRefExternalURI"
+#define RP_MUST_SUPPORT_REF_EMBEDDED_TOKEN "MustSupportRefEmbeddedToken"
+#define RP_MUST_SUPPORT_REF_THUMBPRINT "MustSupportRefThumbprint"
+#define RP_MUST_SUPPORT_REF_ENCRYPTED_KEY "MustSupportRefEncryptedKey"
+#define RP_REQUIRE_SIGNATURE_CONFIRMATION "RequireSignatureConfirmation"
+#define RP_MUST_SUPPORT_CLIENT_CHALLENGE "MustSupportClientChallenge"
+#define RP_MUST_SUPPORT_SERVER_CHALLENGE "MustSupportServerChallenge"
+#define RP_REQUIRE_CLIENT_ENTROPY "RequireClientEntropy"
+#define RP_REQUIRE_SERVER_ENTROPHY "RequireServerEntropy"
+#define RP_MUST_SUPPORT_ISSUED_TOKENS "MustSupportIssuedTokens"
+
+#define RP_PROTECTION_TOKEN "ProtectionToken"
+#define RP_ENCRYPTION_TOKEN "EncryptionToken"
+#define RP_SIGNATURE_TOKEN "SignatureToken"
+#define RP_INITIATOR_TOKEN "InitiatorToken"
+#define RP_RECIPIENT_TOKEN "RecipientToken"
+#define RP_TRANSPORT_TOKEN "TransportToken"
+
+#define RP_ALGORITHM_SUITE "AlgorithmSuite"
+#define RP_LAYOUT "Layout"
+#define RP_INCLUDE_TIMESTAMP "IncludeTimestamp"
+#define RP_ENCRYPT_BEFORE_SIGNING "EncryptBeforeSigning"
+#define RP_SIGN_BEFORE_ENCRYPTING "SignBeforeEncrypting"
+#define RP_ENCRYPT_SIGNATURE "EncryptSignature"
+#define RP_PROTECT_TOKENS "ProtectTokens"
+#define RP_ONLY_SIGN_ENTIRE_HEADERS_AND_BODY "OnlySignEntireHeadersAndBody"
+
+#define RP_ALGO_SUITE_BASIC256 "Basic256"
+#define RP_ALGO_SUITE_BASIC192 "Basic192"
+#define RP_ALGO_SUITE_BASIC128 "Basic128"
+#define RP_ALGO_SUITE_TRIPLE_DES "TripleDes"
+#define RP_ALGO_SUITE_BASIC256_RSA15 "Basic256Rsa15"
+#define RP_ALGO_SUITE_BASIC192_RSA15 "Basic192Rsa15"
+#define RP_ALGO_SUITE_BASIC128_RSA15 "Basic128Rsa15"
+#define RP_ALGO_SUITE_TRIPLE_DES_RSA15 "TripleDesRsa15"
+#define RP_ALGO_SUITE_BASIC256_SHA256 "Basic256Sha256"
+#define RP_ALGO_SUITE_BASIC192_SHA256 "Basic192Sha256"
+#define RP_ALGO_SUITE_BASIC128_SHA256 "Basic128Sha256"
+#define RP_ALGO_SUITE_TRIPLE_DES_SHA256 "TripleDesSha256"
+#define RP_ALGO_SUITE_BASIC256_SHA256_RSA15 "Basic256Sha256Rsa15"
+#define RP_ALGO_SUITE_BASIC192_SHA256_RSA15 "Basic192Sha256Rsa15"
+#define RP_ALGO_SUITE_BASIC128_SHA256_RSA15 "Basic128Sha256Rsa15"
+#define RP_ALGO_SUITE_TRIPLE_DES_SHA256_RSA15 "TripleDesSha256Rsa15"
+
+#define RP_HMAC_SHA1 "http://www.w3.org/2000/09/xmldsig#hmac-sha1"
+#define RP_RSA_SHA1 "http://www.w3.org/2000/09/xmldsig#rsa-sha1"
+#define RP_SHA1 "http://www.w3.org/2000/09/xmldsig#sha1"
+#define RP_SHA256 "http://www.w3.org/2001/04/xmlenc#sha256"
+#define RP_SHA512 "http://www.w3.org/2001/04/xmlenc#sha512"
+#define RP_AES128 "http://www.w3.org/2001/04/xmlenc#aes128-cbc"
+#define RP_AES192 "http://www.w3.org/2001/04/xmlenc#aes192-cbc"
+#define RP_AES256 "http://www.w3.org/2001/04/xmlenc#aes256-cbc"
+#define RP_TRIPLE_DES "http://www.w3.org/2001/04/xmlenc#tripledes-cbc"
+#define RP_KW_AES128 "http://www.w3.org/2001/04/xmlenc#kw-aes256"
+#define RP_KW_AES192 "http://www.w3.org/2001/04/xmlenc#kw-aes192"
+#define RP_KW_AES256 "http://www.w3.org/2001/04/xmlenc#kw-aes128"
+#define RP_KW_TRIPLE_DES "http://www.w3.org/2001/04/xmlenc#kw-tripledes"
+#define RP_KW_RSA_OAEP "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"
+#define RP_KW_RSA15 "http://www.w3.org/2001/04/xmlenc#rsa-1_5"
+#define RP_P_SHA1 "http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1"
+#define RP_P_SHA1_L128 "http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1"
+#define RP_P_SHA1_L192 "http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1"
+#define RP_P_SHA1_L256 "http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1"
+#define RP_X_PATH "http://www.w3.org/TR/1999/REC-xpath-19991116"
+#define RP_XPATH20 "http://www.w3.org/2002/06/xmldsig-filter2"
+#define RP_C14N "http://www.w3.org/2001/10/xml-c14n#"
+#define RP_EX_C14N "http://www.w3.org/2001/10/xml-exc-c14n#"
+#define RP_SNT "http://www.w3.org/TR/soap12-n11n"
+#define RP_STRT10 "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#STR-Transform"
+#define RP_INCLUSIVE_C14N "InclusiveC14N"
+#define RP_SOAP_NORMALIZATION_10 "SoapNormalization10"
+#define RP_STR_TRANSFORM_10 "STRTransform10"
+#define RP_XPATH10 "XPath10"
+#define RP_XPATH_FILTER20 "XPathFilter20"
+
+#define RP_LAYOUT_STRICT "Strict"
+#define RP_LAYOUT_LAX "Lax"
+#define RP_LAYOUT_LAX_TIMESTAMP_FIRST "LaxTimestampFirst"
+#define RP_LAYOUT_LAX_TIMESTAMP_LAST "LaxTimestampLast"
+
+#define RP_USERNAME_TOKEN "UsernameToken"
+#define RP_X509_TOKEN "X509Token"
+#define RP_SAML_TOKEN "SamlToken"
+#define RP_ISSUED_TOKEN "IssuedToken"
+#define RP_SECURITY_CONTEXT_TOKEN "SecurityContextToken"
+#define RP_SECURE_CONVERSATION_TOKEN "SecureConversationToken"
+#define RP_HTTPS_TOKEN "HttpsToken"
+
+#define RP_INCLUDE_TOKEN "IncludeToken"
+#define RP_INCLUDE_ALWAYS "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Always"
+#define RP_INCLUDE_NEVER "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never"
+#define RP_INCLUDE_ONCE "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Once"
+#define RP_INCLUDE_ALWAYS_TO_RECIPIENT "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient"
+#define RP_INCLUDE_NEVER_SP12 "http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never"
+#define RP_INCLUDE_ONCE_SP12 "http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Once"
+#define RP_INCLUDE_ALWAYS_TO_RECIPIENT_SP12 "http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"
+#define RP_INCLUDE_ALWAYS_TO_INITIATOR_SP12 "http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToInitiator"
+#define RP_INCLUDE_ALWAYS_SP12 "http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Always"
+
+#define RP_REQUEST_SEC_TOKEN_TEMPLATE "RequestSecurityTokenTemplate"
+
+#define RP_REQUIRE_KEY_IDENTIFIRE_REFERENCE "RequireKeyIdentifierReference"
+#define RP_REQUIRE_ISSUER_SERIAL_REFERENCE "RequireIssuerSerialReference"
+#define RP_REQUIRE_EMBEDDED_TOKEN_REFERENCE "RequireEmbeddedTokenReference"
+#define RP_REQUIRE_THUMBPRINT_REFERENCE "RequireThumbprintReference"
+#define RP_REQUIRE_DERIVED_KEYS "RequireDerivedKeys"
+#define RP_REQUIRE_EXTERNAL_REFERENCE "RequireExternalReference"
+#define RP_REQUIRE_INTERNAL_REFERENCE "RequireInternalReference"
+#define RP_WSS_X509_V1_TOKEN_10 "WssX509V1Token10"
+#define RP_WSS_X509_V3_TOKEN_10 "WssX509V3Token10"
+#define RP_WSS_X509_PKCS7_TOKEN_10 "WssX509Pkcs7Token10"
+#define RP_WSS_X509_PKI_PATH_V1_TOKEN_10 "WssX509PkiPathV1Token10"
+#define RP_WSS_X509_V1_TOKEN_11 "WssX509V1Token11"
+#define RP_WSS_X509_V3_TOKEN_11 "WssX509V3Token11"
+#define RP_WSS_X509_PKCS7_TOKEN_11 "WssX509Pkcs7Token11"
+#define RP_WSS_X509_PKI_PATH_V1_TOKEN_11 "WssX509PkiPathV1Token11"
+
+#define RP_WSS_USERNAME_TOKEN_10 "WssUsernameToken10"
+#define RP_WSS_USERNAME_TOKEN_11 "WssUsernameToken11"
+
+#define RP_WSS_SAML_V10_TOKEN_V10 "WssSamlV10Token10"
+#define RP_WSS_SAML_V11_TOKEN_V10 "WssSamlV11Token10"
+#define RP_WSS_SAML_V10_TOKEN_V11 "WssSamlV10Token11"
+#define RP_WSS_SAML_V11_TOKEN_V11 "WssSamlV11Token11"
+#define RP_WSS_SAML_V20_TOKEN_V11 "WssSamlV20Token11"
+
+#define RP_REQUIRE_EXTERNAL_URI_REFERENCE "RequireExternalUriReference"
+#define RP_SC10_SECURITY_CONTEXT_TOKEN "SC10SecurityContextToken"
+#define RP_SC13_SECURITY_CONTEXT_TOKEN "SC13SecurityContextToken"
+#define RP_BOOTSTRAP_POLICY "BootstrapPolicy"
+#define RP_ISSUER "Issuer"
+
+#define RP_REQUIRE_CLIENT_CERTIFICATE "RequireClientCertificate"
+
+#define RP_RAMPART_CONFIG "RampartConfig"
+#define RP_USER "User"
+#define RP_ENCRYPTION_USER "EncryptionUser"
+#define RP_PASSWORD_CALLBACK_CLASS "PasswordCallbackClass"
+#define RP_AUTHN_MODULE_NAME "AuthnModuleName"
+#define RP_PASSWORD_TYPE "PasswordType"
+#define RP_PLAINTEXT "plainText"
+#define RP_DIGEST "Digest"
+#define RP_RECEIVER_CERTIFICATE "ReceiverCertificate"
+#define RP_CERTIFICATE "Certificate"
+#define RP_PRIVATE_KEY "PrivateKey"
+#define RP_PKCS12_KEY_STORE "PKCS12KeyStore"
+#define RP_TIME_TO_LIVE "TimeToLive"
+#define RP_CLOCK_SKEW_BUFFER "ClockSkewBuffer"
+#define RP_NEED_MILLISECOND_PRECISION "PrecisionInMilliseconds"
+#define RP_RD "ReplayDetection"
+#define RP_RD_MODULE "ReplayDetectionModule"
+#define RP_SCT_MODULE "SecurityContextTokenProvider"
+
+#define RP_SP_NS_11 "http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"
+#define RP_SP_NS_12 "http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"
+#define RP_SECURITY_NS "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
+#define RP_POLICY_NS "http://schemas.xmlsoap.org/ws/2004/09/policy"
+#define RP_RAMPART_NS "http://ws.apache.org/rampart/c/policy"
+#define RP_POLICY_PREFIX "wsp"
+#define RP_RAMPART_PREFIX "rampc"
+#define RP_SP_PREFIX "sp"
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_element.h b/neethi/include/rp_element.h
new file mode 100644
index 0000000..312f647
--- /dev/null
+++ b/neethi/include/rp_element.h
@@ -0,0 +1,69 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_ELEMENT_H
+#define RP_ELEMENT_H
+
+/** @defgroup rp_element
+ * @ingroup rp_element
+ * @{
+ */
+
+#include <rp_includes.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_element_t rp_element_t;
+
+ AXIS2_EXTERN rp_element_t *AXIS2_CALL
+ rp_element_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_element_free(
+ rp_element_t * element,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_element_get_name(
+ rp_element_t * element,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_element_set_name(
+ rp_element_t * element,
+ const axutil_env_t * env,
+ axis2_char_t * name);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_element_get_namespace(
+ rp_element_t * element,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_element_set_namespace(
+ rp_element_t * element,
+ const axutil_env_t * env,
+ axis2_char_t * nspace);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_encryption_token_builder.h b/neethi/include/rp_encryption_token_builder.h
new file mode 100644
index 0000000..56a5fad
--- /dev/null
+++ b/neethi/include/rp_encryption_token_builder.h
@@ -0,0 +1,48 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_ENCRYPTION_TOKEN_BUILDER_H
+#define RP_ENCRYPTION_TOKEN_BUILDER_H
+
+/** @defgroup rp_encryption_token_builder
+ * @ingroup rp_encryption_token_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_x509_token.h>
+#include <rp_security_context_token.h>
+#include <neethi_assertion.h>
+#include <rp_issued_token.h>
+#include <rp_saml_token.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ rp_encryption_token_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_header.h b/neethi/include/rp_header.h
new file mode 100644
index 0000000..b4d74f7
--- /dev/null
+++ b/neethi/include/rp_header.h
@@ -0,0 +1,69 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_HEADER_H
+#define RP_HEADER_H
+
+/** @defgroup rp_header
+ * @ingroup rp_header
+ * @{
+ */
+
+#include <rp_includes.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_header_t rp_header_t;
+
+ AXIS2_EXTERN rp_header_t *AXIS2_CALL
+ rp_header_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_header_free(
+ rp_header_t * header,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_header_get_name(
+ rp_header_t * header,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_header_set_name(
+ rp_header_t * header,
+ const axutil_env_t * env,
+ axis2_char_t * name);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_header_get_namespace(
+ rp_header_t * header,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_header_set_namespace(
+ rp_header_t * header,
+ const axutil_env_t * env,
+ axis2_char_t * nspace);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_https_token.h b/neethi/include/rp_https_token.h
new file mode 100644
index 0000000..d50effa
--- /dev/null
+++ b/neethi/include/rp_https_token.h
@@ -0,0 +1,85 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_HTTPS_TOKEN_H
+#define RP_HTTPS_TOKEN_H
+
+/** @defgroup rp_https_token
+ * @ingroup rp_https_token
+ * @{
+ */
+
+#include <rp_includes.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_https_token_t rp_https_token_t;
+
+ AXIS2_EXTERN rp_https_token_t *AXIS2_CALL
+ rp_https_token_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_https_token_free(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_https_token_get_inclusion(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_https_token_set_inclusion(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env,
+ axis2_char_t * inclusion);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_https_token_get_derivedkeys(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_https_token_set_derivedkeys(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env,
+ axis2_bool_t derivedkeys);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_https_token_get_require_client_certificate(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_https_token_set_require_client_certificate(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env,
+ axis2_bool_t require_client_certificate);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_https_token_increment_ref(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_https_token_builder.h b/neethi/include/rp_https_token_builder.h
new file mode 100644
index 0000000..4331ecb
--- /dev/null
+++ b/neethi/include/rp_https_token_builder.h
@@ -0,0 +1,45 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_HTTPS_TOKEN_BUILDER_H
+#define RP_HTTPS_TOKEN_BUILDER_H
+
+/** @defgroup rp_https_token_builder
+ * @ingroup rp_https_token_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_https_token.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ rp_https_token_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_includes.h b/neethi/include/rp_includes.h
new file mode 100644
index 0000000..c479889
--- /dev/null
+++ b/neethi/include/rp_includes.h
@@ -0,0 +1,52 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_INCLUDES_H
+#define RP_INCLUDES_H
+
+#include <axis2_util.h>
+#include <axutil_allocator.h>
+#include <axutil_string.h>
+#include <axutil_array_list.h>
+#include <axis2_const.h>
+#include <axutil_error.h>
+#include <axutil_utils_defines.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+#include <axutil_env.h>
+#include <axiom.h>
+#include <axiom_soap.h>
+#include <axutil_qname.h>
+#include <rp_defines.h>
+
+/**
+* @file rp_includes.h
+* @brief includes most useful headers for RP
+*/
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*RP_INCLUDES_H */
diff --git a/neethi/include/rp_initiator_token_builder.h b/neethi/include/rp_initiator_token_builder.h
new file mode 100644
index 0000000..fbfa17f
--- /dev/null
+++ b/neethi/include/rp_initiator_token_builder.h
@@ -0,0 +1,45 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_INITIATOR_TOKEN_BUILDER_H
+#define RP_INITIATOR_TOKEN_BUILDER_H
+
+/** @defgroup rp_initiator_token_builder
+ * @ingroup rp_initiator_token_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_x509_token.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ rp_initiator_token_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_issued_token.h b/neethi/include/rp_issued_token.h
new file mode 100644
index 0000000..dbe05a0
--- /dev/null
+++ b/neethi/include/rp_issued_token.h
@@ -0,0 +1,124 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_ISSUED_TOKEN_H
+#define RP_ISSUED_TOKEN_H
+
+/** @defgroup trust10
+ * @ingroup trust10
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <axutil_utils.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_issued_token rp_issued_token_t;
+
+ AXIS2_EXTERN rp_issued_token_t * AXIS2_CALL
+ rp_issued_token_create(
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_issued_token_free(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+ rp_issued_token_get_inclusion(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_issued_token_set_inclusion(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env,
+ axis2_char_t *inclusion);
+
+ AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+ rp_issued_token_get_issuer_epr(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_issued_token_set_issuer_epr(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env,
+ axiom_node_t *issuer_epr);
+
+ AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+ rp_issued_token_get_requested_sec_token_template(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_issued_token_set_requested_sec_token_template(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env,
+ axiom_node_t *req_sec_token_template);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_issued_token_get_derivedkeys(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_issued_token_set_derivedkeys(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env,
+ axis2_bool_t derivedkeys);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_issued_token_get_require_external_reference(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_issued_token_set_require_exernal_reference(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env,
+ axis2_bool_t require_external_reference);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_issued_token_get_require_internal_reference(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_issued_token_set_require_internal_reference(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env,
+ axis2_bool_t require_internal_reference);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_issued_token_increment_ref(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_issued_token_builder.h b/neethi/include/rp_issued_token_builder.h
new file mode 100644
index 0000000..6ab3862
--- /dev/null
+++ b/neethi/include/rp_issued_token_builder.h
@@ -0,0 +1,50 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_ISSUED_TOKEN_BUILDER_H
+#define RP_ISSUED_TOKEN_BUILDER_H
+
+/** @defgroup trust10
+ * @ingroup trust10
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_issued_token.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t * AXIS2_CALL
+ rp_issued_token_builder_build(const axutil_env_t *env,
+ axiom_node_t *node, axiom_element_t *element);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL rp_issued_token_builder_process_alternatives(
+ const axutil_env_t *env, neethi_all_t *all,
+ rp_issued_token_t *issued_token);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_layout.h b/neethi/include/rp_layout.h
new file mode 100644
index 0000000..7aa1d07
--- /dev/null
+++ b/neethi/include/rp_layout.h
@@ -0,0 +1,63 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_LAYOUT_H
+#define RP_LAYOUT_H
+
+/** @defgroup rp_layout
+ * @ingroup rp_layout
+ * @{
+ */
+
+#include <rp_includes.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_layout_t rp_layout_t;
+
+ AXIS2_EXTERN rp_layout_t *AXIS2_CALL
+ rp_layout_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_layout_free(
+ rp_layout_t * layout,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_layout_get_value(
+ rp_layout_t * layout,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_layout_set_value(
+ rp_layout_t * layout,
+ const axutil_env_t * env,
+ axis2_char_t * value);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_layout_increment_ref(
+ rp_layout_t * layout,
+ const axutil_env_t * env);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_layout_builder.h b/neethi/include/rp_layout_builder.h
new file mode 100644
index 0000000..f101c06
--- /dev/null
+++ b/neethi/include/rp_layout_builder.h
@@ -0,0 +1,45 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_LAYOUT_BUILDER_H
+#define RP_LAYOUT_BUILDER_H
+
+/** @defgroup rp_layout_builder
+ * @ingroup rp_layout_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_layout.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ rp_layout_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_policy_creator.h b/neethi/include/rp_policy_creator.h
new file mode 100644
index 0000000..2cbe834
--- /dev/null
+++ b/neethi/include/rp_policy_creator.h
@@ -0,0 +1,52 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_POLICY_CREATOR_H
+#define RP_POLICY_CREATOR_H
+
+/** @defgroup rp_policy_creator
+ * @ingroup rp_policy_creator
+ * @{
+ */
+
+#include <axiom.h>
+#include <axis2_util.h>
+#include <axutil_env.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+#include <stdio.h>
+#include <axiom_xml_reader.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN rp_secpolicy_t *AXIS2_CALL
+ rp_policy_create_from_file(
+ const axutil_env_t * env,
+ axis2_char_t * filename);
+
+ AXIS2_EXTERN rp_secpolicy_t *AXIS2_CALL
+ rp_policy_create_from_om_node(
+ const axutil_env_t * env,
+ axiom_node_t * root);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_property.h b/neethi/include/rp_property.h
new file mode 100644
index 0000000..ad90036
--- /dev/null
+++ b/neethi/include/rp_property.h
@@ -0,0 +1,95 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_PROPERTY_H
+#define RP_PROPERTY_H
+
+/** @defgroup rp_property
+ * @ingroup rp_property
+ * @{
+ */
+#include <rp_includes.h>
+#include <rp_username_token.h>
+#include <rp_x509_token.h>
+#include <rp_issued_token.h>
+#include <rp_saml_token.h>
+#include <rp_security_context_token.h>
+#include <rp_https_token.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef enum
+ {
+ RP_PROPERTY_USERNAME_TOKEN = 0,
+ RP_PROPERTY_X509_TOKEN,
+ RP_PROPERTY_ISSUED_TOKEN,
+ RP_PROPERTY_SAML_TOKEN,
+ RP_PROPERTY_SECURITY_CONTEXT_TOKEN,
+ RP_PROPERTY_HTTPS_TOKEN,
+ RP_PROPERTY_SYMMETRIC_BINDING,
+ RP_PROPERTY_ASYMMETRIC_BINDING,
+ RP_PROPERTY_TRANSPORT_BINDING,
+ RP_PROPERTY_SIGNED_SUPPORTING_TOKEN,
+ RP_PROPERTY_SIGNED_ENDORSING_SUPPORTING_TOKEN,
+ RP_PROPERTY_SUPPORTING_SUPPORTING_TOKEN,
+ RP_PROPERTY_ENDORSING_SUPPORTING_TOKEN,
+ RP_PROPERTY_WSS10,
+ RP_PROPERTY_WSS11,
+ RP_PROPERTY_SUPPORTING_TOKEN,
+ RP_PROPERTY_UNKNOWN
+ } rp_property_type_t;
+
+ typedef struct rp_property_t rp_property_t;
+
+ AXIS2_EXTERN rp_property_t *AXIS2_CALL
+ rp_property_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_property_free(
+ rp_property_t * property,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_property_set_value(
+ rp_property_t * property,
+ const axutil_env_t * env,
+ void *value,
+ rp_property_type_t type);
+
+ AXIS2_EXTERN void *AXIS2_CALL
+ rp_property_get_value(
+ rp_property_t * property,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN rp_property_type_t AXIS2_CALL
+ rp_property_get_type(
+ rp_property_t * property,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_property_increment_ref(
+ rp_property_t * property,
+ const axutil_env_t * env);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_protection_token_builder.h b/neethi/include/rp_protection_token_builder.h
new file mode 100644
index 0000000..a203047
--- /dev/null
+++ b/neethi/include/rp_protection_token_builder.h
@@ -0,0 +1,48 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_PROTECTION_TOKEN_BUILDER_H
+#define RP_PROTECTION_TOKEN_BUILDER_H
+
+/** @defgroup rp_protection_token_builder
+ * @ingroup rp_protection_token_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_x509_token.h>
+#include <rp_issued_token.h>
+#include <rp_saml_token.h>
+#include <rp_security_context_token.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ rp_protection_token_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_rampart_config.h b/neethi/include/rp_rampart_config.h
new file mode 100644
index 0000000..08a2f11
--- /dev/null
+++ b/neethi/include/rp_rampart_config.h
@@ -0,0 +1,217 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_RAMPART_CONFIG_H
+#define RP_RAMPART_CONFIG_H
+
+/** @defgroup rp_rampart_config
+ * @ingroup rp_rampart_config
+ * @{
+ */
+
+#include <rp_includes.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_rampart_config_t rp_rampart_config_t;
+
+ AXIS2_EXTERN rp_rampart_config_t *AXIS2_CALL
+ rp_rampart_config_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_rampart_config_free(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_rampart_config_get_user(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_rampart_config_set_user(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * user);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_rampart_config_get_encryption_user(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_rampart_config_set_encryption_user(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * encryption_user);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_rampart_config_get_password_callback_class(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_rampart_config_set_password_callback_class(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * passwprd_callback_class);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_rampart_config_get_authenticate_module(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_rampart_config_set_authenticate_module(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * authenticate_module);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_rampart_config_get_replay_detector(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_rampart_config_set_replay_detector(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * replay_detector);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_rampart_config_get_sct_provider(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_rampart_config_set_sct_provider(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * sct_module);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_rampart_config_get_password_type(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_rampart_config_set_password_type(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * password_type);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_rampart_config_get_private_key_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_rampart_config_set_private_key_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * private_key_file);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_rampart_config_get_receiver_certificate_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_rampart_config_set_receiver_certificate_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * receiver_certificate_file);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_rampart_config_get_certificate_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_rampart_config_set_certificate_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * certificate_file);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_rampart_config_get_time_to_live(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_rampart_config_set_time_to_live(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * time_to_live);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_rampart_config_get_clock_skew_buffer(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_rampart_config_set_clock_skew_buffer(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * clock_skew_buffer);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_rampart_config_get_need_millisecond_precision(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_rampart_config_set_need_millisecond_precision(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * need_millisecond_precision);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_rampart_config_get_rd_val(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_rampart_config_set_rd_val(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * rd_val);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_rampart_config_increment_ref(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_rampart_config_set_pkcs12_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t *env,
+ axis2_char_t * pkcs12_file);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_rampart_config_get_pkcs12_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_rampart_config_builder.h b/neethi/include/rp_rampart_config_builder.h
new file mode 100644
index 0000000..3dcce53
--- /dev/null
+++ b/neethi/include/rp_rampart_config_builder.h
@@ -0,0 +1,45 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_RAMPART_CONFIG_BUILDER_H
+#define RP_RAMPART_CONFIG_BUILDER_H
+
+/** @defgroup rp_rampart_config_builder
+ * @ingroup rp_rampart_config_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_rampart_config.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ rp_rampart_config_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_recipient_token_builder.h b/neethi/include/rp_recipient_token_builder.h
new file mode 100644
index 0000000..08ed111
--- /dev/null
+++ b/neethi/include/rp_recipient_token_builder.h
@@ -0,0 +1,45 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_RECIPIENT_TOKEN_BUILDER_H
+#define RP_RECIPIENT_TOKEN_BUILDER_H
+
+/** @defgroup rp_recipient_token_builder
+ * @ingroup rp_recipient_token_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_x509_token.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ rp_recipient_token_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_saml_token.h b/neethi/include/rp_saml_token.h
new file mode 100644
index 0000000..044a5fb
--- /dev/null
+++ b/neethi/include/rp_saml_token.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_SAML_TOKEN_H
+#define RP_SAML_TOKEN_H
+
+#include <rp_includes.h>
+#include <axutil_utils.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_saml_token rp_saml_token_t;
+
+ AXIS2_EXTERN rp_saml_token_t * AXIS2_CALL
+ rp_saml_token_create(
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_saml_token_free(
+ rp_saml_token_t *saml_token,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+ rp_saml_token_get_inclusion(
+ rp_saml_token_t *saml_token,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_saml_token_set_inclusion(
+ rp_saml_token_t *saml_token,
+ const axutil_env_t *env,
+ axis2_char_t * inclusion);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_saml_token_get_derivedkeys(
+ rp_saml_token_t *saml_token,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_saml_token_set_derivedkeys(
+ rp_saml_token_t *saml_token,
+ const axutil_env_t *env,
+ axis2_bool_t derivedkeys);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_saml_token_get_require_key_identifier_reference(
+ rp_saml_token_t * saml_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_saml_token_set_require_key_identifier_reference(
+ rp_saml_token_t * saml_token,
+ const axutil_env_t * env,
+ axis2_bool_t require_key_identifier_reference);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_saml_token_get_token_version_and_type(
+ rp_saml_token_t * saml_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_saml_token_set_token_version_and_type(
+ rp_saml_token_t * saml_token,
+ const axutil_env_t * env,
+ axis2_char_t * token_version_and_type);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_saml_token_increment_ref(
+ rp_saml_token_t * saml_token,
+ const axutil_env_t * env);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_saml_token_builder.h b/neethi/include/rp_saml_token_builder.h
new file mode 100644
index 0000000..5fbb8d9
--- /dev/null
+++ b/neethi/include/rp_saml_token_builder.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_SAML_TOKEN_BUILDER_H
+#define RP_SAML_TOKEN_BUILDER_H
+
+/** @defgroup rp_saml_token_builder
+ * @ingroup rp_saml_token_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_saml_token.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ rp_saml_token_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_secpolicy.h b/neethi/include/rp_secpolicy.h
new file mode 100644
index 0000000..138cc1d
--- /dev/null
+++ b/neethi/include/rp_secpolicy.h
@@ -0,0 +1,213 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_SECPOLICY_H
+#define RP_SECPOLICY_H
+
+/** @defgroup rp_secpolicy
+ * @ingroup rp_secpolicy
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_asymmetric_binding.h>
+#include <rp_symmetric_binding.h>
+#include <rp_transport_binding.h>
+#include <rp_signed_encrypted_parts.h>
+#include <rp_signed_encrypted_elements.h>
+#include <rp_signed_encrypted_items.h>
+#include <rp_supporting_tokens.h>
+#include <rp_rampart_config.h>
+#include <rp_wss10.h>
+#include <rp_wss11.h>
+#include <rp_trust10.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_secpolicy_t rp_secpolicy_t;
+
+ AXIS2_EXTERN rp_secpolicy_t *AXIS2_CALL
+ rp_secpolicy_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_secpolicy_free(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_secpolicy_set_binding(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_property_t * binding);
+
+ AXIS2_EXTERN rp_property_t *AXIS2_CALL
+ rp_secpolicy_get_binding(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_secpolicy_set_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_supporting_tokens_t * supporting_tokens);
+
+ AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+ rp_secpolicy_get_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_secpolicy_set_signed_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_supporting_tokens_t * signed_supporting_tokens);
+
+ AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+ rp_secpolicy_get_signed_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_secpolicy_set_endorsing_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_supporting_tokens_t * endorsing_supporting_tokens);
+
+ AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+ rp_secpolicy_get_endorsing_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_secpolicy_set_signed_endorsing_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_supporting_tokens_t * signed_endorsing_supporting_tokens);
+
+ AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+ rp_secpolicy_get_signed_endorsing_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_secpolicy_set_signed_parts(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_signed_encrypted_parts_t * signed_parts);
+
+ AXIS2_EXTERN rp_signed_encrypted_parts_t *AXIS2_CALL
+ rp_secpolicy_get_signed_parts(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_secpolicy_set_encrypted_parts(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_signed_encrypted_parts_t * encrypted_parts);
+
+ AXIS2_EXTERN rp_signed_encrypted_parts_t *AXIS2_CALL
+ rp_secpolicy_get_encrypted_parts(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_secpolicy_set_signed_elements(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_signed_encrypted_elements_t * signed_elements);
+
+ AXIS2_EXTERN rp_signed_encrypted_elements_t *AXIS2_CALL
+ rp_secpolicy_get_signed_elements(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_secpolicy_set_encrypted_elements(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_signed_encrypted_elements_t * encrypted_elements);
+
+ AXIS2_EXTERN rp_signed_encrypted_elements_t *AXIS2_CALL
+ rp_secpolicy_get_encrypted_elements(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_secpolicy_set_signed_items(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_signed_encrypted_items_t * signed_items);
+
+ AXIS2_EXTERN rp_signed_encrypted_items_t *AXIS2_CALL
+ rp_secpolicy_get_signed_items(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_secpolicy_set_encrypted_items(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_signed_encrypted_items_t * encrypted_items);
+
+ AXIS2_EXTERN rp_signed_encrypted_items_t *AXIS2_CALL
+ rp_secpolicy_get_encrypted_items(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_secpolicy_set_wss(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_property_t * wss);
+
+ AXIS2_EXTERN rp_property_t *AXIS2_CALL
+ rp_secpolicy_get_wss(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_secpolicy_set_rampart_config(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_rampart_config_t * rampart_config);
+
+ AXIS2_EXTERN rp_rampart_config_t *AXIS2_CALL
+ rp_secpolicy_get_rampart_config(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_secpolicy_set_trust10(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_trust10_t * trust10);
+
+ AXIS2_EXTERN rp_trust10_t *AXIS2_CALL
+ rp_secpolicy_get_trust10(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_secpolicy_builder.h b/neethi/include/rp_secpolicy_builder.h
new file mode 100644
index 0000000..5f32312
--- /dev/null
+++ b/neethi/include/rp_secpolicy_builder.h
@@ -0,0 +1,44 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_SECPOLICY_BUILDER_H
+#define RP_SECPOLICY_BUILDER_H
+
+/** @defgroup rp_secpolicy_builder
+ * @ingroup rp_secpolicy_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_secpolicy.h>
+#include <neethi_policy.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN rp_secpolicy_t *AXIS2_CALL
+ rp_secpolicy_builder_build(
+ const axutil_env_t * env,
+ neethi_policy_t * policy);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_security_context_token.h b/neethi/include/rp_security_context_token.h
new file mode 100644
index 0000000..b06b5e0
--- /dev/null
+++ b/neethi/include/rp_security_context_token.h
@@ -0,0 +1,143 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_SECURITY_CONTEXT_TOKEN_H
+#define RP_SECURITY_CONTEXT_TOKEN_H
+
+/** @defgroup rp_security_context_token
+ * @ingroup rp_security_context_token
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <neethi_policy.h>
+#include <rp_token.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_security_context_token_t rp_security_context_token_t;
+
+ AXIS2_EXTERN rp_security_context_token_t *AXIS2_CALL
+ rp_security_context_token_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_security_context_token_free(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_security_context_token_get_inclusion(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_security_context_token_set_inclusion(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env,
+ axis2_char_t * inclusion);
+
+ AXIS2_EXTERN derive_key_type_t AXIS2_CALL
+ rp_security_context_token_get_derivedkey(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_security_context_token_set_derivedkey(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env,
+ derive_key_type_t derivedkey);
+
+ AXIS2_EXTERN derive_key_version_t AXIS2_CALL
+ rp_security_context_token_get_derivedkey_version(
+ rp_security_context_token_t *security_context_token,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_security_context_token_set_derivedkey_version(
+ rp_security_context_token_t *security_context_token,
+ const axutil_env_t *env,
+ derive_key_version_t version);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_security_context_token_get_require_external_uri_ref(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_security_context_token_set_require_external_uri_ref(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env,
+ axis2_bool_t require_external_uri_ref);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_security_context_token_get_sc10_security_context_token(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_security_context_token_set_sc10_security_context_token(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env,
+ axis2_bool_t sc10_security_context_token);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_security_context_token_get_issuer(
+ rp_security_context_token_t *security_context_token,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_security_context_token_set_issuer(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env,
+ axis2_char_t *issuer);
+
+ AXIS2_EXTERN neethi_policy_t *AXIS2_CALL
+ rp_security_context_token_get_bootstrap_policy(
+ rp_security_context_token_t *security_context_token,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_security_context_token_set_bootstrap_policy(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env,
+ neethi_policy_t *bootstrap_policy);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_security_context_token_get_is_secure_conversation_token(
+ rp_security_context_token_t *security_context_token,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_security_context_token_set_is_secure_conversation_token(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env,
+ axis2_bool_t is_secure_conversation_token);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_security_context_token_increment_ref(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_security_context_token_builder.h b/neethi/include/rp_security_context_token_builder.h
new file mode 100644
index 0000000..45e2745
--- /dev/null
+++ b/neethi/include/rp_security_context_token_builder.h
@@ -0,0 +1,47 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_SECURITY_CONTEXT_TOKEN_BUILDER_H
+#define RP_SECURITY_CONTEXT_TOKEN_BUILDER_H
+
+/** @defgroup rp_security_context_token_builder
+ * @ingroup rp_security_context_token_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_security_context_token.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ rp_security_context_token_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element,
+ axis2_char_t *sp_ns_uri,
+ axis2_bool_t is_secure_conversation_token);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_signature_token_builder.h b/neethi/include/rp_signature_token_builder.h
new file mode 100644
index 0000000..13e2b79
--- /dev/null
+++ b/neethi/include/rp_signature_token_builder.h
@@ -0,0 +1,48 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_SIGNATURE_TOKEN_BUILDER_H
+#define RP_SIGNATURE_TOKEN_BUILDER_H
+
+/** @defgroup rp_signature_token_builder
+ * @ingroup rp_signature_token_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_x509_token.h>
+#include <rp_issued_token.h>
+#include <rp_saml_token.h>
+#include <rp_security_context_token.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ rp_signature_token_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_signed_encrypted_elements.h b/neethi/include/rp_signed_encrypted_elements.h
new file mode 100644
index 0000000..dc44b96
--- /dev/null
+++ b/neethi/include/rp_signed_encrypted_elements.h
@@ -0,0 +1,86 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_SIGNED_ENCRYPTED_ELEMENTS_H
+#define RP_SIGNED_ENCRYPTED_ELEMENTS_H
+
+/** @defgroup rp_signed_encrypted_elements
+ * @ingroup rp_signed_encrypted_elements
+ * @{
+ */
+
+#include <rp_includes.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_signed_encrypted_elements_t
+ rp_signed_encrypted_elements_t;
+
+ AXIS2_EXTERN rp_signed_encrypted_elements_t *AXIS2_CALL
+ rp_signed_encrypted_elements_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_signed_encrypted_elements_free(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_signed_encrypted_elements_get_signedelements(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_signed_encrypted_elements_set_signedelements(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env,
+ axis2_bool_t signedelements);
+
+ AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+ rp_signed_encrypted_elements_get_xpath_expressions(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_signed_encrypted_elements_add_expression(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env,
+ axis2_char_t * expression);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_signed_encrypted_elements_get_xpath_version(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_signed_encrypted_elements_set_xpath_version(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env,
+ axis2_char_t * xpath_version);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_signed_encrypted_elements_increment_ref(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_signed_encrypted_items.h b/neethi/include/rp_signed_encrypted_items.h
new file mode 100644
index 0000000..c29b82d
--- /dev/null
+++ b/neethi/include/rp_signed_encrypted_items.h
@@ -0,0 +1,70 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_SIGNED_ENCRYPTED_ITEMS_H
+#define RP_SIGNED_ENCRYPTED_ITEMS_H
+
+/** @defgroup rp_signed_encrypted_items
+ * @ingroup rp_signed_encrypted_itemss
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_element.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_signed_encrypted_items_t rp_signed_encrypted_items_t;
+
+ AXIS2_EXTERN rp_signed_encrypted_items_t *AXIS2_CALL
+ rp_signed_encrypted_items_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_signed_encrypted_items_free(
+ rp_signed_encrypted_items_t * signed_encrypted_items,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_signed_encrypted_items_get_signeditems(
+ rp_signed_encrypted_items_t * signed_encrypted_items,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_signed_encrypted_items_set_signeditems(
+ rp_signed_encrypted_items_t * signed_encrypted_items,
+ const axutil_env_t * env,
+ axis2_bool_t signeditems);
+
+ AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+ rp_signed_encrypted_items_get_elements(
+ rp_signed_encrypted_items_t * signed_encrypted_items,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_signed_encrypted_items_add_element(
+ rp_signed_encrypted_items_t * signed_encrypted_items,
+ const axutil_env_t * env,
+ rp_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_signed_encrypted_parts.h b/neethi/include/rp_signed_encrypted_parts.h
new file mode 100644
index 0000000..3df23a0
--- /dev/null
+++ b/neethi/include/rp_signed_encrypted_parts.h
@@ -0,0 +1,98 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_SIGNED_ENCRYPTED_PARTS_H
+#define RP_SIGNED_ENCRYPTED_PARTS_H
+
+/** @defgroup rp_signed_encrypted_parts
+ * @ingroup rp_signed_encrypted_parts
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_header.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_signed_encrypted_parts_t rp_signed_encrypted_parts_t;
+
+ AXIS2_EXTERN rp_signed_encrypted_parts_t *AXIS2_CALL
+ rp_signed_encrypted_parts_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_signed_encrypted_parts_free(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_signed_encrypted_parts_get_body(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_signed_encrypted_parts_set_body(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env,
+ axis2_bool_t body);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_signed_encrypted_parts_get_signedparts(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_signed_encrypted_parts_set_signedparts(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env,
+ axis2_bool_t signedparts);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_signed_encrypted_parts_get_attachments(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_signed_encrypted_parts_set_attachments(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env,
+ axis2_bool_t attachments);
+
+ AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+ rp_signed_encrypted_parts_get_headers(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_signed_encrypted_parts_add_header(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env,
+ rp_header_t * header);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_signed_encrypted_parts_increment_ref(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_signed_encrypted_parts_builder.h b/neethi/include/rp_signed_encrypted_parts_builder.h
new file mode 100644
index 0000000..fa7809e
--- /dev/null
+++ b/neethi/include/rp_signed_encrypted_parts_builder.h
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_SIGNED_ENCRYPTED_PARTS_BUILDER_H
+#define RP_SIGNED_ENCRYPTED_PARTS_BUILDER_H
+
+/** @defgroup rp_signed_encrypted_parts_builder
+ * @ingroup rp_signed_encrypted_parts_builder
+ * @{
+ */
+
+#include <rp_signed_encrypted_parts.h>
+#include <rp_header.h>
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ /**
+ * Builts EncryptedParts or SignedParts assertion
+ * @param env Pointer to environment struct
+ * @param node Assertion node
+ * @param element Assertion element
+ * @param is_signed boolean showing whether signing or encryption
+ * @returns neethi assertion created. NULL if failure.
+ */
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ rp_signed_encrypted_parts_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element,
+ axis2_bool_t is_signed);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_supporting_tokens.h b/neethi/include/rp_supporting_tokens.h
new file mode 100644
index 0000000..6746454
--- /dev/null
+++ b/neethi/include/rp_supporting_tokens.h
@@ -0,0 +1,132 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_SUPPORTING_TOKENS_H
+#define RP_SUPPORTING_TOKENS_H
+
+/** @defgroup rp_supporting_tokens
+ * @ingroup rp_supporting_tokens
+ * @{
+ */
+#include <rp_includes.h>
+#include <rp_algorithmsuite.h>
+#include <rp_signed_encrypted_parts.h>
+#include <rp_signed_encrypted_elements.h>
+#include <rp_property.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_supporting_tokens_t rp_supporting_tokens_t;
+
+ AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+ rp_supporting_tokens_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_supporting_tokens_free(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+ rp_supporting_tokens_get_tokens(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_supporting_tokens_add_token(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env,
+ rp_property_t * token);
+
+ AXIS2_EXTERN rp_algorithmsuite_t *AXIS2_CALL
+ rp_supporting_tokens_get_algorithmsuite(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_supporting_tokens_set_algorithmsuite(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env,
+ rp_algorithmsuite_t * algorithmsuite);
+
+ AXIS2_EXTERN rp_signed_encrypted_parts_t *AXIS2_CALL
+ rp_supporting_tokens_get_signed_parts(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_supporting_tokens_set_signed_parts(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env,
+ rp_signed_encrypted_parts_t * signed_parts);
+
+ AXIS2_EXTERN rp_signed_encrypted_elements_t *AXIS2_CALL
+ rp_supporting_tokens_get_signed_elements(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_supporting_tokens_set_signed_elements(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env,
+ rp_signed_encrypted_elements_t * signed_elements);
+
+ AXIS2_EXTERN rp_signed_encrypted_parts_t *AXIS2_CALL
+ rp_supporting_tokens_get_encrypted_parts(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_supporting_tokens_set_encrypted_parts(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env,
+ rp_signed_encrypted_parts_t * encrypted_parts);
+
+ AXIS2_EXTERN rp_signed_encrypted_elements_t *AXIS2_CALL
+ rp_supporting_tokens_get_encrypted_elements(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_supporting_tokens_set_encrypted_elements(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env,
+ rp_signed_encrypted_elements_t * encrypted_elements);
+
+ AXIS2_EXTERN int AXIS2_CALL
+ rp_supporting_tokens_get_type(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_supporting_tokens_set_type(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env,
+ int type);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_supporting_tokens_increment_ref(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_supporting_tokens_builder.h b/neethi/include/rp_supporting_tokens_builder.h
new file mode 100644
index 0000000..f3df32a
--- /dev/null
+++ b/neethi/include/rp_supporting_tokens_builder.h
@@ -0,0 +1,49 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_SUPPORTING_TOKEN_BUILDER_H
+#define RP_SUPPORTING_TOKEN_BUILDER_H
+
+/** @defgroup rp_supporting_tokens_builder
+ * @ingroup rp_supporting_tokens_builder
+ * @{
+ */
+
+#include <rp_supporting_tokens.h>
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_x509_token.h>
+#include <rp_username_token.h>
+#include <rp_token_identifier.h>
+#include <rp_algorithmsuite.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ rp_supporting_tokens_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_symmetric_asymmetric_binding_commons.h b/neethi/include/rp_symmetric_asymmetric_binding_commons.h
new file mode 100644
index 0000000..0251a1d
--- /dev/null
+++ b/neethi/include/rp_symmetric_asymmetric_binding_commons.h
@@ -0,0 +1,117 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_ASSYMMETRIC_SYMMETRIC_BINDING_COMMONS_H
+#define RP_ASSYMMETRIC_SYMMETRIC_BINDING_COMMONS_H
+
+/** @defgroup rp_assymmetric_symmetric_binding_commons
+ * @ingroup rp_assymmetric_symmetric_binding_commons
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_binding_commons.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_symmetric_asymmetric_binding_commons_t
+ rp_symmetric_asymmetric_binding_commons_t;
+
+ AXIS2_EXTERN rp_symmetric_asymmetric_binding_commons_t *AXIS2_CALL
+ rp_symmetric_asymmetric_binding_commons_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_symmetric_asymmetric_binding_commons_free(
+ rp_symmetric_asymmetric_binding_commons_t *
+ symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN rp_binding_commons_t *AXIS2_CALL
+ rp_symmetric_asymmetric_binding_commons_get_binding_commons(
+ rp_symmetric_asymmetric_binding_commons_t *
+ symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_symmetric_asymmetric_binding_commons_set_binding_commons(
+ rp_symmetric_asymmetric_binding_commons_t *
+ symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env,
+ rp_binding_commons_t * binding_commons);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_symmetric_asymmetric_binding_commons_get_signature_protection(
+ rp_symmetric_asymmetric_binding_commons_t *
+ symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_symmetric_asymmetric_binding_commons_set_signature_protection(
+ rp_symmetric_asymmetric_binding_commons_t *
+ symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env,
+ axis2_bool_t signature_protection);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_symmetric_asymmetric_binding_commons_get_token_protection(
+ rp_symmetric_asymmetric_binding_commons_t *
+ symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_symmetric_asymmetric_binding_commons_set_token_protection(
+ rp_symmetric_asymmetric_binding_commons_t *
+ symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env,
+ axis2_bool_t token_protection);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_symmetric_asymmetric_binding_commons_get_entire_headers_and_body_signatures
+ (
+ rp_symmetric_asymmetric_binding_commons_t *
+ symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_symmetric_asymmetric_binding_commons_set_entire_headers_and_body_signatures
+ (
+ rp_symmetric_asymmetric_binding_commons_t *
+ symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env,
+ axis2_bool_t entire_headers_and_body_signatures);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_symmetric_asymmetric_binding_commons_get_protection_order(
+ rp_symmetric_asymmetric_binding_commons_t *
+ symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_symmetric_asymmetric_binding_commons_set_protection_order(
+ rp_symmetric_asymmetric_binding_commons_t *
+ symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env,
+ axis2_char_t * protection_order);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_symmetric_binding.h b/neethi/include/rp_symmetric_binding.h
new file mode 100644
index 0000000..05f412d
--- /dev/null
+++ b/neethi/include/rp_symmetric_binding.h
@@ -0,0 +1,99 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_SYMMETRIC_BINDING_H
+#define RP_SYMMETRIC_BINDING_H
+
+/** @defgroup rp_symmetric_binding
+ * @ingroup rp_symmetric_binding
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_symmetric_asymmetric_binding_commons.h>
+#include <rp_property.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_symmetric_binding_t rp_symmetric_binding_t;
+
+ AXIS2_EXTERN rp_symmetric_binding_t *AXIS2_CALL
+ rp_symmetric_binding_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_symmetric_binding_free(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN rp_symmetric_asymmetric_binding_commons_t *AXIS2_CALL
+ rp_symmetric_binding_get_symmetric_asymmetric_binding_commons(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_symmetric_binding_set_symmetric_asymmetric_binding_commons(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env,
+ rp_symmetric_asymmetric_binding_commons_t *
+ symmetric_asymmetric_binding_commons);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_symmetric_binding_set_protection_token(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env,
+ rp_property_t * protection_token);
+
+ AXIS2_EXTERN rp_property_t *AXIS2_CALL
+ rp_symmetric_binding_get_protection_token(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_symmetric_binding_set_encryption_token(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env,
+ rp_property_t * encryption_token);
+
+ AXIS2_EXTERN rp_property_t *AXIS2_CALL
+ rp_symmetric_binding_get_encryption_token(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_symmetric_binding_set_signature_token(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env,
+ rp_property_t * signature_token);
+
+ AXIS2_EXTERN rp_property_t *AXIS2_CALL
+ rp_symmetric_binding_get_signature_token(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_symmetric_binding_increment_ref(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_symmetric_binding_builder.h b/neethi/include/rp_symmetric_binding_builder.h
new file mode 100644
index 0000000..3f5b669
--- /dev/null
+++ b/neethi/include/rp_symmetric_binding_builder.h
@@ -0,0 +1,45 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_SYMMETRIC_BINDING_BUILDER_H
+#define RP_SYMMETRIC_BINDING_BUILDER_H
+
+/** @defgroup rp_symmetric_binding_builder
+ * @ingroup rp_symmetric_binding_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_symmetric_binding.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ rp_symmetric_binding_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_token.h b/neethi/include/rp_token.h
new file mode 100644
index 0000000..eb3d84e
--- /dev/null
+++ b/neethi/include/rp_token.h
@@ -0,0 +1,134 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_GENERIC_TOKEN_H
+#define RP_GENERIC_TOKEN_H
+
+/** @defgroup rp_token
+ * @ingroup rp_token
+ * @{
+ */
+
+#include <rp_includes.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef enum
+ {
+ DERIVEKEY_NONE =0,
+ DERIVEKEY_NEEDED,
+ DERIVEKEY_IMPLIED,
+ DERIVEKEY_EXPLICIT
+ } derive_key_type_t;
+
+ typedef enum
+ {
+ DERIVEKEY_VERSION_SC10 =0,
+ DERIVEKEY_VERSION_SC13
+ } derive_key_version_t;
+
+ typedef struct rp_token_t rp_token_t;
+
+ AXIS2_EXTERN rp_token_t *AXIS2_CALL
+ rp_token_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_token_free(
+ rp_token_t * token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_token_get_issuer(
+ rp_token_t * token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_token_set_issuer(
+ rp_token_t * token,
+ const axutil_env_t * env,
+ axis2_char_t * issuer);
+
+ AXIS2_EXTERN derive_key_type_t AXIS2_CALL
+ rp_token_get_derivedkey_type(
+ rp_token_t * token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_token_set_derivedkey_type(
+ rp_token_t * token,
+ const axutil_env_t * env,
+ derive_key_type_t derivedkey);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_token_get_is_issuer_name(
+ rp_token_t * token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_token_set_is_issuer_name(
+ rp_token_t * token,
+ const axutil_env_t * env,
+ axis2_bool_t is_issuer_name);
+
+ AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+ rp_token_get_claim(
+ rp_token_t * token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_token_set_claim(
+ rp_token_t * token,
+ const axutil_env_t * env,
+ axiom_node_t *claim);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_token_increment_ref(
+ rp_token_t * token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_token_set_derive_key_version(
+ rp_token_t *token,
+ const axutil_env_t *env,
+ derive_key_version_t version);
+
+ AXIS2_EXTERN derive_key_version_t AXIS2_CALL
+ rp_token_get_derive_key_version(
+ rp_token_t *token,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_token_set_inclusion(
+ rp_token_t *token,
+ const axutil_env_t *env,
+ axis2_char_t *inclusion);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_token_get_inclusion(
+ rp_token_t *token,
+ const axutil_env_t *env);
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_token_identifier.h b/neethi/include/rp_token_identifier.h
new file mode 100644
index 0000000..b4d7d45
--- /dev/null
+++ b/neethi/include/rp_token_identifier.h
@@ -0,0 +1,46 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_TOKEN_IDENTIFIER_H
+#define RP_TOKEN_IDENTIFIER_H
+
+/** @defgroup rp_token_identifier
+ * @ingroup rp_token_identifier
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_x509_token.h>
+#include <rp_username_token.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_token_identifier_set_token(
+ rp_property_t * token,
+ neethi_assertion_t * assertion,
+ const axutil_env_t * env);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_transport_binding.h b/neethi/include/rp_transport_binding.h
new file mode 100644
index 0000000..ac904a6
--- /dev/null
+++ b/neethi/include/rp_transport_binding.h
@@ -0,0 +1,76 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_TRANSPORT_BINDING_H
+#define RP_TRANSPORT_BINDING_H
+
+/** @defgroup rp_transport_binding
+ * @ingroup rp_transport_binding
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_binding_commons.h>
+#include <rp_property.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_transport_binding_t rp_transport_binding_t;
+
+ AXIS2_EXTERN rp_transport_binding_t *AXIS2_CALL
+ rp_transport_binding_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_transport_binding_free(
+ rp_transport_binding_t * transport_binding,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN rp_binding_commons_t *AXIS2_CALL
+ rp_transport_binding_get_binding_commons(
+ rp_transport_binding_t * transport_binding,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_transport_binding_set_binding_commons(
+ rp_transport_binding_t * transport_binding,
+ const axutil_env_t * env,
+ rp_binding_commons_t * binding_commons);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_transport_binding_set_transport_token(
+ rp_transport_binding_t * transport_binding,
+ const axutil_env_t * env,
+ rp_property_t * transport_token);
+
+ AXIS2_EXTERN rp_property_t *AXIS2_CALL
+ rp_transport_binding_get_transport_token(
+ rp_transport_binding_t * transport_binding,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_transport_binding_increment_ref(
+ rp_transport_binding_t * tansport_binding,
+ const axutil_env_t * env);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_transport_binding_builder.h b/neethi/include/rp_transport_binding_builder.h
new file mode 100644
index 0000000..566b3aa
--- /dev/null
+++ b/neethi/include/rp_transport_binding_builder.h
@@ -0,0 +1,46 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_TRANSPORT_BINDING_BUILDER_H
+#define RP_TRANSPORT_BINDING_BUILDER_H
+
+/** @defgroup rp_transport_binding_builder
+ * @ingroup rp_transport_binding_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_transport_binding.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+
+ rp_transport_binding_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_transport_token_builder.h b/neethi/include/rp_transport_token_builder.h
new file mode 100644
index 0000000..00887b4
--- /dev/null
+++ b/neethi/include/rp_transport_token_builder.h
@@ -0,0 +1,45 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_TRANSPORT_TOKEN_BUILDER_H
+#define RP_TRANSPORT_TOKEN_BUILDER_H
+
+/** @defgroup rp_transport_token_builder
+ * @ingroup rp_transport_token_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_https_token.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ rp_transport_token_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_trust10.h b/neethi/include/rp_trust10.h
new file mode 100644
index 0000000..d6a68bf
--- /dev/null
+++ b/neethi/include/rp_trust10.h
@@ -0,0 +1,108 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_TRUST10_H
+#define RP_TRUST10_H
+
+/** @defgroup trust10
+ * @ingroup trust10
+ * @{
+ */
+
+#include <rp_includes.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_trust10_t rp_trust10_t;
+
+ AXIS2_EXTERN rp_trust10_t *AXIS2_CALL
+ rp_trust10_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_trust10_free(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_trust10_get_must_support_client_challenge(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_trust10_set_must_support_client_challenge(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_client_challenge);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_trust10_get_must_support_server_challenge(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_trust10_set_must_support_server_challenge(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_server_challenge);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_trust10_get_require_client_entropy(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_trust10_set_require_client_entropy(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env,
+ axis2_bool_t require_client_entropy);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_trust10_get_require_server_entropy(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_trust10_set_require_server_entropy(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env,
+ axis2_bool_t require_server_entropy);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_trust10_get_must_support_issued_token(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_trust10_set_must_support_issued_token(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_issued_token);
+
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_trust10_increment_ref(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_trust10_builder.h b/neethi/include/rp_trust10_builder.h
new file mode 100644
index 0000000..443f343
--- /dev/null
+++ b/neethi/include/rp_trust10_builder.h
@@ -0,0 +1,45 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_TRUST10_BUILDER_H
+#define RP_TRUST10_BUILDER_H
+
+/** @defgroup rp_trust10_builder
+ * @ingroup rp_trust10_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_trust10.h>
+#include <neethi_includes.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ rp_trust10_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_username_token.h b/neethi/include/rp_username_token.h
new file mode 100644
index 0000000..ce8e99f
--- /dev/null
+++ b/neethi/include/rp_username_token.h
@@ -0,0 +1,138 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_USERNAME_TOKEN_H
+#define RP_USERNAME_TOKEN_H
+
+/** @defgroup rp_username_token
+ * @ingroup rp_username_token
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_token.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef enum
+ {
+ PASSWORD_PLAIN = 0,
+ PASSWORD_HASH,
+ PASSWORD_NONE /* no password will be provided in the user name token */
+ } password_type_t;
+
+ typedef struct rp_username_token_t rp_username_token_t;
+
+ AXIS2_EXTERN rp_username_token_t *AXIS2_CALL
+ rp_username_token_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_username_token_free(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_username_token_get_inclusion(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_username_token_set_inclusion(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env,
+ axis2_char_t * inclusion);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_username_token_get_useUTprofile10(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_username_token_set_useUTprofile10(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env,
+ axis2_bool_t useUTprofile10);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_username_token_get_useUTprofile11(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_username_token_set_useUTprofile11(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env,
+ axis2_bool_t useUTprofile11);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_username_token_get_issuer(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_username_token_set_issuer(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env,
+ axis2_char_t * issuer);
+
+ AXIS2_EXTERN derive_key_type_t AXIS2_CALL
+ rp_username_token_get_derivedkey_type(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_username_token_set_derivedkey_type(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env,
+ derive_key_type_t derivedkey);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_username_token_get_is_issuer_name(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_username_token_set_is_issuer_name(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env,
+ axis2_bool_t is_issuer_name);
+
+ AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+ rp_username_token_get_claim(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_username_token_set_claim(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env,
+ axiom_node_t *claim);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_username_token_increment_ref(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_username_token_builder.h b/neethi/include/rp_username_token_builder.h
new file mode 100644
index 0000000..fb7a268
--- /dev/null
+++ b/neethi/include/rp_username_token_builder.h
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_USERNAME_TOKEN_BUILDER_H
+#define RP_USERNAME_TOKEN_BUILDER_H
+
+/** @defgroup rp_username_token_builder
+ * @ingroup rp_username_token_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_username_token.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ rp_username_token_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_wss10.h b/neethi/include/rp_wss10.h
new file mode 100644
index 0000000..e06f68e
--- /dev/null
+++ b/neethi/include/rp_wss10.h
@@ -0,0 +1,96 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_WSS10_H
+#define RP_WSS10_H
+
+/** @defgroup wss10
+ * @ingroup wss10
+ * @{
+ */
+
+#include <rp_includes.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_wss10_t rp_wss10_t;
+
+ AXIS2_EXTERN rp_wss10_t *AXIS2_CALL
+ rp_wss10_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_wss10_free(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_wss10_get_must_support_ref_key_identifier(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_wss10_set_must_support_ref_key_identifier(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_key_identifier);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_wss10_get_must_support_ref_issuer_serial(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_wss10_set_must_support_ref_issuer_serial(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_issuer_serial);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_wss10_get_must_support_ref_external_uri(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_wss10_set_must_support_ref_external_uri(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_external_uri);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_wss10_get_must_support_ref_embedded_token(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_wss10_set_must_support_ref_embedded_token(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_embedded_token);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_wss10_increment_ref(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_wss10_builder.h b/neethi/include/rp_wss10_builder.h
new file mode 100644
index 0000000..388f308
--- /dev/null
+++ b/neethi/include/rp_wss10_builder.h
@@ -0,0 +1,45 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_WSS10_BUILDER_H
+#define RP_WSS10_BUILDER_H
+
+/** @defgroup rp_wss10_builder
+ * @ingroup rp_wss10_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_wss10.h>
+#include <neethi_includes.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ rp_wss10_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_wss11.h b/neethi/include/rp_wss11.h
new file mode 100644
index 0000000..127867c
--- /dev/null
+++ b/neethi/include/rp_wss11.h
@@ -0,0 +1,129 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_WSS11_H
+#define RP_WSS11_H
+
+/** @defgroup wss11
+ * @ingroup wss11
+ * @{
+ */
+
+#include <rp_includes.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_wss11_t rp_wss11_t;
+
+ AXIS2_EXTERN rp_wss11_t *AXIS2_CALL
+ rp_wss11_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_wss11_free(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_wss11_get_must_support_ref_key_identifier(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_wss11_set_must_support_ref_key_identifier(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_key_identifier);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_wss11_get_must_support_ref_issuer_serial(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_wss11_set_must_support_ref_issuer_serial(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_issuer_serial);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_wss11_get_must_support_ref_external_uri(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_wss11_set_must_support_ref_external_uri(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_external_uri);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_wss11_get_must_support_ref_embedded_token(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_wss11_set_must_support_ref_embedded_token(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_embedded_token);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_wss11_get_must_support_ref_thumbprint(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_wss11_set_must_support_ref_thumbprint(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_thumbprint);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_wss11_set_must_support_ref_encryptedkey(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_encryptedkey);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_wss11_get_must_support_ref_encryptedkey(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_wss11_set_require_signature_confirmation(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env,
+ axis2_bool_t require_signature_confirmation);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_wss11_get_require_signature_confirmation(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_wss11_increment_ref(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_wss11_builder.h b/neethi/include/rp_wss11_builder.h
new file mode 100644
index 0000000..6e83a5c
--- /dev/null
+++ b/neethi/include/rp_wss11_builder.h
@@ -0,0 +1,45 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_WSS11_BUILDER_H
+#define RP_WSS11_BUILDER_H
+
+/** @defgroup rp_wss11_builder
+ * @ingroup rp_wss11_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_wss11.h>
+#include <neethi_includes.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ rp_wss11_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_x509_token.h b/neethi/include/rp_x509_token.h
new file mode 100644
index 0000000..7263a15
--- /dev/null
+++ b/neethi/include/rp_x509_token.h
@@ -0,0 +1,142 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_X509_TOKEN_H
+#define RP_X509_TOKEN_H
+
+/** @defgroup rp_x509_token
+ * @ingroup rp_x509_token
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_token.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ typedef struct rp_x509_token_t rp_x509_token_t;
+
+ AXIS2_EXTERN rp_x509_token_t *AXIS2_CALL
+ rp_x509_token_create(
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN void AXIS2_CALL
+ rp_x509_token_free(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_x509_token_get_inclusion(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_x509_token_set_inclusion(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env,
+ axis2_char_t * inclusion);
+
+ AXIS2_EXTERN derive_key_type_t AXIS2_CALL
+ rp_x509_token_get_derivedkey(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_x509_token_set_derivedkey(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env,
+ derive_key_type_t derivedkeys);
+
+ AXIS2_EXTERN derive_key_version_t AXIS2_CALL
+ rp_x509_token_get_derivedkey_version(
+ rp_x509_token_t *x509_token,
+ const axutil_env_t *env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_x509_token_set_derivedkey_version(
+ rp_x509_token_t *x509_token,
+ const axutil_env_t *env,
+ derive_key_version_t version);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_x509_token_get_require_key_identifier_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_x509_token_set_require_key_identifier_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env,
+ axis2_bool_t require_key_identifier_reference);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_x509_token_get_require_issuer_serial_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_x509_token_set_require_issuer_serial_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env,
+ axis2_bool_t require_issuer_serial_reference);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_x509_token_get_require_embedded_token_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_x509_token_set_require_embedded_token_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env,
+ axis2_bool_t require_embedded_token_reference);
+
+ AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+ rp_x509_token_get_require_thumb_print_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_x509_token_set_require_thumb_print_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env,
+ axis2_bool_t require_thumb_print_reference);
+
+ AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+ rp_x509_token_get_token_version_and_type(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_x509_token_set_token_version_and_type(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env,
+ axis2_char_t * token_version_and_type);
+
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ rp_x509_token_increment_ref(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/include/rp_x509_token_builder.h b/neethi/include/rp_x509_token_builder.h
new file mode 100644
index 0000000..ca5d11e
--- /dev/null
+++ b/neethi/include/rp_x509_token_builder.h
@@ -0,0 +1,45 @@
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RP_X509_TOKEN_BUILDER_H
+#define RP_X509_TOKEN_BUILDER_H
+
+/** @defgroup rp_x509_token_builder
+ * @ingroup rp_x509_token_builder
+ * @{
+ */
+
+#include <rp_includes.h>
+#include <rp_property.h>
+#include <rp_x509_token.h>
+#include <neethi_assertion.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+ AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+ rp_x509_token_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/neethi/src/Makefile.am b/neethi/src/Makefile.am
new file mode 100644
index 0000000..12bff83
--- /dev/null
+++ b/neethi/src/Makefile.am
@@ -0,0 +1,53 @@
+SUBDIRS = secpolicy rmpolicy
+lib_LTLIBRARIES=libneethi.la
+
+libneethi_la_SOURCES= all.c \
+ assertion.c \
+ engine.c \
+ exactlyone.c \
+ operator.c \
+ policy.c \
+ reference.c \
+ registry.c \
+ assertion_builder.c \
+ mtom_assertion_checker.c \
+ util.c
+
+libneethi_la_LIBADD = ../../axiom/src/om/libaxis2_axiom.la \
+ ../../util/src/libaxutil.la \
+ secpolicy/builder/librp_builder.la \
+ secpolicy/model/librp_model.la \
+ rmpolicy/librm_policy.la
+
+#libneethi_LIBADD=$(top_builddir)/src/core/description/libaxis2_description.la \
+# $(top_builddir)/src/core/receivers/libaxis2_receivers.la \
+# $(top_builddir)/src/core/deployment/libaxis2_deployment.la \
+# $(top_builddir)/src/core/context/libaxis2_context.la \
+# $(top_builddir)/src/core/addr/libaxis2_addr.la \
+# $(top_builddir)/src/core/clientapi/libaxis2_clientapi.la \
+# $(top_builddir)/src/core/phaseresolver/libaxis2_phaseresolver.la \
+# $(top_builddir)/src/core/util/libaxis2_core_utils.la \
+# $(top_builddir)/src/core/transport/http/common/libaxis2_http_common.la \
+# $(top_builddir)/src/core/transport/http/util/libaxis2_http_util.la \
+# $(top_builddir)/util/src/libaxutil.la \
+# $(top_builddir)/axiom/src/om/libaxis2_axiom.la
+
+
+libneethi_la_LDFLAGS = -version-info $(VERSION_NO)
+
+INCLUDES = -I$(top_builddir)/include \
+ -I ../../util/include \
+ -I ../../axiom/include \
+ -I ../../include
+
+# -I$(top_builddir)/src/wsdl \
+# -I$(top_builddir)/src/core/description \
+# -I$(top_builddir)/src/core/engine \
+# -I$(top_builddir)/src/core/phaseresolver \
+# -I$(top_builddir)/src/core/deployment \
+# -I$(top_builddir)/src/core/context \
+# -I$(top_builddir)/src/core/util \
+# -I$(top_builddir)/src/core/clientapi \
+# -I$(top_builddir)/util/include \
+# -I$(top_builddir)/axiom/include
+
diff --git a/neethi/src/all.c b/neethi/src/all.c
new file mode 100644
index 0000000..780cd3f
--- /dev/null
+++ b/neethi/src/all.c
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <neethi_all.h>
+
+struct neethi_all_t
+{
+ axutil_array_list_t *policy_components;
+};
+
+AXIS2_EXTERN neethi_all_t *AXIS2_CALL
+neethi_all_create(
+ const axutil_env_t *env)
+{
+ neethi_all_t *neethi_all = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ neethi_all = (neethi_all_t *)AXIS2_MALLOC(env->allocator, sizeof(neethi_all_t));
+
+ if(neethi_all == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ neethi_all->policy_components = NULL;
+
+ neethi_all->policy_components = axutil_array_list_create(env, 0);
+ if(!(neethi_all->policy_components))
+ {
+ neethi_all_free(neethi_all, env);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ return neethi_all;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+neethi_all_free(
+ neethi_all_t *neethi_all,
+ const axutil_env_t *env)
+{
+ if(neethi_all)
+ {
+ if(neethi_all->policy_components)
+ {
+ int i = 0;
+ int size = 0;
+
+ size = axutil_array_list_size(neethi_all->policy_components, env);
+
+ for(i = 0; i < size; i++)
+ {
+ neethi_operator_t *operator = NULL;
+ operator = (neethi_operator_t *)axutil_array_list_get(
+ neethi_all->policy_components, env, i);
+ if(operator)
+ {
+ neethi_operator_free(operator, env);
+ operator = NULL;
+ }
+ operator = NULL;
+ }
+ axutil_array_list_free(neethi_all->policy_components, env);
+ neethi_all->policy_components = NULL;
+ }
+ AXIS2_FREE(env->allocator, neethi_all);
+ neethi_all = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+neethi_all_get_policy_components(
+ neethi_all_t *neethi_all,
+ const axutil_env_t *env)
+{
+ return neethi_all->policy_components;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_all_add_policy_components(
+ neethi_all_t *all,
+ axutil_array_list_t *arraylist,
+ const axutil_env_t *env)
+{
+
+ int size = axutil_array_list_size(arraylist, env);
+ int i = 0;
+
+ if(axutil_array_list_ensure_capacity(all->policy_components, env, size + 1) != AXIS2_SUCCESS)
+ return AXIS2_FAILURE;
+
+ for(i = 0; i < size; i++)
+ {
+ void *value = NULL;
+ value = axutil_array_list_get(arraylist, env, i);
+ neethi_operator_increment_ref((neethi_operator_t *)value, env);
+ axutil_array_list_add(all->policy_components, env, value);
+ }
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_all_add_operator(
+ neethi_all_t *neethi_all,
+ const axutil_env_t *env,
+ neethi_operator_t *operator)
+{
+ neethi_operator_increment_ref(operator, env);
+ axutil_array_list_add(neethi_all->policy_components, env, operator);
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+neethi_all_is_empty(
+ neethi_all_t *all,
+ const axutil_env_t *env)
+{
+ return axutil_array_list_is_empty(all->policy_components, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_all_serialize(
+ neethi_all_t *neethi_all,
+ axiom_node_t *parent,
+ const axutil_env_t *env)
+{
+ axiom_node_t *all_node = NULL;
+ axiom_element_t *all_ele = NULL;
+ axiom_namespace_t *policy_ns = NULL;
+ axutil_array_list_t *components = NULL;
+
+ policy_ns = axiom_namespace_create(env, NEETHI_NAMESPACE, NEETHI_PREFIX);
+ all_ele = axiom_element_create(env, parent, NEETHI_ALL, policy_ns, &all_node);
+ if(!all_node)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Neethi 'all' node creation failed. Cannot serialize 'all' assertion");
+ return AXIS2_FAILURE;
+ }
+
+ components = neethi_all_get_policy_components(neethi_all, env);
+ if(components)
+ {
+ axis2_status_t status = AXIS2_FAILURE;
+ int i = 0;
+ for(i = 0; i < axutil_array_list_size(components, env); i++)
+ {
+ neethi_operator_t *operator = NULL;
+ operator = (neethi_operator_t *)axutil_array_list_get(components, env, i);
+ if(operator)
+ {
+ status = neethi_operator_serialize(operator, env, all_node);
+ if(status != AXIS2_SUCCESS)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Neethi operator serialization failed. Cannot serialize 'all' assertion");
+ return AXIS2_FAILURE;
+ }
+ }
+ }
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/assertion.c b/neethi/src/assertion.c
new file mode 100644
index 0000000..29c70be
--- /dev/null
+++ b/neethi/src/assertion.c
@@ -0,0 +1,424 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <neethi_assertion.h>
+#include <axiom_util.h>
+#include <rp_x509_token.h>
+#include <rp_property.h>
+#include <rp_layout.h>
+#include <rp_algorithmsuite.h>
+#include <rp_wss10.h>
+#include <rp_wss11.h>
+#include <rp_trust10.h>
+#include <rp_supporting_tokens.h>
+#include <rp_username_token.h>
+#include <rp_asymmetric_binding.h>
+#include <rp_rampart_config.h>
+#include <rp_signed_encrypted_parts.h>
+#include <rp_symmetric_binding.h>
+#include <rp_transport_binding.h>
+#include <rp_saml_token.h>
+#include <rp_issued_token.h>
+
+struct neethi_assertion_t
+{
+ void *value;
+ neethi_assertion_type_t type;
+ axutil_array_list_t *policy_components;
+ axiom_element_t *element;
+ axiom_node_t *node;
+ axis2_bool_t is_optional;
+ AXIS2_FREE_VOID_ARG free_func;
+};
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+neethi_assertion_create(
+ const axutil_env_t *env)
+{
+ neethi_assertion_t *neethi_assertion = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ neethi_assertion = (neethi_assertion_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(neethi_assertion_t));
+
+ if(neethi_assertion == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ neethi_assertion->policy_components = NULL;
+
+ neethi_assertion->policy_components = axutil_array_list_create(env, 0);
+ if(!(neethi_assertion->policy_components))
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ neethi_assertion->value = NULL;
+ neethi_assertion->type = ASSERTION_TYPE_UNKNOWN;
+ neethi_assertion->element = NULL;
+ neethi_assertion->is_optional = AXIS2_FALSE;
+ neethi_assertion->node = NULL;
+ neethi_assertion->free_func = 0;
+
+ return neethi_assertion;
+}
+
+neethi_assertion_t *AXIS2_CALL
+neethi_assertion_create_with_args(
+ const axutil_env_t *env,
+ AXIS2_FREE_VOID_ARG free_func,
+ void *value,
+ neethi_assertion_type_t type)
+{
+ neethi_assertion_t *neethi_assertion = NULL;
+ neethi_assertion = (neethi_assertion_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(neethi_assertion_t));
+
+ if(!neethi_assertion)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Neethi assertion creation failed. Out of memory");
+ return NULL;
+ }
+
+ neethi_assertion->policy_components = NULL;
+ neethi_assertion->policy_components = axutil_array_list_create(env, 0);
+ if(!(neethi_assertion->policy_components))
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Neethi assertion policy components creation failed.");
+ return NULL;
+ }
+
+ /* This ref count is for asertions which are represented from a struct.
+ * These assertion structs are more probably referenced from some other
+ * struct. So we need to increment the ref count in order to prevent
+ * unnecessary memory freeing */
+
+ if(type == ASSERTION_TYPE_X509_TOKEN)
+ {
+ rp_x509_token_increment_ref((rp_x509_token_t *)value, env);
+ }
+ else if(type == ASSERTION_TYPE_SECURITY_CONTEXT_TOKEN)
+ {
+ rp_security_context_token_increment_ref((rp_security_context_token_t *)value, env);
+ }
+ else if(type == ASSERTION_TYPE_INITIATOR_TOKEN)
+ {
+ rp_property_increment_ref((rp_property_t *)value, env);
+ }
+ else if(type == ASSERTION_TYPE_RECIPIENT_TOKEN)
+ {
+ rp_property_increment_ref((rp_property_t *)value, env);
+ }
+ else if(type == ASSERTION_TYPE_PROTECTION_TOKEN)
+ {
+ rp_property_increment_ref((rp_property_t *)value, env);
+ }
+ else if(type == ASSERTION_TYPE_ENCRYPTION_TOKEN)
+ {
+ rp_property_increment_ref((rp_property_t *)value, env);
+ }
+ else if(type == ASSERTION_TYPE_TRANSPORT_TOKEN)
+ {
+ rp_property_increment_ref((rp_property_t *)value, env);
+ }
+ else if(type == ASSERTION_TYPE_SIGNATURE_TOKEN)
+ {
+ rp_property_increment_ref((rp_property_t *)value, env);
+ }
+ else if(type == ASSERTION_TYPE_LAYOUT)
+ {
+ rp_layout_increment_ref((rp_layout_t *)value, env);
+ }
+ else if(type == ASSERTION_TYPE_ALGORITHM_SUITE)
+ {
+ rp_algorithmsuite_increment_ref((rp_algorithmsuite_t *)value, env);
+ }
+ else if(type == ASSERTION_TYPE_WSS10)
+ {
+ rp_wss10_increment_ref((rp_wss10_t *)value, env);
+ }
+ else if(type == ASSERTION_TYPE_WSS11)
+ {
+ rp_wss11_increment_ref((rp_wss11_t *)value, env);
+ }
+ else if(type == ASSERTION_TYPE_TRUST10)
+ {
+ rp_trust10_increment_ref((rp_trust10_t *)value, env);
+ }
+ else if(type == ASSERTION_TYPE_SUPPORTING_TOKENS)
+ {
+ rp_supporting_tokens_increment_ref((rp_supporting_tokens_t *)value, env);
+ }
+ else if(type == ASSERTION_TYPE_USERNAME_TOKEN)
+ {
+ rp_username_token_increment_ref((rp_username_token_t *)value, env);
+ }
+ else if(type == ASSERTION_TYPE_ASSYMMETRIC_BINDING)
+ {
+ rp_asymmetric_binding_increment_ref((rp_asymmetric_binding_t *)value, env);
+ }
+ else if(type == ASSERTION_TYPE_SYMMETRIC_BINDING)
+ {
+ rp_symmetric_binding_increment_ref((rp_symmetric_binding_t *)value, env);
+ }
+ else if(type == ASSERTION_TYPE_TRANSPORT_BINDING)
+ {
+ rp_transport_binding_increment_ref((rp_transport_binding_t *)value, env);
+ }
+ else if(type == ASSERTION_TYPE_SIGNED_ENCRYPTED_PARTS)
+ {
+ rp_signed_encrypted_parts_increment_ref((rp_signed_encrypted_parts_t *)value, env);
+ }
+ else if(type == ASSERTION_TYPE_RAMPART_CONFIG)
+ {
+ rp_rampart_config_increment_ref((rp_rampart_config_t *)value, env);
+ }
+ else if(type == ASSERTION_TYPE_ISSUED_TOKEN)
+ {
+ rp_issued_token_increment_ref((rp_issued_token_t *)value, env);
+ }
+ else if(type == ASSERTION_TYPE_SAML_TOKEN)
+ {
+ rp_saml_token_increment_ref((rp_saml_token_t *)value, env);
+ }
+
+ neethi_assertion->value = value;
+ neethi_assertion->type = type;
+ neethi_assertion->element = NULL;
+ neethi_assertion->is_optional = AXIS2_FALSE;
+ neethi_assertion->node = NULL;
+ neethi_assertion->free_func = free_func;
+
+ return neethi_assertion;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+neethi_assertion_free(
+ neethi_assertion_t *neethi_assertion,
+ const axutil_env_t *env)
+{
+ if(neethi_assertion)
+ {
+ if(neethi_assertion->policy_components)
+ {
+ int i = 0;
+ for(i = 0; i < axutil_array_list_size(neethi_assertion->policy_components, env); i++)
+ {
+ neethi_operator_t *operator = NULL;
+ operator = (neethi_operator_t *)axutil_array_list_get(
+ neethi_assertion->policy_components, env, i);
+ if(operator)
+ neethi_operator_free(operator, env);
+
+ operator = NULL;
+ }
+ axutil_array_list_free(neethi_assertion->policy_components, env);
+ neethi_assertion->policy_components = NULL;
+ }
+ if(neethi_assertion->value)
+ {
+ if(neethi_assertion->free_func)
+ {
+ neethi_assertion->free_func(neethi_assertion->value, env);
+ }
+ }
+ AXIS2_FREE(env->allocator, neethi_assertion);
+ neethi_assertion = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN neethi_assertion_type_t AXIS2_CALL
+neethi_assertion_get_type(
+ neethi_assertion_t *neethi_assertion,
+ const axutil_env_t *env)
+{
+ return neethi_assertion->type;
+}
+
+AXIS2_EXTERN void *AXIS2_CALL
+neethi_assertion_get_value(
+ neethi_assertion_t *neethi_assertion,
+ const axutil_env_t *env)
+{
+ return neethi_assertion->value;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_assertion_set_value(
+ neethi_assertion_t *neethi_assertion,
+ const axutil_env_t *env,
+ void *value,
+ neethi_assertion_type_t type)
+{
+ neethi_assertion->type = type;
+ if(type == ASSERTION_TYPE_X509_TOKEN)
+ {
+ rp_x509_token_increment_ref((rp_x509_token_t *)value, env);
+ }
+ neethi_assertion->value = (void *)value;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axiom_element_t *AXIS2_CALL
+neethi_assertion_get_element(
+ neethi_assertion_t *neethi_assertion,
+ const axutil_env_t *env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return neethi_assertion->element;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_assertion_set_element(
+ neethi_assertion_t *neethi_assertion,
+ const axutil_env_t *env,
+ axiom_element_t *element)
+{
+ neethi_assertion->element = element;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+neethi_assertion_get_node(
+ neethi_assertion_t *neethi_assertion,
+ const axutil_env_t *env)
+{
+ return neethi_assertion->node;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_assertion_set_node(
+ neethi_assertion_t *neethi_assertion,
+ const axutil_env_t *env,
+ axiom_node_t * node)
+{
+ if(neethi_assertion->node)
+ {
+ axiom_node_free_tree(neethi_assertion->node, env);
+ neethi_assertion->node = NULL;
+ }
+
+ if(node)
+ {
+ neethi_assertion->node = axiom_util_clone_node(env, node);
+ }
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+neethi_assertion_get_is_optional(
+ neethi_assertion_t *neethi_assertion,
+ const axutil_env_t *env)
+{
+ return neethi_assertion->is_optional;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_assertion_set_is_optional(
+ neethi_assertion_t *neethi_assertion,
+ const axutil_env_t *env,
+ axis2_bool_t is_optional)
+{
+ neethi_assertion->is_optional = is_optional;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+neethi_assertion_get_policy_components(
+ neethi_assertion_t *neethi_assertion,
+ const axutil_env_t *env)
+{
+ return neethi_assertion->policy_components;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_assertion_add_policy_components(
+ neethi_assertion_t *neethi_assertion,
+ axutil_array_list_t *arraylist,
+ const axutil_env_t *env)
+{
+
+ int size = axutil_array_list_size(arraylist, env);
+ int i = 0;
+
+ if(axutil_array_list_ensure_capacity(neethi_assertion->policy_components, env, size + 1)
+ != AXIS2_SUCCESS)
+ return AXIS2_FAILURE;
+
+ for(i = 0; i < size; i++)
+ {
+ void *value = NULL;
+ value = axutil_array_list_get(arraylist, env, i);
+ neethi_operator_increment_ref((neethi_operator_t *)value, env);
+ axutil_array_list_add(neethi_assertion->policy_components, env, value);
+ }
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_assertion_add_operator(
+ neethi_assertion_t *neethi_assertion,
+ const axutil_env_t *env,
+ neethi_operator_t *operator)
+{
+ neethi_operator_increment_ref(operator, env);
+ axutil_array_list_add(neethi_assertion->policy_components, env, operator);
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+neethi_assertion_is_empty(
+ neethi_assertion_t *neethi_assertion,
+ const axutil_env_t *env)
+{
+ return axutil_array_list_is_empty(neethi_assertion->policy_components, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_assertion_serialize(
+ neethi_assertion_t *assertion,
+ axiom_node_t *parent,
+ const axutil_env_t *env)
+{
+ axiom_node_t *node = NULL;
+ if(assertion->node)
+ {
+ node = axiom_util_clone_node(env, assertion->node);
+ }
+
+ if(!node)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "assertion node creation failed. Cannot serialize assertion");
+ return AXIS2_FAILURE;
+ }
+
+ axiom_node_add_child(parent, env, node);
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/assertion_builder.c b/neethi/src/assertion_builder.c
new file mode 100644
index 0000000..e6f4064
--- /dev/null
+++ b/neethi/src/assertion_builder.c
@@ -0,0 +1,513 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <neethi_assertion_builder.h>
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+neethi_assertion_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ axis2_char_t *localname = NULL;
+ axis2_char_t *ns = NULL;
+ axutil_qname_t *node_qname = NULL;
+
+ localname = axiom_element_get_localname(element, env);
+ if(!localname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Cannot get localname from element.");
+ return NULL;
+ }
+
+ node_qname = axiom_element_get_qname(element, env, node);
+ if(!node_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Cannot get qname from element %s.",
+ localname);
+ return NULL;
+ }
+
+ ns = axutil_qname_get_uri(node_qname, env);
+ if(!ns)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Cannot get namespace from element %s.",
+ localname);
+ return NULL;
+ }
+
+ if(!(axutil_strcmp(ns, RP_SP_NS_11) && axutil_strcmp(ns, RP_SP_NS_12)))
+ {
+ /* if namespace is WS-SecurityPolicy Namespace */
+ if(!axutil_strcmp(localname, RP_TRANSPORT_BINDING))
+ {
+ return rp_transport_binding_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_ASYMMETRIC_BINDING))
+ {
+ return rp_asymmetric_binding_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_SYMMETRIC_BINDING))
+ {
+ return rp_symmetric_binding_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_TRANSPORT_TOKEN))
+ {
+ return rp_transport_token_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_RECIPIENT_TOKEN))
+ {
+ return rp_recipient_token_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_INITIATOR_TOKEN))
+ {
+ return rp_initiator_token_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_PROTECTION_TOKEN))
+ {
+ return rp_protection_token_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_ENCRYPTION_TOKEN))
+ {
+ return rp_encryption_token_builder_build(env, node, element);
+ }
+
+ else if(!axutil_strcmp(localname, RP_SIGNATURE_TOKEN))
+ {
+ return rp_signature_token_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_X509_TOKEN))
+ {
+ return rp_x509_token_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_SECURITY_CONTEXT_TOKEN))
+ {
+ return rp_security_context_token_builder_build(env, node, element, ns, AXIS2_FALSE);
+ }
+ else if(!axutil_strcmp(localname, RP_SECURE_CONVERSATION_TOKEN))
+ {
+ return rp_security_context_token_builder_build(env, node, element, ns, AXIS2_TRUE);
+ }
+ else if(!axutil_strcmp(localname, RP_ENCRYPT_BEFORE_SIGNING))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_ENCRYPT_BEFORE_SIGNING);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_SIGN_BEFORE_ENCRYPTING))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_SIGN_BEFORE_ENCRYPTING);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_ENCRYPT_SIGNATURE))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_ENCRYPT_SIGNATURE);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_PROTECT_TOKENS))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_PROTECT_TOKENS);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_ONLY_SIGN_ENTIRE_HEADERS_AND_BODY))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_ONLY_SIGN_ENTIRE_HEADERS_AND_BODY);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_REQUIRE_KEY_IDENTIFIRE_REFERENCE))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_REQUIRE_KEY_IDENTIFIRE_REFERENCE);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_REQUIRE_ISSUER_SERIAL_REFERENCE))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_REQUIRE_ISSUER_SERIAL_REFERENCE);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_REQUIRE_EMBEDDED_TOKEN_REFERENCE))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_REQUIRE_EMBEDDED_TOKEN_REFERENCE);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_REQUIRE_THUMBPRINT_REFERENCE))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_REQUIRE_THUMBPRINT_REFERENCE);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_WSS_X509_V1_TOKEN_10))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_WSS_X509_V1_TOKEN_10);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_WSS_X509_V3_TOKEN_10))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_WSS_X509_V3_TOKEN_10);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_ALGORITHM_SUITE))
+ {
+ return rp_algorithmsuite_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_LAYOUT))
+ {
+ return rp_layout_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_USERNAME_TOKEN))
+ {
+ return rp_username_token_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_SIGNED_SUPPORTING_TOKENS))
+ {
+ return rp_supporting_tokens_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_SUPPORTING_TOKENS))
+ {
+ return rp_supporting_tokens_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_ENDORSING_SUPPORTING_TOKENS))
+ {
+ return rp_supporting_tokens_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_SIGNED_ENDORSING_SUPPORTING_TOKENS))
+ {
+ return rp_supporting_tokens_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_WSS10))
+ {
+ return rp_wss10_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_WSS11))
+ {
+ return rp_wss11_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_TRUST10))
+ {
+ return rp_trust10_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_TRUST13))
+ {
+ /* we can still use rp_trust10 structures */
+ return rp_trust10_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_INCLUDE_TIMESTAMP))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_INCLUDE_TIMESTAMP);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_HTTPS_TOKEN))
+ {
+ return rp_https_token_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_WSS_USERNAME_TOKEN_10))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_WSS_USERNAME_TOKEN_10);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_WSS_USERNAME_TOKEN_11))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_WSS_USERNAME_TOKEN_11);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_MUST_SUPPORT_REF_KEY_IDENTIFIER))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_MUST_SUPPORT_REF_KEY_IDENTIFIER);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_MUST_SUPPORT_REF_ISSUER_SERIAL))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_MUST_SUPPORT_REF_ISSUER_SERIAL);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_MUST_SUPPORT_REF_EXTERNAL_URI))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_MUST_SUPPORT_REF_EXTERNAL_URI);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_MUST_SUPPORT_REF_EMBEDDED_TOKEN))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_MUST_SUPPORT_REF_EMBEDDED_TOKEN);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_SIGNED_PARTS))
+ {
+ return rp_signed_encrypted_parts_builder_build(env, node, element, AXIS2_TRUE);
+ }
+ else if(!axutil_strcmp(localname, RP_ENCRYPTED_PARTS))
+ {
+ return rp_signed_encrypted_parts_builder_build(env, node, element, AXIS2_FALSE);
+ }
+ else if(!axutil_strcmp(localname, RP_BOOTSTRAP_POLICY))
+ {
+ return rp_bootstrap_policy_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_MUST_SUPPORT_REF_THUMBPRINT))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_MUST_SUPPORT_REF_THUMBPRINT);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_MUST_SUPPORT_REF_ENCRYPTED_KEY))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_MUST_SUPPORT_REF_ENCRYPTED_KEY);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_REQUIRE_SIGNATURE_CONFIRMATION))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_REQUIRE_SIGNATURE_CONFIRMATION);
+ return assertion;
+ }
+
+ else if(!axutil_strcmp(localname, RP_MUST_SUPPORT_CLIENT_CHALLENGE))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_MUST_SUPPORT_CLIENT_CHALLENGE);
+ return assertion;
+ }
+
+ else if(!axutil_strcmp(localname, RP_MUST_SUPPORT_SERVER_CHALLENGE))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_MUST_SUPPORT_SERVER_CHALLENGE);
+ return assertion;
+ }
+
+ else if(!axutil_strcmp(localname, RP_REQUIRE_CLIENT_ENTROPY))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_REQUIRE_CLIENT_ENTROPY);
+ return assertion;
+ }
+
+ else if(!axutil_strcmp(localname, RP_REQUIRE_SERVER_ENTROPHY))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_REQUIRE_SERVER_ENTROPHY);
+ return assertion;
+ }
+
+ else if(!axutil_strcmp(localname, RP_MUST_SUPPORT_ISSUED_TOKENS))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_MUST_SUPPORT_ISSUED_TOKENS);
+ return assertion;
+ }
+
+ else if(!axutil_strcmp(localname, RP_REQUIRE_DERIVED_KEYS))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ if(!axutil_strcmp(ns, RP_SP_NS_11))
+ {
+ /* derived key should be as defined in WS-SecConversation 1.0 */
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_REQUIRE_DERIVED_KEYS_SC10);
+ }
+ else
+ {
+ /* derived key should be as defined in WS-SecConversation 1.3 */
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_REQUIRE_DERIVED_KEYS_SC13);
+ }
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_REQUIRE_EXTERNAL_URI_REFERENCE))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_REQUIRE_EXTERNAL_URI);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_SC10_SECURITY_CONTEXT_TOKEN))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_SC10_SECURITY_CONTEXT_TOKEN);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_SC13_SECURITY_CONTEXT_TOKEN))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_SC13_SECURITY_CONTEXT_TOKEN);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_ISSUER))
+ {
+ neethi_assertion_t *assertion = NULL;
+ axis2_char_t *issuer = NULL;
+
+ issuer = axiom_element_get_text(element, env, node);
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, issuer, ASSERTION_TYPE_ISSUER);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_REQUIRE_EXTERNAL_REFERENCE))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_REQUIRE_EXTERNAL_REFERENCE);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_REQUIRE_INTERNAL_REFERENCE))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_REQUIRE_INTERNAL_REFERENCE);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_ISSUED_TOKEN))
+ {
+ return rp_issued_token_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_SAML_TOKEN))
+ {
+ return rp_saml_token_builder_build(env, node, element);
+ }
+ else if(!axutil_strcmp(localname, RP_WSS_SAML_V10_TOKEN_V10))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_WSS_SAML_V10_TOKEN_V10);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_WSS_SAML_V10_TOKEN_V11))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_WSS_SAML_V10_TOKEN_V11);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_WSS_SAML_V11_TOKEN_V10))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_WSS_SAML_V11_TOKEN_V10);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_WSS_SAML_V11_TOKEN_V11))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_WSS_SAML_V11_TOKEN_V11);
+ return assertion;
+ }
+ else if(!axutil_strcmp(localname, RP_WSS_SAML_V20_TOKEN_V11))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL, ASSERTION_TYPE_WSS_SAML_V20_TOKEN_V11);
+ return assertion;
+ }
+ }
+ else if(!axutil_strcmp(ns, RP_RAMPART_NS))
+ {
+ /* if namespace is Rampart Namespace */
+ if(!axutil_strcmp(localname, RP_RAMPART_CONFIG))
+ {
+ return rp_rampart_config_builder_build(env, node, element);
+ }
+ }
+ else if(!axutil_strcmp(ns, AXIS2_MTOM_POLICY_NS))
+ {
+ if(!axutil_strcmp(localname, AXIS2_OPTIMIZED_MIME_SERIALIZATION))
+ {
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, NULL,
+ ASSERTION_TYPE_OPTIMIZED_MIME_SERIALIZATION);
+ return assertion;
+ }
+ }
+ else if((!axutil_strcmp(ns, AXIS2_RM_POLICY_10_NS)) || (!axutil_strcmp(ns,
+ AXIS2_RM_POLICY_11_NS)))
+ {
+ if(!axutil_strcmp(localname, AXIS2_RM_RMASSERTION))
+ {
+ return axis2_rm_assertion_builder_build(env, node, element);
+ }
+ }
+
+ /* This assertion cannot be processed */
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NEETHI_UNKNOWN_ASSERTION, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Unknown Assertion %s with namespace %s",
+ localname, ns);
+ return NULL;
+}
diff --git a/neethi/src/engine.c b/neethi/src/engine.c
new file mode 100644
index 0000000..b925cea
--- /dev/null
+++ b/neethi/src/engine.c
@@ -0,0 +1,1390 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <neethi_engine.h>
+#include <neethi_assertion_builder.h>
+#include <axiom_attribute.h>
+
+/*Private functions*/
+
+static neethi_all_t *
+neethi_engine_get_operator_all(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element);
+
+static neethi_exactlyone_t *
+neethi_engine_get_operator_exactlyone(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element);
+
+static neethi_reference_t *
+neethi_engine_get_operator_reference(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element);
+
+static neethi_policy_t *
+neethi_engine_get_operator_neethi_policy(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element);
+
+static axis2_status_t
+neethi_engine_process_operation_element(
+ const axutil_env_t *env,
+ neethi_operator_t *neethi_operator,
+ axiom_node_t *node,
+ axiom_element_t *element);
+
+static axis2_status_t
+neethi_engine_add_policy_component(
+ const axutil_env_t *env,
+ neethi_operator_t *container_operator,
+ neethi_operator_t *component);
+
+static axis2_bool_t
+neethi_engine_operator_is_empty(
+ neethi_operator_t *operator,
+ const axutil_env_t *env);
+
+static neethi_exactlyone_t *
+neethi_engine_compute_resultant_component(
+ axutil_array_list_t *normalized_inner_components,
+ neethi_operator_type_t type,
+ const axutil_env_t *env);
+
+static axutil_array_list_t *
+neethi_engine_operator_get_components(
+ neethi_operator_t *operator,
+ const axutil_env_t *env);
+
+static neethi_exactlyone_t *
+neethi_engine_normalize_operator(
+ neethi_operator_t *operator,
+ neethi_registry_t *registry,
+ axis2_bool_t deep,
+ const axutil_env_t *env);
+
+static neethi_exactlyone_t *
+neethi_engine_get_cross_product(
+ neethi_exactlyone_t *exactlyone1,
+ neethi_exactlyone_t *exactlyone2,
+ const axutil_env_t *env);
+
+static void
+neethi_engine_clear_element_attributes(
+ axutil_hash_t *attr_hash,
+ const axutil_env_t *env);
+
+/*Implementations*/
+
+/*This is the function which is called from outside*/
+
+AXIS2_EXTERN neethi_policy_t *AXIS2_CALL
+neethi_engine_get_policy(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ /* This function will be called recursively */
+
+ return neethi_engine_get_operator_neethi_policy(env, node, element);
+}
+
+static neethi_all_t *
+neethi_engine_get_operator_all(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ neethi_all_t *all = NULL;
+ neethi_operator_t *neethi_operator = NULL;
+ axis2_status_t status = AXIS2_SUCCESS;
+ all = neethi_all_create(env);
+
+ if(!all)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ neethi_operator = neethi_operator_create(env);
+ if(!neethi_operator)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ neethi_operator_set_value(neethi_operator, env, all, OPERATOR_TYPE_ALL);
+
+ status = neethi_engine_process_operation_element(env, neethi_operator, node, element);
+
+ neethi_operator_set_value_null(neethi_operator, env);
+ neethi_operator_free(neethi_operator, env);
+ neethi_operator = NULL;
+
+ if(status != AXIS2_SUCCESS)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NEETHI_ALL_CREATION_FAILED, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] All creation failed");
+ neethi_all_free(all, env);
+ all = NULL;
+ return NULL;
+ }
+ return all;
+}
+
+static neethi_exactlyone_t *
+neethi_engine_get_operator_exactlyone(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ neethi_exactlyone_t *exactlyone = NULL;
+ neethi_operator_t *neethi_operator = NULL;
+ axis2_status_t status = AXIS2_SUCCESS;
+
+ exactlyone = neethi_exactlyone_create(env);
+
+ if(!exactlyone)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+
+ return NULL;
+ }
+ neethi_operator = neethi_operator_create(env);
+ if(!neethi_operator)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+
+ return NULL;
+ }
+ neethi_operator_set_value(neethi_operator, env, exactlyone, OPERATOR_TYPE_EXACTLYONE);
+ status = neethi_engine_process_operation_element(env, neethi_operator, node, element);
+
+ neethi_operator_set_value_null(neethi_operator, env);
+ neethi_operator_free(neethi_operator, env);
+ neethi_operator = NULL;
+
+ if(status != AXIS2_SUCCESS)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NEETHI_EXACTLYONE_CREATION_FAILED, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Exactlyone creation failed.");
+ neethi_exactlyone_free(exactlyone, env);
+ exactlyone = NULL;
+ return NULL;
+ }
+
+ return exactlyone;
+}
+
+neethi_reference_t *
+neethi_engine_get_operator_reference(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ neethi_reference_t *reference = NULL;
+ axutil_qname_t *qname = NULL;
+ axis2_char_t *attribute_value = NULL;
+
+ reference = neethi_reference_create(env);
+
+ if(!reference)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+
+ return NULL;
+ }
+ qname = axutil_qname_create(env, NEETHI_URI, NULL, NULL);
+
+ if(!qname)
+ {
+ return NULL;
+ }
+
+ attribute_value = axiom_element_get_attribute_value(element, env, qname);
+ if(attribute_value)
+ {
+ neethi_reference_set_uri(reference, env, attribute_value);
+ }
+ return reference;
+}
+
+/* This function will be called when we encounter a wsp:Policy
+ * element */
+
+static neethi_policy_t *
+neethi_engine_get_operator_neethi_policy(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ neethi_policy_t *neethi_policy = NULL;
+ neethi_operator_t *neethi_operator = NULL;
+ axis2_status_t status = AXIS2_SUCCESS;
+
+ /* Creates a policy struct */
+
+ neethi_policy = neethi_policy_create(env);
+
+ if(!neethi_policy)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+
+ /* Then we wrap it in a neethi_operator */
+
+ neethi_operator = neethi_operator_create(env);
+ if(!neethi_operator)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ neethi_operator_set_value(neethi_operator, env, neethi_policy, OPERATOR_TYPE_POLICY);
+
+ /* This function will do all the processing and build the
+ * policy object model */
+
+ status = neethi_engine_process_operation_element(env, neethi_operator, node, element);
+
+ /* To prevent freeing the policy object from the operator
+ * we set it to null. This object will be freed from a parent
+ * or from an outsider who creates a policy object */
+
+ neethi_operator_set_value_null(neethi_operator, env);
+ neethi_operator_free(neethi_operator, env);
+ neethi_operator = NULL;
+
+ if(status != AXIS2_SUCCESS)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NEETHI_POLICY_CREATION_FAILED, AXIS2_FAILURE);
+
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Policy creation failed.");
+ neethi_policy_free(neethi_policy, env);
+ neethi_policy = NULL;
+ return NULL;
+ }
+ return neethi_policy;
+}
+
+/* This function will construct the policy objecy model by
+ * filling the component array_list inside the passing
+ * policy operator */
+
+static axis2_status_t
+neethi_engine_process_operation_element(
+ const axutil_env_t *env,
+ neethi_operator_t *neethi_operator,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+
+ neethi_operator_type_t type;
+ axiom_element_t *child_element = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_children_iterator_t *children_iter = NULL;
+ void *value = NULL;
+
+ type = neethi_operator_get_type(neethi_operator, env);
+ value = neethi_operator_get_value(neethi_operator, env);
+
+ if(type == OPERATOR_TYPE_POLICY)
+ {
+ /* wsp:Policy element can have any number of attributes
+ * we will store them in a hash from the uri and localname */
+
+ axutil_hash_t *attributes = axiom_element_extract_attributes(element, env, node);
+
+ if(attributes)
+ {
+ axutil_hash_index_t *hi = NULL;
+
+ /* When creating the policy object we created the hash */
+
+ axutil_hash_t *ht = neethi_policy_get_attributes((neethi_policy_t *)value, env);
+
+ if(!ht)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Policy hash map creation failed.");
+ return AXIS2_FAILURE;
+ }
+
+ for(hi = axutil_hash_first(attributes, env); hi; hi = axutil_hash_next(env, hi))
+ {
+ axis2_char_t *key = NULL;
+ void *val = NULL;
+ axutil_qname_t *qname = NULL;
+ axis2_char_t *attr_val = NULL;
+ axiom_namespace_t *ns = NULL;
+ axis2_char_t *ns_uri = NULL;
+ axiom_attribute_t *om_attr = NULL;
+
+ axutil_hash_this(hi, NULL, NULL, &val);
+ if(val)
+ {
+ om_attr = (axiom_attribute_t *)val;
+ ns = axiom_attribute_get_namespace(om_attr, env);
+ if(ns)
+ {
+ ns_uri = axiom_namespace_get_uri(ns, env);
+ }
+
+ qname = axutil_qname_create(env, axiom_attribute_get_localname(om_attr, env),
+ ns_uri, NULL);
+ if(qname)
+ {
+ key = axutil_qname_to_string(qname, env);
+ if(key)
+ {
+ attr_val = axiom_attribute_get_value(om_attr, env);
+ if(attr_val)
+ {
+ /* axutil_qname_free will free the returned key
+ * of the qname so will duplicate it when storing */
+
+ axutil_hash_set(ht, axutil_strdup(env, key), AXIS2_HASH_KEY_STRING,
+ axutil_strdup(env, attr_val));
+ }
+ }
+ axutil_qname_free(qname, env);
+ }
+ }
+ }
+ /* axiom_element_extract_attributes method will always returns
+ * a cloned copy, so we need to free it after we have done with it */
+
+ neethi_engine_clear_element_attributes(attributes, env);
+ attributes = NULL;
+ }
+ }
+
+ children_iter = axiom_element_get_children(element, env, node);
+ if(children_iter)
+ {
+ while(axiom_children_iterator_has_next(children_iter, env))
+ {
+ /* Extract the element and check the namespace. If the namespace
+ * is in ws_policy then we call the relevent operator builder
+ * otherwise we will call the assertion_builder */
+
+ child_node = axiom_children_iterator_next(children_iter, env);
+ if(child_node)
+ {
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ axiom_namespace_t *namespace = NULL;
+ axis2_char_t *uri = NULL;
+ axis2_char_t *local_name = NULL;
+ neethi_operator_t *operator = NULL;
+ local_name = axiom_element_get_localname(child_element, env);
+
+ namespace = axiom_element_get_namespace(child_element, env, child_node);
+ if(!namespace)
+ {
+ AXIS2_ERROR_SET(env->error,
+ AXIS2_ERROR_NEETHI_ELEMENT_WITH_NO_NAMESPACE, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Element with no namespace");
+ return AXIS2_FAILURE;
+ }
+ uri = axiom_namespace_get_uri(namespace, env);
+ if(!uri)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_EMPTY_NAMESPACE_URI,
+ AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Invalid Empty namespace uri.");
+ return AXIS2_FAILURE;
+ }
+ if((axutil_strcmp(uri, NEETHI_NAMESPACE) == 0) || (axutil_strcmp(uri,
+ NEETHI_POLICY_15_NAMESPACE) == 0))
+ {
+ /* Looking at the localname we will call the relevent
+ * operator function. After that the newly created
+ * object is wrapped in a neethi_operator and stored in
+ * the parent's component list */
+
+ if(axutil_strcmp(local_name, NEETHI_POLICY) == 0)
+ {
+ neethi_policy_t *neethi_policy = NULL;
+ neethi_policy = neethi_engine_get_operator_neethi_policy(env,
+ child_node, child_element);
+ if(neethi_policy)
+ {
+ operator = neethi_operator_create(env);
+ neethi_operator_set_value(operator, env, neethi_policy,
+ OPERATOR_TYPE_POLICY);
+ neethi_engine_add_policy_component(env, neethi_operator,
+ operator);
+ }
+ else
+ {
+ AXIS2_ERROR_SET(env->error,
+ AXIS2_ERROR_NEETHI_POLICY_CREATION_FAILED_FROM_ELEMENT,
+ AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Policy creation failed from element.");
+ return AXIS2_FAILURE;
+ }
+ }
+ else if(axutil_strcmp(local_name, NEETHI_ALL) == 0)
+ {
+ neethi_all_t *all = NULL;
+ all
+ = neethi_engine_get_operator_all(env, child_node, child_element);
+ if(all)
+ {
+ operator = neethi_operator_create(env);
+ neethi_operator_set_value(operator, env, all, OPERATOR_TYPE_ALL);
+ neethi_engine_add_policy_component(env, neethi_operator,
+ operator);
+ }
+ else
+ {
+ AXIS2_ERROR_SET(env->error,
+ AXIS2_ERROR_NEETHI_ALL_CREATION_FAILED_FROM_ELEMENT,
+ AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] All creation failed from element.");
+ return AXIS2_FAILURE;
+ }
+ }
+ else if(axutil_strcmp(local_name, NEETHI_EXACTLYONE) == 0)
+ {
+ neethi_exactlyone_t *exactlyone = NULL;
+ exactlyone = neethi_engine_get_operator_exactlyone(env, child_node,
+ child_element);
+ if(exactlyone)
+ {
+ operator = neethi_operator_create(env);
+ neethi_operator_set_value(operator, env, exactlyone,
+ OPERATOR_TYPE_EXACTLYONE);
+ neethi_engine_add_policy_component(env, neethi_operator,
+ operator);
+ }
+ else
+ {
+ AXIS2_ERROR_SET(env->error,
+ AXIS2_ERROR_NEETHI_EXACTLYONE_CREATION_FAILED_FROM_ELEMENT,
+ AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Exactlyone creation failed from element.");
+ return AXIS2_FAILURE;
+ }
+ }
+ else if(axutil_strcmp(local_name, NEETHI_REFERENCE) == 0)
+ {
+ neethi_reference_t *reference = NULL;
+ reference = neethi_engine_get_operator_reference(env, child_node,
+ child_element);
+ if(reference)
+ {
+ operator = neethi_operator_create(env);
+ neethi_operator_set_value(operator, env, reference,
+ OPERATOR_TYPE_REFERENCE);
+ neethi_engine_add_policy_component(env, neethi_operator,
+ operator);
+ }
+ else
+ {
+ AXIS2_ERROR_SET(env->error,
+ AXIS2_ERROR_NEETHI_REFERENCE_CREATION_FAILED_FROM_ELEMENT,
+ AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Reference cretion failed from element.");
+ return AXIS2_FAILURE;
+ }
+ }
+ }
+
+ else
+ {
+ /* This is an assertion in a different domain. Assertion builder
+ * should be called and that will call the relevent assertion builder
+ * after looking at the localname and the namespace */
+
+ neethi_assertion_t *assertion = NULL;
+ assertion = neethi_assertion_builder_build(env, child_node,
+ child_element);
+ if(assertion)
+ {
+ operator = neethi_operator_create(env);
+ neethi_operator_set_value(operator, env, assertion,
+ OPERATOR_TYPE_ASSERTION);
+ neethi_engine_add_policy_component(env, neethi_operator, operator);
+ neethi_assertion_set_node(assertion, env, child_node);
+ }
+ else
+ {
+ AXIS2_ERROR_SET(env->error,
+ AXIS2_ERROR_NEETHI_ASSERTION_CREATION_FAILED_FROM_ELEMENT,
+ AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Assertion creation failed from element.");
+ return AXIS2_FAILURE;
+ }
+ }
+ }
+ }
+ }
+ }
+ return AXIS2_SUCCESS;
+ }
+ else
+ return AXIS2_FAILURE;
+}
+
+/* After looking at the operator_type this function will
+ * call the relevent neethi operator's add operator
+ * function */
+
+static axis2_status_t
+neethi_engine_add_policy_component(
+ const axutil_env_t *env,
+ neethi_operator_t *container_operator,
+ neethi_operator_t *component)
+{
+
+ neethi_operator_type_t type;
+ void *value = NULL;
+ neethi_policy_t *neethi_policy = NULL;
+ neethi_exactlyone_t *exactlyone = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+
+ type = neethi_operator_get_type(container_operator, env);
+ value = neethi_operator_get_value(container_operator, env);
+
+ if(value)
+ {
+ switch(type)
+ {
+ case OPERATOR_TYPE_POLICY:
+ neethi_policy = (neethi_policy_t *)value;
+ neethi_policy_add_operator(neethi_policy, env, component);
+ break;
+
+ case OPERATOR_TYPE_ALL:
+ all = (neethi_all_t *)value;
+ neethi_all_add_operator(all, env, component);
+ break;
+
+ case OPERATOR_TYPE_EXACTLYONE:
+ exactlyone = (neethi_exactlyone_t *)value;
+ neethi_exactlyone_add_operator(exactlyone, env, component);
+ break;
+
+ case OPERATOR_TYPE_UNKNOWN:
+ return AXIS2_FAILURE;
+ break;
+
+ case OPERATOR_TYPE_ASSERTION:
+ assertion = (neethi_assertion_t *)value;
+ neethi_assertion_add_operator(assertion, env, component);
+ break;
+
+ case OPERATOR_TYPE_REFERENCE:
+ break;
+ }
+ return AXIS2_SUCCESS;
+ }
+ else
+ return AXIS2_FAILURE;
+}
+
+/***************************************/
+
+/*This function is only for testing*
+ *Remove it later*/
+void
+check_neethi_policy(
+ neethi_policy_t *neethi_policy,
+ const axutil_env_t *env)
+{
+ axutil_array_list_t *list = NULL;
+ neethi_operator_t *op = NULL;
+ neethi_operator_type_t type;
+
+ list = neethi_policy_get_policy_components(neethi_policy, env);
+
+ if(axutil_array_list_size(list, env) > 1)
+ {
+ return;
+ }
+ op = (neethi_operator_t *)axutil_array_list_get(list, env, 0);
+ type = neethi_operator_get_type(op, env);
+ if(type == OPERATOR_TYPE_EXACTLYONE)
+ {
+ void *value = neethi_operator_get_value(op, env);
+ if(value)
+ {
+ return;
+ }
+ }
+ else
+ {
+ return;
+ }
+}
+
+/************************************************/
+/*
+
+ Following function will normalize accorading to the
+ WS-Policy spec. Normalize policy is in the following
+ format.
+
+ <wsp:Policy>
+ <wsp:ExactlyOne>
+ ( <wsp:All> ( <Assertion …> … </Assertion> )* </wsp:All> )*
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+
+ */
+
+AXIS2_EXTERN neethi_policy_t *AXIS2_CALL
+neethi_engine_get_normalize(
+ const axutil_env_t *env,
+ axis2_bool_t deep,
+ neethi_policy_t *neethi_policy)
+{
+ /* In the first call we pass the registry as null.*/
+
+ return neethi_engine_normalize(env, neethi_policy, NULL, deep);
+}
+
+AXIS2_EXTERN neethi_policy_t *AXIS2_CALL
+neethi_engine_normalize(
+ const axutil_env_t *env,
+ neethi_policy_t *neethi_policy,
+ neethi_registry_t *registry,
+ axis2_bool_t deep)
+{
+ neethi_policy_t *resultant_neethi_policy = NULL;
+ neethi_operator_t *operator = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_exactlyone_t *exactlyone = NULL;
+ axis2_char_t *policy_name = NULL;
+ axis2_char_t *policy_id = NULL;
+
+ /* Normalize policy will be contained in the new policy
+ * created below */
+
+ resultant_neethi_policy = neethi_policy_create(env);
+ if(!resultant_neethi_policy)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+
+ policy_name = neethi_policy_get_name(neethi_policy, env);
+ if(policy_name)
+ {
+ neethi_policy_set_name(resultant_neethi_policy, env, policy_name);
+ }
+ policy_id = neethi_policy_get_id(neethi_policy, env);
+ if(policy_id)
+ {
+ neethi_policy_set_id(resultant_neethi_policy, env, policy_id);
+ }
+
+ operator = neethi_operator_create(env);
+ if(!operator)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+
+ neethi_operator_set_value(operator, env, neethi_policy, OPERATOR_TYPE_POLICY);
+
+ /* When we call the normalization it should always return an exactlyone as the
+ * out put. */
+
+ exactlyone = neethi_engine_normalize_operator(operator, registry, deep, env);
+
+ /* We are frreing the operator used to wrap the object */
+
+ neethi_operator_set_value_null(operator, env);
+ neethi_operator_free(operator, env);
+ operator = NULL;
+
+ /* This exactlyone is set as the first component of the
+ * normalized policy */
+
+ if(exactlyone)
+ {
+ component = neethi_operator_create(env);
+ neethi_operator_set_value(component, env, exactlyone, OPERATOR_TYPE_EXACTLYONE);
+ neethi_policy_add_operator(resultant_neethi_policy, env, component);
+
+ return resultant_neethi_policy;
+ }
+ else
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NEETHI_NORMALIZATION_FAILED, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Normalization failed.");
+ return NULL;
+ }
+}
+
+AXIS2_EXTERN neethi_policy_t *AXIS2_CALL
+neethi_engine_merge(
+ const axutil_env_t *env,
+ neethi_policy_t *neethi_policy1,
+ neethi_policy_t *neethi_policy2)
+{
+
+ neethi_exactlyone_t *exactlyone1 = NULL;
+ neethi_exactlyone_t *exactlyone2 = NULL;
+ neethi_exactlyone_t *exactlyone = NULL;
+ neethi_policy_t *neethi_policy = NULL;
+ neethi_operator_t *component = NULL;
+
+ exactlyone1 = neethi_policy_get_exactlyone(neethi_policy1, env);
+ exactlyone2 = neethi_policy_get_exactlyone(neethi_policy2, env);
+
+ if(!exactlyone1 || !exactlyone2)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NEETHI_WRONG_INPUT_FOR_MERGE, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Wrong input for merge.");
+ return NULL;
+ }
+ exactlyone = neethi_engine_get_cross_product(exactlyone1, exactlyone2, env);
+ if(exactlyone)
+ {
+ neethi_policy = neethi_policy_create(env);
+ component = neethi_operator_create(env);
+ if(!neethi_policy || !component)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ neethi_operator_set_value(component, env, exactlyone, OPERATOR_TYPE_EXACTLYONE);
+ neethi_policy_add_operator(neethi_policy, env, component);
+ return neethi_policy;
+ }
+ else
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NEETHI_CROSS_PRODUCT_FAILED, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Cross product failed.");
+ return NULL;
+ }
+}
+
+static axis2_bool_t
+neethi_engine_operator_is_empty(
+ neethi_operator_t *operator,
+ const axutil_env_t *env)
+{
+
+ neethi_operator_type_t type;
+ void *value = NULL;
+ neethi_policy_t *neethi_policy = NULL;
+ neethi_exactlyone_t *exactlyone = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+
+ type = neethi_operator_get_type(operator, env);
+ value = neethi_operator_get_value(operator, env);
+
+ if(value)
+ {
+ switch(type)
+ {
+ case OPERATOR_TYPE_POLICY:
+ neethi_policy = (neethi_policy_t *)value;
+ return neethi_policy_is_empty(neethi_policy, env);
+ break;
+
+ case OPERATOR_TYPE_ALL:
+ all = (neethi_all_t *)value;
+ return neethi_all_is_empty(all, env);
+ break;
+
+ case OPERATOR_TYPE_EXACTLYONE:
+ exactlyone = (neethi_exactlyone_t *)value;
+ return neethi_exactlyone_is_empty(exactlyone, env);
+ break;
+
+ case OPERATOR_TYPE_UNKNOWN:
+ return AXIS2_FALSE;
+ break;
+
+ case OPERATOR_TYPE_ASSERTION:
+ assertion = (neethi_assertion_t *)value;
+ return neethi_assertion_is_empty(assertion, env);
+ break;
+
+ case OPERATOR_TYPE_REFERENCE:
+ break;
+
+ }
+ return AXIS2_FALSE;
+ }
+ else
+ return AXIS2_FALSE;
+}
+
+static axutil_array_list_t *
+neethi_engine_operator_get_components(
+ neethi_operator_t *operator,
+ const axutil_env_t *env)
+{
+
+ neethi_operator_type_t type;
+ void *value = NULL;
+ neethi_policy_t *neethi_policy = NULL;
+ neethi_exactlyone_t *exactlyone = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+
+ type = neethi_operator_get_type(operator, env);
+ value = neethi_operator_get_value(operator, env);
+
+ if(value)
+ {
+ switch(type)
+ {
+ case OPERATOR_TYPE_POLICY:
+ neethi_policy = (neethi_policy_t *)value;
+ return neethi_policy_get_policy_components(neethi_policy, env);
+ break;
+
+ case OPERATOR_TYPE_ALL:
+ all = (neethi_all_t *)value;
+ return neethi_all_get_policy_components(all, env);
+ break;
+
+ case OPERATOR_TYPE_EXACTLYONE:
+ exactlyone = (neethi_exactlyone_t *)value;
+ return neethi_exactlyone_get_policy_components(exactlyone, env);
+ break;
+
+ case OPERATOR_TYPE_UNKNOWN:
+ return NULL;
+ break;
+
+ case OPERATOR_TYPE_ASSERTION:
+ assertion = (neethi_assertion_t *)value;
+ return neethi_assertion_get_policy_components(assertion, env);
+ break;
+
+ case OPERATOR_TYPE_REFERENCE:
+ break;
+ }
+ }
+
+ return NULL;
+}
+
+static neethi_exactlyone_t *
+neethi_engine_normalize_operator(
+ neethi_operator_t *operator,
+ neethi_registry_t *registry,
+ axis2_bool_t deep,
+ const axutil_env_t *env)
+{
+ axutil_array_list_t *child_component_list = NULL;
+ neethi_operator_t *child_component = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ int i = 0;
+
+ neethi_operator_type_t type = neethi_operator_get_type(operator, env);
+
+ if(neethi_engine_operator_is_empty(operator, env))
+ {
+ /* If this is an empty operator we just add
+ * an exactlyone and all */
+
+ neethi_exactlyone_t *exactlyone = NULL;
+ exactlyone = neethi_exactlyone_create(env);
+ if(!exactlyone)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ if(type != OPERATOR_TYPE_EXACTLYONE)
+ {
+ neethi_all_t *all = NULL;
+ neethi_operator_t *component = NULL;
+ all = neethi_all_create(env);
+ component = neethi_operator_create(env);
+ if(!all || !component)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ neethi_operator_set_value(component, env, all, OPERATOR_TYPE_ALL);
+ neethi_exactlyone_add_operator(exactlyone, env, component);
+ }
+ return exactlyone;
+ }
+
+ child_component_list = axutil_array_list_create(env, 0);
+ arraylist = neethi_engine_operator_get_components(operator, env);
+
+ /* Here we are recursively normalize each and every component */
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ neethi_operator_type_t component_type;
+ child_component = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ component_type = neethi_operator_get_type(child_component, env);
+
+ if(component_type == OPERATOR_TYPE_ASSERTION)
+ {
+ /*Assertion normalization part comes here */
+ if(deep)
+ {
+ return NULL;
+ }
+ else
+ {
+ neethi_exactlyone_t *exactlyone = NULL;
+ neethi_all_t *all = NULL;
+ neethi_operator_t *op = NULL;
+
+ exactlyone = neethi_exactlyone_create(env);
+ all = neethi_all_create(env);
+ op = neethi_operator_create(env);
+
+ if(!all || !op || !exactlyone)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+
+ /* We wrap everything inside an exactlyone */
+
+ neethi_all_add_operator(all, env, child_component);
+ neethi_operator_set_value(op, env, all, OPERATOR_TYPE_ALL);
+ neethi_exactlyone_add_operator(exactlyone, env, op);
+ axutil_array_list_add(child_component_list, env, exactlyone);
+ }
+ }
+ else if(component_type == OPERATOR_TYPE_POLICY)
+ {
+ neethi_policy_t *neethi_policy = NULL;
+ neethi_all_t *all = NULL;
+ axutil_array_list_t *children = NULL;
+ neethi_operator_t *to_normalize = NULL;
+ neethi_exactlyone_t *exactlyone = NULL;
+
+ all = neethi_all_create(env);
+ if(!all)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ neethi_policy = (neethi_policy_t *)neethi_operator_get_value(child_component, env);
+ if(neethi_policy)
+ {
+ children = neethi_policy_get_policy_components(neethi_policy, env);
+ if(children)
+ {
+ neethi_all_add_policy_components(all, children, env);
+ to_normalize = neethi_operator_create(env);
+ if(!to_normalize)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ neethi_operator_set_value(to_normalize, env, all, OPERATOR_TYPE_ALL);
+ exactlyone
+ = neethi_engine_normalize_operator(to_normalize, registry, deep, env);
+ if(exactlyone)
+ {
+ axutil_array_list_add(child_component_list, env, exactlyone);
+ }
+ }
+ else
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NEETHI_NO_CHILDREN_POLICY_COMPONENTS,
+ AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] No children policy components");
+ return NULL;
+ }
+ }
+ }
+
+ else if(component_type == OPERATOR_TYPE_REFERENCE)
+ {
+
+ /* If the operator is a policy reference we will
+ * extract the relevent policy from the uri and
+ * normalize as we are doing for a neethi_policy
+ * object */
+
+ neethi_reference_t *policy_ref = NULL;
+ axis2_char_t *uri = NULL;
+ neethi_policy_t *policy = NULL;
+ neethi_all_t *all = NULL;
+ axutil_array_list_t *children = NULL;
+ neethi_operator_t *to_normalize = NULL;
+ neethi_exactlyone_t *exactlyone = NULL;
+
+ policy_ref = (neethi_reference_t *)neethi_operator_get_value(child_component, env);
+ uri = neethi_reference_get_uri(policy_ref, env);
+ if(!uri)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NEETHI_URI_NOT_SPECIFIED, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Uri not specified");
+ return NULL;
+ }
+
+ if(!registry)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Cannot resolve the reference.Registry Not provided");
+ return NULL;
+ }
+
+ policy = neethi_registry_lookup(registry, env, uri);
+ if(!policy)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NEETHI_NO_ENTRY_FOR_THE_GIVEN_URI,
+ AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] No entry for the given uri");
+ return NULL;
+ }
+ neethi_operator_set_value(child_component, env, policy, OPERATOR_TYPE_POLICY);
+
+ all = neethi_all_create(env);
+ if(!all)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+
+ policy = (neethi_policy_t *)neethi_operator_get_value(child_component, env);
+ if(policy)
+ {
+ children = neethi_policy_get_policy_components(policy, env);
+ if(children)
+ {
+ neethi_all_add_policy_components(all, children, env);
+ to_normalize = neethi_operator_create(env);
+ if(!to_normalize)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ neethi_operator_set_value(to_normalize, env, all, OPERATOR_TYPE_ALL);
+ exactlyone
+ = neethi_engine_normalize_operator(to_normalize, registry, deep, env);
+ if(exactlyone)
+ {
+ axutil_array_list_add(child_component_list, env, exactlyone);
+ }
+ }
+ else
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NEETHI_NO_CHILDREN_POLICY_COMPONENTS,
+ AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] No children policy components");
+ return NULL;
+ }
+ }
+ }
+ else
+ {
+ neethi_exactlyone_t *exactlyone = NULL;
+ exactlyone = neethi_engine_normalize_operator(child_component, registry, deep, env);
+ if(exactlyone)
+ {
+ axutil_array_list_add(child_component_list, env, exactlyone);
+ }
+ }
+ }
+
+ /* So at this point we have set of exactlyones in the array_list, So we will
+ * compute one exactlyone out of those after the following call */
+
+ return neethi_engine_compute_resultant_component(child_component_list, type, env);
+}
+
+/* This function will return a single exactlyone from all the
+ * components in the list */
+
+static neethi_exactlyone_t *
+neethi_engine_compute_resultant_component(
+ axutil_array_list_t * normalized_inner_components,
+ neethi_operator_type_t type,
+ const axutil_env_t * env)
+{
+ neethi_exactlyone_t *exactlyone = NULL;
+ int size = 0;
+
+ if(normalized_inner_components)
+ {
+ size = axutil_array_list_size(normalized_inner_components, env);
+ }
+
+ if(type == OPERATOR_TYPE_EXACTLYONE)
+ {
+ /* If the operator is an exactlyone then we get all the components
+ * in the exatlyones and add them to a newly created exactlyone */
+
+ int i = 0;
+ neethi_exactlyone_t *inner_exactlyone = NULL;
+ exactlyone = neethi_exactlyone_create(env);
+
+ for(i = 0; i < size; i++)
+ {
+ inner_exactlyone = (neethi_exactlyone_t *)axutil_array_list_get(
+ normalized_inner_components, env, i);
+ if(inner_exactlyone)
+ {
+ neethi_exactlyone_add_policy_components(exactlyone,
+ neethi_exactlyone_get_policy_components(inner_exactlyone, env), env);
+ }
+ else
+ {
+ AXIS2_ERROR_SET(env->error,
+ AXIS2_ERROR_NEETHI_EXACTLYONE_NOT_FOUND_IN_NORMALIZED_POLICY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Exactlyone not found in normalized policy");
+ return NULL;
+ }
+ }
+ }
+ else if(type == OPERATOR_TYPE_POLICY || type == OPERATOR_TYPE_ALL)
+ {
+ /* Here arry_list contains one exactlyone means this operator
+ * is already normalized. So we will return that. Otherwise we
+ * will get the crossproduct. */
+
+ if(size > 1)
+ {
+ /* Get the first one and do the cross product with other
+ * components */
+
+ int i = 0;
+ exactlyone = (neethi_exactlyone_t *)axutil_array_list_get(normalized_inner_components,
+ env, 0);
+ if(!exactlyone)
+ {
+ AXIS2_ERROR_SET(env->error,
+ AXIS2_ERROR_NEETHI_EXACTLYONE_NOT_FOUND_IN_NORMALIZED_POLICY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Exactlyone not found in normalized policy");
+ return NULL;
+ }
+ if(!neethi_exactlyone_is_empty(exactlyone, env))
+ {
+ neethi_exactlyone_t *current_exactlyone = NULL;
+ i = 1;
+ for(i = 1; i < size; i++)
+ {
+ current_exactlyone = (neethi_exactlyone_t *)axutil_array_list_get(
+ normalized_inner_components, env, i);
+ if(!current_exactlyone)
+ {
+ AXIS2_ERROR_SET(env->error,
+ AXIS2_ERROR_NEETHI_EXACTLYONE_NOT_FOUND_IN_NORMALIZED_POLICY,
+ AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Exactlyone not found in normalized policy");
+ return NULL;
+ }
+ if(neethi_exactlyone_is_empty(current_exactlyone, env))
+ {
+ exactlyone = current_exactlyone;
+ break;
+ }
+ else
+ {
+ neethi_exactlyone_t *temp = NULL;
+ neethi_exactlyone_t *temp1 = NULL;
+ temp = exactlyone;
+ temp1 = current_exactlyone;
+ exactlyone = neethi_engine_get_cross_product(exactlyone,
+ current_exactlyone, env);
+ neethi_exactlyone_free(temp, env);
+ neethi_exactlyone_free(temp1, env);
+ temp = NULL;
+ temp1 = NULL;
+ }
+ }
+ }
+ else
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NEETHI_EXACTLYONE_IS_EMPTY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Exactlyone is Empty");
+ return NULL;
+ }
+ }
+ else
+ {
+ exactlyone = (neethi_exactlyone_t *)axutil_array_list_get(normalized_inner_components,
+ env, 0);
+ }
+ }
+ axutil_array_list_free(normalized_inner_components, env);
+ normalized_inner_components = NULL;
+
+ return exactlyone;
+}
+
+/* The cross product will return all the different combinations
+ * of alternatives and put them into one exactlyone */
+
+static neethi_exactlyone_t *
+neethi_engine_get_cross_product(
+ neethi_exactlyone_t *exactlyone1,
+ neethi_exactlyone_t *exactlyone2,
+ const axutil_env_t *env)
+{
+ neethi_exactlyone_t *cross_product = NULL;
+ neethi_all_t *cross_product_all = NULL;
+ neethi_all_t *current_all1 = NULL;
+ neethi_all_t *current_all2 = NULL;
+ axutil_array_list_t *array_list1 = NULL;
+ axutil_array_list_t *array_list2 = NULL;
+ neethi_operator_t *component = NULL;
+ int i = 0;
+ int j = 0;
+
+ cross_product = neethi_exactlyone_create(env);
+ if(!cross_product)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ array_list1 = neethi_exactlyone_get_policy_components(exactlyone1, env);
+ array_list2 = neethi_exactlyone_get_policy_components(exactlyone2, env);
+
+ if(!array_list1 || !array_list2)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NEETHI_NO_CHILDREN_POLICY_COMPONENTS, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] No children policy components");
+ return NULL;
+ }
+
+ for(i = 0; i < axutil_array_list_size(array_list1, env); i++)
+ {
+ current_all1 = (neethi_all_t *)neethi_operator_get_value(
+ (neethi_operator_t *)axutil_array_list_get(array_list1, env, i), env);
+
+ if(!current_all1)
+ {
+ AXIS2_ERROR_SET(env->error,
+ AXIS2_ERROR_NEETHI_ALL_NOT_FOUND_WHILE_GETTING_CROSS_PRODUCT, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] All not found while getting cross product");
+ return NULL;
+ }
+
+ for(j = 0; j < axutil_array_list_size(array_list2, env); j++)
+ {
+ current_all2 = (neethi_all_t *)neethi_operator_get_value(
+ (neethi_operator_t *)axutil_array_list_get(array_list2, env, j), env);
+
+ if(!current_all2)
+ {
+ AXIS2_ERROR_SET(env->error,
+ AXIS2_ERROR_NEETHI_ALL_NOT_FOUND_WHILE_GETTING_CROSS_PRODUCT, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] All not found while getting cross product");
+ return NULL;
+ }
+
+ cross_product_all = neethi_all_create(env);
+ if(!cross_product_all)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ neethi_all_add_policy_components(cross_product_all, neethi_all_get_policy_components(
+ current_all1, env), env);
+
+ neethi_all_add_policy_components(cross_product_all, neethi_all_get_policy_components(
+ current_all2, env), env);
+
+ component = neethi_operator_create(env);
+ if(!component)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ neethi_operator_set_value(component, env, cross_product_all, OPERATOR_TYPE_ALL);
+ neethi_exactlyone_add_operator(cross_product, env, component);
+ }
+ }
+ return cross_product;
+}
+
+/*These functions are for serializing a policy object*/
+
+AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+neethi_engine_serialize(
+ neethi_policy_t *policy,
+ const axutil_env_t *env)
+{
+
+ return neethi_policy_serialize(policy, NULL, env);
+}
+
+static void
+neethi_engine_clear_element_attributes(
+ axutil_hash_t *attr_hash,
+ const axutil_env_t *env)
+{
+ axutil_hash_index_t *hi = NULL;
+
+ for(hi = axutil_hash_first(attr_hash, env); hi; hi = axutil_hash_next(env, hi))
+ {
+ void *val = NULL;
+ axutil_hash_this(hi, NULL, NULL, &val);
+ if(val)
+ {
+ axiom_attribute_free((axiom_attribute_t *)val, env);
+ val = NULL;
+ }
+ }
+ axutil_hash_free(attr_hash, env);
+ attr_hash = NULL;
+
+ return;
+}
diff --git a/neethi/src/exactlyone.c b/neethi/src/exactlyone.c
new file mode 100644
index 0000000..ad94fa2
--- /dev/null
+++ b/neethi/src/exactlyone.c
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <neethi_exactlyone.h>
+
+struct neethi_exactlyone_t
+{
+ axutil_array_list_t *policy_components;
+};
+
+AXIS2_EXTERN neethi_exactlyone_t *AXIS2_CALL
+neethi_exactlyone_create(
+ const axutil_env_t *env)
+{
+ neethi_exactlyone_t *neethi_exactlyone = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ neethi_exactlyone = (neethi_exactlyone_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(neethi_exactlyone_t));
+
+ if(neethi_exactlyone == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ neethi_exactlyone->policy_components = NULL;
+
+ neethi_exactlyone->policy_components = axutil_array_list_create(env, 0);
+ if(!(neethi_exactlyone->policy_components))
+ {
+ neethi_exactlyone_free(neethi_exactlyone, env);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ return neethi_exactlyone;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+neethi_exactlyone_free(
+ neethi_exactlyone_t *neethi_exactlyone,
+ const axutil_env_t *env)
+{
+ if(neethi_exactlyone)
+ {
+ if(neethi_exactlyone->policy_components)
+ {
+ int i = 0;
+ int size = 0;
+
+ size = axutil_array_list_size(neethi_exactlyone->policy_components, env);
+
+ for(i = 0; i < size; i++)
+ {
+ neethi_operator_t *operator = NULL;
+ operator = (neethi_operator_t *)axutil_array_list_get(
+ neethi_exactlyone->policy_components, env, i);
+ if(operator)
+ {
+ neethi_operator_free(operator, env);
+ operator = NULL;
+ }
+ }
+ axutil_array_list_free(neethi_exactlyone->policy_components, env);
+ neethi_exactlyone->policy_components = NULL;
+ }
+ AXIS2_FREE(env->allocator, neethi_exactlyone);
+ neethi_exactlyone = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+neethi_exactlyone_get_policy_components(
+ neethi_exactlyone_t *neethi_exactlyone,
+ const axutil_env_t *env)
+{
+ return neethi_exactlyone->policy_components;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_exactlyone_add_policy_components(
+ neethi_exactlyone_t *exactlyone,
+ axutil_array_list_t *arraylist,
+ const axutil_env_t *env)
+{
+
+ int size = axutil_array_list_size(arraylist, env);
+ int i = 0;
+
+ if(axutil_array_list_ensure_capacity(exactlyone->policy_components, env, size + 1)
+ != AXIS2_SUCCESS)
+ {
+ return AXIS2_FAILURE;
+ }
+
+ for(i = 0; i < size; i++)
+ {
+ void *value = NULL;
+ value = axutil_array_list_get(arraylist, env, i);
+ neethi_operator_increment_ref((neethi_operator_t *)value, env);
+ axutil_array_list_add(exactlyone->policy_components, env, value);
+ }
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_exactlyone_add_operator(
+ neethi_exactlyone_t *neethi_exactlyone,
+ const axutil_env_t *env,
+ neethi_operator_t *operator)
+{
+ neethi_operator_increment_ref(operator, env);
+ axutil_array_list_add(neethi_exactlyone->policy_components, env, operator);
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+neethi_exactlyone_is_empty(
+ neethi_exactlyone_t *exactlyone,
+ const axutil_env_t *env)
+{
+ return axutil_array_list_is_empty(exactlyone->policy_components, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_exactlyone_serialize(
+ neethi_exactlyone_t *neethi_exactlyone,
+ axiom_node_t *parent,
+ const axutil_env_t *env)
+{
+ axiom_node_t *exactlyone_node = NULL;
+ axiom_element_t *exactlyone_ele = NULL;
+ axiom_namespace_t *policy_ns = NULL;
+ axutil_array_list_t *components = NULL;
+
+ policy_ns = axiom_namespace_create(env, NEETHI_NAMESPACE, NEETHI_PREFIX);
+ exactlyone_ele = axiom_element_create(env, parent, NEETHI_EXACTLYONE, policy_ns,
+ &exactlyone_node);
+ if(!exactlyone_node)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Cannot create 'ExactlyOne' node. Serialization of 'ExactlyOne' assertion failed");
+ return AXIS2_FAILURE;
+ }
+
+ components = neethi_exactlyone_get_policy_components(neethi_exactlyone, env);
+ if(components)
+ {
+ axis2_status_t status = AXIS2_FAILURE;
+ int i = 0;
+ for(i = 0; i < axutil_array_list_size(components, env); i++)
+ {
+ neethi_operator_t *operator = NULL;
+ operator = (neethi_operator_t *)axutil_array_list_get(components, env, i);
+ if(operator)
+ {
+ status = neethi_operator_serialize(operator, env, exactlyone_node);
+ if(status != AXIS2_SUCCESS)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Neethi operator serialization failed. "
+ "Cannot serialize 'ExactlyOne' assertion");
+ return AXIS2_FAILURE;
+ }
+ }
+ }
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/mtom_assertion_checker.c b/neethi/src/mtom_assertion_checker.c
new file mode 100644
index 0000000..77e5ff0
--- /dev/null
+++ b/neethi/src/mtom_assertion_checker.c
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <neethi_operator.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+#include <neethi_assertion.h>
+#include <neethi_mtom_assertion_checker.h>
+
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+neethi_is_mtom_required(
+ const axutil_env_t *env,
+ neethi_policy_t *policy)
+{
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+ neethi_operator_t *operator = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+ int i = 0;
+
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+
+ if(normalized_policy)
+ {
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ }
+
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ /*if (value)
+ {*/
+ if(type == ASSERTION_TYPE_OPTIMIZED_MIME_SERIALIZATION)
+ {
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+ return AXIS2_TRUE;
+ }
+ /*}*/
+ }
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return AXIS2_FALSE;
+}
diff --git a/neethi/src/operator.c b/neethi/src/operator.c
new file mode 100644
index 0000000..68554dc
--- /dev/null
+++ b/neethi/src/operator.c
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_reference.h>
+#include <neethi_assertion.h>
+
+struct neethi_operator_t
+{
+ /* This may be a policy, all, exatlyone, reference
+ * or an assertion */
+ void *value;
+
+ /* The type */
+ neethi_operator_type_t type;
+
+ /* Ref count to prevent double frees*/
+ int ref;
+};
+
+AXIS2_EXTERN neethi_operator_t *AXIS2_CALL
+neethi_operator_create(
+ const axutil_env_t *env)
+{
+ neethi_operator_t *neethi_operator = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ neethi_operator = (neethi_operator_t *)AXIS2_MALLOC(env->allocator, sizeof(neethi_operator_t));
+
+ if(neethi_operator == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ neethi_operator->value = NULL;
+ neethi_operator->type = OPERATOR_TYPE_UNKNOWN;
+ neethi_operator->ref = 0;
+ return neethi_operator;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+neethi_operator_free(
+ neethi_operator_t *neethi_operator,
+ const axutil_env_t *env)
+{
+ if(neethi_operator)
+ {
+ if(--(neethi_operator->ref) > 0)
+ {
+ return;
+ }
+
+ if(neethi_operator->value)
+ {
+ switch(neethi_operator->type)
+ {
+ case OPERATOR_TYPE_POLICY:
+ neethi_policy_free((neethi_policy_t *)neethi_operator->value, env);
+ neethi_operator->value = NULL;
+ break;
+
+ case OPERATOR_TYPE_ALL:
+ neethi_all_free((neethi_all_t *)neethi_operator->value, env);
+ neethi_operator->value = NULL;
+ break;
+
+ case OPERATOR_TYPE_EXACTLYONE:
+ neethi_exactlyone_free((neethi_exactlyone_t *)neethi_operator-> value, env);
+ neethi_operator->value = NULL;
+ break;
+
+ case OPERATOR_TYPE_REFERENCE:
+ neethi_reference_free((neethi_reference_t *)neethi_operator-> value, env);
+ neethi_operator->value = NULL;
+ break;
+
+ case OPERATOR_TYPE_ASSERTION:
+ neethi_assertion_free((neethi_assertion_t *)neethi_operator-> value, env);
+ neethi_operator->value = NULL;
+ break;
+
+ case OPERATOR_TYPE_UNKNOWN:
+ break;
+ }
+ }
+ AXIS2_FREE(env->allocator, neethi_operator);
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN neethi_operator_type_t AXIS2_CALL
+neethi_operator_get_type(
+ neethi_operator_t *neethi_operator,
+ const axutil_env_t *env)
+{
+ return neethi_operator->type;
+}
+
+AXIS2_EXTERN void *AXIS2_CALL
+neethi_operator_get_value(
+ neethi_operator_t *neethi_operator,
+ const axutil_env_t *env)
+{
+ return neethi_operator->value;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_operator_set_value(
+ neethi_operator_t *neethi_operator,
+ const axutil_env_t *env,
+ void *value,
+ neethi_operator_type_t type)
+{
+ neethi_operator->type = type;
+ neethi_operator->value = (void *)value;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_operator_serialize(
+ neethi_operator_t *neethi_operator,
+ const axutil_env_t *env,
+ axiom_node_t *parent)
+{
+ neethi_policy_t *policy = NULL;
+ neethi_all_t *all = NULL;
+ neethi_exactlyone_t *exactlyone = NULL;
+ neethi_reference_t *reference = NULL;
+ neethi_assertion_t *assertion = NULL;
+
+ if(neethi_operator->value)
+ {
+ switch(neethi_operator->type)
+ {
+ case OPERATOR_TYPE_POLICY:
+ policy = (neethi_policy_t *)neethi_operator_get_value(neethi_operator, env);
+ if(!neethi_policy_serialize(policy, parent, env))
+ {
+ return AXIS2_FAILURE;
+ }
+ else
+ {
+ return AXIS2_SUCCESS;
+ }
+ break;
+
+ case OPERATOR_TYPE_ALL:
+ all = (neethi_all_t *)neethi_operator_get_value(neethi_operator, env);
+ return neethi_all_serialize(all, parent, env);
+ break;
+
+ case OPERATOR_TYPE_EXACTLYONE:
+ exactlyone = (neethi_exactlyone_t *)neethi_operator_get_value(neethi_operator, env);
+ return neethi_exactlyone_serialize(exactlyone, parent, env);
+ break;
+
+ case OPERATOR_TYPE_REFERENCE:
+ reference = (neethi_reference_t *)neethi_operator_get_value(neethi_operator, env);
+ return neethi_reference_serialize(reference, parent, env);
+ break;
+
+ case OPERATOR_TYPE_ASSERTION:
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(neethi_operator, env);
+ return neethi_assertion_serialize(assertion, parent, env);
+ break;
+
+ case OPERATOR_TYPE_UNKNOWN:
+ break;
+ }
+ return AXIS2_SUCCESS;
+ }
+ else
+ return AXIS2_FAILURE;
+}
+
+/* We need this method to prevent freeing the value of operator, because some times we wrap certain
+ * policy operators inside neethi_operator in order to call some functions.See engine.c in neethi
+ * for more info */
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_operator_set_value_null(
+ neethi_operator_t *neethi_operator,
+ const axutil_env_t *env)
+{
+ neethi_operator->value = NULL;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_operator_increment_ref(
+ neethi_operator_t *operator,
+ const axutil_env_t *env)
+{
+ operator-> ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/policy.c b/neethi/src/policy.c
new file mode 100644
index 0000000..af08222
--- /dev/null
+++ b/neethi/src/policy.c
@@ -0,0 +1,446 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <neethi_policy.h>
+#include <neethi_engine.h>
+#include <axiom_attribute.h>
+
+struct neethi_policy_t
+{
+ /* Contains the child components */
+ axutil_array_list_t *policy_components;
+
+ /* A wsp:Policy element can have any number of attributes
+ * This has will store those */
+ axutil_hash_t *attributes;
+
+ /* This is the node containing the policy */
+ axiom_node_t *root_node;
+};
+
+static void
+neethi_policy_clear_attributes(
+ axutil_hash_t *attributes,
+ const axutil_env_t *env);
+
+/* Creates a neethi_policy object */
+AXIS2_EXTERN neethi_policy_t *AXIS2_CALL
+neethi_policy_create(
+ const axutil_env_t * env)
+{
+ neethi_policy_t *neethi_policy = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ neethi_policy = (neethi_policy_t *)AXIS2_MALLOC(env->allocator, sizeof(neethi_policy_t));
+
+ if(neethi_policy == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ neethi_policy->policy_components = NULL;
+
+ neethi_policy->policy_components = axutil_array_list_create(env, 0);
+ if(!(neethi_policy->policy_components))
+ {
+ neethi_policy_free(neethi_policy, env);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ neethi_policy->attributes = axutil_hash_make(env);
+ neethi_policy->root_node = NULL;
+
+ return neethi_policy;
+}
+
+/* Deallocate the memory for the neethi_policy object */
+AXIS2_EXTERN void AXIS2_CALL
+neethi_policy_free(
+ neethi_policy_t *neethi_policy,
+ const axutil_env_t *env)
+{
+ if(neethi_policy)
+ {
+ /* We first remove the component list */
+
+ if(neethi_policy->policy_components)
+ {
+ int i = 0;
+ int size = 0;
+
+ size = axutil_array_list_size(neethi_policy->policy_components, env);
+
+ for(i = 0; i < size; i++)
+ {
+ neethi_operator_t *operator = NULL;
+ operator = (neethi_operator_t *)axutil_array_list_get(
+ neethi_policy->policy_components, env, i);
+ if(operator)
+ {
+ neethi_operator_free(operator, env);
+ }
+ operator = NULL;
+ }
+ axutil_array_list_free(neethi_policy->policy_components, env);
+ neethi_policy->policy_components = NULL;
+ }
+ if(neethi_policy->attributes)
+ {
+ neethi_policy_clear_attributes(neethi_policy->attributes, env);
+ neethi_policy->attributes = NULL;
+ }
+ if(neethi_policy->root_node)
+ {
+ axiom_node_free_tree(neethi_policy->root_node, env);
+ neethi_policy->root_node = NULL;
+ }
+ AXIS2_FREE(env->allocator, neethi_policy);
+ neethi_policy = NULL;
+ }
+ return;
+}
+
+/* This will free the attribute hash and its content.*/
+static void
+neethi_policy_clear_attributes(
+ axutil_hash_t *attributes,
+ const axutil_env_t *env)
+{
+ if(attributes)
+ {
+ axutil_hash_index_t *hi = NULL;
+ void *val = NULL;
+ const void *key = NULL;
+
+ for(hi = axutil_hash_first(attributes, env); hi; hi = axutil_hash_next(env, hi))
+ {
+ axutil_hash_this(hi, &key, NULL, &val);
+
+ if(key)
+ {
+ AXIS2_FREE(env->allocator, (axis2_char_t *)key);
+ key = NULL;
+ }
+
+ if(val)
+ {
+ AXIS2_FREE(env->allocator, (axis2_char_t *)val);
+ val = NULL;
+ }
+ }
+ axutil_hash_free(attributes, env);
+ attributes = NULL;
+ }
+}
+/* Implementations */
+AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+neethi_policy_get_policy_components(
+ neethi_policy_t *neethi_policy,
+ const axutil_env_t *env)
+{
+ return neethi_policy->policy_components;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_policy_add_policy_components(
+ neethi_policy_t *neethi_policy,
+ axutil_array_list_t *arraylist,
+ const axutil_env_t *env)
+{
+ int size = axutil_array_list_size(arraylist, env);
+ int i = 0;
+
+ if(axutil_array_list_ensure_capacity(neethi_policy->policy_components, env, size + 1)
+ != AXIS2_SUCCESS)
+ {
+ return AXIS2_FAILURE;
+ }
+
+ for(i = 0; i < size; i++)
+ {
+ void *value = NULL;
+ value = axutil_array_list_get(arraylist, env, i);
+ /* The ref count is incremented in order to prevent double frees.*/
+ neethi_operator_increment_ref((neethi_operator_t *)value, env);
+ axutil_array_list_add(neethi_policy->policy_components, env, value);
+ }
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_policy_add_operator(
+ neethi_policy_t *neethi_policy,
+ const axutil_env_t *env,
+ neethi_operator_t *operator)
+{
+ neethi_operator_increment_ref(operator, env);
+ axutil_array_list_add(neethi_policy->policy_components, env, operator);
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+neethi_policy_is_empty(
+ neethi_policy_t *neethi_policy,
+ const axutil_env_t *env)
+{
+ return axutil_array_list_is_empty(neethi_policy->policy_components, env);
+}
+
+/* A normalized policy always has just one child and it is an exactlyone
+ * first child. So this method */
+AXIS2_EXTERN neethi_exactlyone_t *AXIS2_CALL
+neethi_policy_get_exactlyone(
+ neethi_policy_t *normalized_neethi_policy,
+ const axutil_env_t *env)
+{
+ neethi_exactlyone_t *exactlyone = NULL;
+ axutil_array_list_t *list = NULL;
+
+ list = neethi_policy_get_policy_components(normalized_neethi_policy, env);
+ if(list)
+ {
+ if(axutil_array_list_size(list, env) == 1)
+ {
+ neethi_operator_t *op = NULL;
+ op = (neethi_operator_t *)axutil_array_list_get(list, env, 0);
+ if(!op)
+ {
+ return NULL;
+ }
+ if(neethi_operator_get_type(op, env) != OPERATOR_TYPE_EXACTLYONE)
+ {
+ return NULL;
+ }
+ exactlyone = (neethi_exactlyone_t *)neethi_operator_get_value(op, env);
+ return exactlyone;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+/* This function is called for a normalized policy So it will return the components of the only
+ * child. That should be an exactlyone The children of that exactlyone are all.*/
+AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+neethi_policy_get_alternatives(
+ neethi_policy_t *neethi_policy,
+ const axutil_env_t *env)
+{
+ neethi_exactlyone_t *exactlyone = NULL;
+ exactlyone = neethi_policy_get_exactlyone(neethi_policy, env);
+ if(!exactlyone)
+ return NULL;
+
+ return neethi_exactlyone_get_policy_components(exactlyone, env);
+
+}
+
+/* This will return any attribute which has the local name of Name */
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+neethi_policy_get_name(
+ neethi_policy_t *neethi_policy,
+ const axutil_env_t *env)
+{
+ if(neethi_policy->attributes)
+ {
+ axutil_qname_t *qname = NULL;
+ axis2_char_t *name = NULL;
+ qname = axutil_qname_create(env, NEETHI_NAME, NULL, NULL);
+
+ if(qname)
+ {
+ axis2_char_t *key = axutil_qname_to_string(qname, env);
+ if(key)
+ {
+ name = (axis2_char_t *)axutil_hash_get(neethi_policy->attributes, key,
+ AXIS2_HASH_KEY_STRING);
+ }
+ axutil_qname_free(qname, env);
+ qname = NULL;
+ return name;
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+/* This method will return the attribute value of wsu:Id if there are any such attributes */
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+neethi_policy_get_id(
+ neethi_policy_t *neethi_policy,
+ const axutil_env_t *env)
+{
+ if(neethi_policy->attributes)
+ {
+ axis2_char_t *id = NULL;
+ axutil_qname_t *qname = NULL;
+ qname = axutil_qname_create(env, NEETHI_ID, NEETHI_WSU_NS, NULL);
+
+ if(qname)
+ {
+ axis2_char_t *key = axutil_qname_to_string(qname, env);
+ if(key)
+ {
+ id = (axis2_char_t *)axutil_hash_get(neethi_policy->attributes, key,
+ AXIS2_HASH_KEY_STRING);
+ }
+ axutil_qname_free(qname, env);
+ qname = NULL;
+ return id;
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+/* When we encounter an attribute with wsu:Id we will store it in the hash. We are not
+ * considering the prefix. Just the namespace and the local_name. */
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_policy_set_id(
+ neethi_policy_t * neethi_policy,
+ const axutil_env_t * env,
+ axis2_char_t * id)
+{
+ axutil_qname_t *qname = NULL;
+ axis2_char_t *key = NULL;
+
+ qname = axutil_qname_create(env, NEETHI_ID, NEETHI_WSU_NS, NULL);
+
+ if(qname)
+ {
+ key = axutil_qname_to_string(qname, env);
+ if(key)
+ {
+ axutil_hash_set(neethi_policy->attributes, axutil_strdup(env, key),
+ AXIS2_HASH_KEY_STRING, axutil_strdup(env, id));
+ }
+ axutil_qname_free(qname, env);
+ return AXIS2_SUCCESS;
+ }
+ else
+ {
+ return AXIS2_FAILURE;
+ }
+}
+
+/* When we encounter an attribute with Name we will store it in the hash. This has no Namespace.*/
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_policy_set_name(
+ neethi_policy_t * neethi_policy,
+ const axutil_env_t * env,
+ axis2_char_t * name)
+{
+ axutil_qname_t *qname = NULL;
+ axis2_char_t *key = NULL;
+
+ qname = axutil_qname_create(env, NEETHI_NAME, NULL, NULL);
+
+ if(qname)
+ {
+ key = axutil_qname_to_string(qname, env);
+ if(key)
+ {
+ axutil_hash_set(neethi_policy->attributes, axutil_strdup(env, key),
+ AXIS2_HASH_KEY_STRING, axutil_strdup(env, name));
+ }
+ axutil_qname_free(qname, env);
+ return AXIS2_SUCCESS;
+ }
+ else
+ {
+ return AXIS2_FAILURE;
+ }
+}
+
+AXIS2_EXTERN axutil_hash_t *AXIS2_CALL
+neethi_policy_get_attributes(
+ neethi_policy_t *neethi_policy,
+ const axutil_env_t *env)
+{
+ return neethi_policy->attributes;
+}
+
+/*This function is for serializing*/
+AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+neethi_policy_serialize(
+ neethi_policy_t *neethi_policy,
+ axiom_node_t *parent,
+ const axutil_env_t *env)
+{
+ axiom_node_t *policy_node = NULL;
+ axiom_element_t *policy_ele = NULL;
+ axiom_namespace_t *policy_ns = NULL;
+ axutil_array_list_t *components = NULL;
+
+ policy_ns = axiom_namespace_create(env, NEETHI_NAMESPACE, NEETHI_PREFIX);
+ policy_ele = axiom_element_create(env, parent, NEETHI_POLICY, policy_ns, &policy_node);
+ if(!policy_ele)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "Cannot create policy node. Policy serialization failed");
+ return NULL;
+ }
+
+ components = neethi_policy_get_policy_components(neethi_policy, env);
+ if(components)
+ {
+ int i = 0;
+ axis2_status_t status = AXIS2_FAILURE;
+ for(i = 0; i < axutil_array_list_size(components, env); ++i)
+ {
+ neethi_operator_t *operator = NULL;
+ operator = (neethi_operator_t *)axutil_array_list_get(components, env, i);
+ if(operator)
+ {
+ status = neethi_operator_serialize(operator, env, policy_node);
+ if(status != AXIS2_SUCCESS)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Neethi operator serialization failed.");
+ return NULL;
+ }
+ }
+ }
+ }
+ return policy_node;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_policy_set_root_node(
+ neethi_policy_t *policy,
+ const axutil_env_t *env,
+ axiom_node_t *root_node)
+{
+ policy->root_node = root_node;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/reference.c b/neethi/src/reference.c
new file mode 100644
index 0000000..8b52a26
--- /dev/null
+++ b/neethi/src/reference.c
@@ -0,0 +1,104 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <neethi_reference.h>
+
+struct neethi_reference_t
+{
+ axis2_char_t *uri;
+};
+
+AXIS2_EXTERN neethi_reference_t *AXIS2_CALL
+neethi_reference_create(
+ const axutil_env_t *env)
+{
+ neethi_reference_t *neethi_reference = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ neethi_reference = (neethi_reference_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(neethi_reference_t));
+
+ if(neethi_reference == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ neethi_reference->uri = NULL;
+
+ return neethi_reference;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+neethi_reference_free(
+ neethi_reference_t *neethi_reference,
+ const axutil_env_t *env)
+{
+ if(neethi_reference)
+ {
+ AXIS2_FREE(env->allocator, neethi_reference);
+ neethi_reference = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+neethi_reference_get_uri(
+ neethi_reference_t *neethi_reference,
+ const axutil_env_t *env)
+{
+ return neethi_reference->uri;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_reference_set_uri(
+ neethi_reference_t *neethi_reference,
+ const axutil_env_t *env,
+ axis2_char_t *uri)
+{
+ neethi_reference->uri = uri;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_reference_serialize(
+ neethi_reference_t *neethi_reference,
+ axiom_node_t *parent,
+ const axutil_env_t *env)
+{
+ axiom_node_t *ref_node = NULL;
+ axiom_element_t *ref_ele = NULL;
+ axiom_namespace_t *policy_ns = NULL;
+ axiom_attribute_t *att_uri = NULL;
+
+ policy_ns = axiom_namespace_create(env, NEETHI_NAMESPACE, NEETHI_PREFIX);
+ ref_ele = axiom_element_create(env, parent, NEETHI_REFERENCE, policy_ns, &ref_node);
+ if(!ref_node)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "'reference' node creation failed. Cannot serialize 'reference' assertion");
+ return AXIS2_FAILURE;
+ }
+
+ att_uri = axiom_attribute_create(env, NEETHI_URI, neethi_reference->uri, NULL);
+ axiom_element_add_attribute(ref_ele, env, att_uri, ref_node);
+
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/registry.c b/neethi/src/registry.c
new file mode 100644
index 0000000..4ba0851
--- /dev/null
+++ b/neethi/src/registry.c
@@ -0,0 +1,131 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <neethi_registry.h>
+
+struct neethi_registry_t
+{
+ axutil_hash_t *registry;
+ neethi_registry_t *parent;
+};
+
+AXIS2_EXTERN neethi_registry_t *AXIS2_CALL
+neethi_registry_create(
+ const axutil_env_t *env)
+{
+ neethi_registry_t *neethi_registry = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ neethi_registry = (neethi_registry_t *)AXIS2_MALLOC(env->allocator, sizeof(neethi_registry_t));
+
+ if(neethi_registry == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ neethi_registry->registry = NULL;
+
+ neethi_registry->registry = axutil_hash_make(env);
+ if(!(neethi_registry->registry))
+ {
+ neethi_registry_free(neethi_registry, env);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ neethi_registry->parent = NULL;
+
+ return neethi_registry;
+}
+
+AXIS2_EXTERN neethi_registry_t *AXIS2_CALL
+neethi_registry_create_with_parent(
+ const axutil_env_t *env,
+ neethi_registry_t *parent)
+{
+ neethi_registry_t *neethi_registry = NULL;
+
+ neethi_registry = neethi_registry_create(env);
+ if(!neethi_registry)
+ return NULL;
+
+ neethi_registry->parent = parent;
+ return neethi_registry;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+neethi_registry_free(
+ neethi_registry_t *neethi_registry,
+ const axutil_env_t *env)
+{
+ if(neethi_registry->registry)
+ {
+ axutil_hash_index_t *hi = NULL;
+ void *val = NULL;
+ for(hi = axutil_hash_first(neethi_registry->registry, env); hi; hi = axutil_hash_next(env,
+ hi))
+ {
+ neethi_policy_t *neethi_policy = NULL;
+ axutil_hash_this(hi, NULL, NULL, &val);
+ neethi_policy = (neethi_policy_t *)val;
+ if(neethi_policy)
+ neethi_policy_free(neethi_policy, env);
+ val = NULL;
+ neethi_policy = NULL;
+
+ }
+ axutil_hash_free(neethi_registry->registry, env);
+ }
+ if(neethi_registry->parent)
+ {
+ neethi_registry->parent = NULL;
+ }
+ AXIS2_FREE(env->allocator, neethi_registry);
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_registry_register(
+ neethi_registry_t *neethi_registry,
+ const axutil_env_t *env,
+ axis2_char_t *key,
+ neethi_policy_t *value)
+{
+ axutil_hash_set(neethi_registry->registry, key, AXIS2_HASH_KEY_STRING, value);
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN neethi_policy_t *AXIS2_CALL
+neethi_registry_lookup(
+ neethi_registry_t *neethi_registry,
+ const axutil_env_t *env,
+ axis2_char_t *key)
+{
+ neethi_policy_t *policy = NULL;
+
+ policy = (neethi_policy_t *)axutil_hash_get(neethi_registry->registry, key,
+ AXIS2_HASH_KEY_STRING);
+
+ if(!policy && neethi_registry->parent)
+ {
+ return neethi_registry_lookup(neethi_registry->parent, env, key);
+ }
+ return policy;
+}
diff --git a/neethi/src/rmpolicy/Makefile.am b/neethi/src/rmpolicy/Makefile.am
new file mode 100644
index 0000000..1b46d73
--- /dev/null
+++ b/neethi/src/rmpolicy/Makefile.am
@@ -0,0 +1,13 @@
+TESTS =
+
+noinst_LTLIBRARIES = librm_policy.la
+
+librm_policy_la_SOURCES = rm_assertion.c rm_assertion_builder.c
+
+librm_policy_la_LIBADD = ../../../util/src/libaxutil.la
+
+INCLUDES = -I$(top_builddir)/include \
+ -I ../../include \
+ -I ../../../util/include \
+ -I ../../../axiom/include \
+ -I ../../../include
diff --git a/neethi/src/rmpolicy/rm_assertion.c b/neethi/src/rmpolicy/rm_assertion.c
new file mode 100644
index 0000000..42f0fd4
--- /dev/null
+++ b/neethi/src/rmpolicy/rm_assertion.c
@@ -0,0 +1,511 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <axis2_rm_assertion.h>
+#include <neethi_assertion.h>
+#include <neethi_all.h>
+
+struct axis2_rm_assertion_t
+{
+ /* RM Policy 1.1 assertions */
+ axis2_bool_t is_sequence_str;
+ axis2_bool_t is_sequence_transport_security;
+ axis2_bool_t is_exactly_once;
+ axis2_bool_t is_atleast_once;
+ axis2_bool_t is_atmost_once;
+ axis2_bool_t is_inorder;
+
+ /* RM Policy 1.0 assertions */
+ axis2_char_t *inactivity_timeout;
+ axis2_char_t *retrans_interval;
+ axis2_char_t *ack_interval;
+ axis2_bool_t is_exp_backoff;
+
+ /* Sandesha2 specific assrtions */
+ axis2_char_t *storage_mgr;
+ axis2_char_t *message_types_to_drop;
+ axis2_char_t *max_retrans_count;
+ axis2_char_t *sender_sleep_time;
+ axis2_char_t *invoker_sleep_time;
+ axis2_char_t *polling_wait_time;
+ axis2_char_t *terminate_delay;
+ axis2_char_t *sandesha2_db;
+ axis2_char_t *spec_version;
+};
+
+AXIS2_EXTERN axis2_rm_assertion_t *AXIS2_CALL
+axis2_rm_assertion_create(
+ const axutil_env_t * env)
+{
+ axis2_rm_assertion_t *rm_assertion;
+
+ rm_assertion = (axis2_rm_assertion_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(axis2_rm_assertion_t));
+
+ if(rm_assertion == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ rm_assertion->is_sequence_str = AXIS2_FALSE;
+ rm_assertion->is_sequence_transport_security = AXIS2_FALSE;
+ rm_assertion->is_exactly_once = AXIS2_TRUE;
+ rm_assertion->is_atleast_once = AXIS2_FALSE;
+ rm_assertion->is_atmost_once = AXIS2_FALSE;
+ rm_assertion->is_inorder = AXIS2_FALSE;
+
+ /* RM Policy 1.0 assertions */
+ rm_assertion->inactivity_timeout = NULL;
+ rm_assertion->retrans_interval = NULL;
+ rm_assertion->ack_interval = NULL;
+ rm_assertion->is_exp_backoff = AXIS2_FALSE;
+
+ /* Sandesha2 specific assrtions */
+ rm_assertion->storage_mgr = NULL;
+ rm_assertion->message_types_to_drop = NULL;
+ rm_assertion->max_retrans_count = NULL;
+ rm_assertion->sender_sleep_time = NULL;
+ rm_assertion->invoker_sleep_time = NULL;
+ rm_assertion->polling_wait_time = NULL;
+ rm_assertion->terminate_delay = NULL;
+ rm_assertion->sandesha2_db = NULL;
+ rm_assertion->spec_version = NULL;
+
+ return rm_assertion;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+axis2_rm_assertion_free(
+ axis2_rm_assertion_t * rm_assertion,
+ const axutil_env_t * env)
+{
+ if(rm_assertion)
+ {
+ AXIS2_FREE(env->allocator, rm_assertion);
+ rm_assertion = NULL;
+ }
+
+ return;
+}
+
+/* Implementations.
+ * Following functions are getters and setters
+ * for rm_assertion struct */
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+axis2_rm_assertion_get_is_sequence_str(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env)
+{
+ return rm_assertion->is_sequence_str;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_rm_assertion_set_is_sequence_str(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_bool_t is_sequence_str)
+{
+ rm_assertion->is_sequence_str = is_sequence_str;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+axis2_rm_assertion_get_is_sequence_transport_security(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env)
+{
+ return rm_assertion->is_sequence_transport_security;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_rm_assertion_set_is_sequence_transport_security(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_bool_t is_sequence_transport_security)
+{
+ rm_assertion->is_sequence_transport_security = is_sequence_transport_security;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+axis2_rm_assertion_get_is_exactly_once(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env)
+{
+ return rm_assertion->is_exactly_once;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_rm_assertion_set_is_exactly_once(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_bool_t is_exactly_once)
+{
+ rm_assertion->is_exactly_once = is_exactly_once;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+axis2_rm_assertion_get_is_atleast_once(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env)
+{
+ return rm_assertion->is_atleast_once;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_rm_assertion_set_is_atleast_once(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_bool_t is_atleast_once)
+{
+ rm_assertion->is_atleast_once = is_atleast_once;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+axis2_rm_assertion_get_is_atmost_once(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env)
+{
+ return rm_assertion->is_atmost_once;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_rm_assertion_set_is_atmost_once(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_bool_t is_atmost_once)
+{
+ rm_assertion->is_atmost_once = is_atmost_once;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+axis2_rm_assertion_get_is_inorder(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env)
+{
+ return rm_assertion->is_inorder;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_rm_assertion_set_is_inorder(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_bool_t is_inorder)
+{
+ rm_assertion->is_inorder = is_inorder;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+axis2_rm_assertion_get_inactivity_timeout(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env)
+{
+ return rm_assertion->inactivity_timeout;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_rm_assertion_set_inactivity_timeout(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* inactivity_timeout)
+{
+ rm_assertion->inactivity_timeout = inactivity_timeout;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+axis2_rm_assertion_get_retrans_interval(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env)
+{
+ return rm_assertion->retrans_interval;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_rm_assertion_set_retrans_interval(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* retrans_interval)
+{
+ rm_assertion->retrans_interval = retrans_interval;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+axis2_rm_assertion_get_ack_interval(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env)
+{
+ return rm_assertion->ack_interval;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_rm_assertion_set_ack_interval(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* ack_interval)
+{
+ rm_assertion->ack_interval = ack_interval;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+axis2_rm_assertion_get_is_exp_backoff(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env)
+{
+ return rm_assertion->is_exp_backoff;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_rm_assertion_set_is_exp_backoff(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_bool_t is_exp_backoff)
+{
+ rm_assertion->is_exp_backoff = is_exp_backoff;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+axis2_rm_assertion_get_storage_mgr(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env)
+{
+ return rm_assertion->storage_mgr;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_rm_assertion_set_storage_mgr(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* storage_mgr)
+{
+ rm_assertion->storage_mgr = storage_mgr;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+axis2_rm_assertion_get_message_types_to_drop(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env)
+{
+ return rm_assertion->message_types_to_drop;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_rm_assertion_set_message_types_to_drop(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* message_types_to_drop)
+{
+ rm_assertion->message_types_to_drop = message_types_to_drop;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+axis2_rm_assertion_get_max_retrans_count(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env)
+{
+ return rm_assertion->max_retrans_count;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_rm_assertion_set_max_retrans_count(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* max_retrans_count)
+{
+ rm_assertion->max_retrans_count = max_retrans_count;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+axis2_rm_assertion_get_sender_sleep_time(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env)
+{
+ return rm_assertion->sender_sleep_time;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_rm_assertion_set_sender_sleep_time(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* sender_sleep_time)
+{
+ rm_assertion->sender_sleep_time = sender_sleep_time;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+axis2_rm_assertion_get_invoker_sleep_time(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env)
+{
+ return rm_assertion->invoker_sleep_time;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_rm_assertion_set_invoker_sleep_time(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* invoker_sleep_time)
+{
+ rm_assertion->invoker_sleep_time = invoker_sleep_time;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+axis2_rm_assertion_get_polling_wait_time(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env)
+{
+ return rm_assertion->polling_wait_time;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_rm_assertion_set_polling_wait_time(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* polling_wait_time)
+{
+ rm_assertion->polling_wait_time = polling_wait_time;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+axis2_rm_assertion_get_terminate_delay(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env)
+{
+ return rm_assertion->terminate_delay;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_rm_assertion_set_terminate_delay(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* terminate_delay)
+{
+ rm_assertion->terminate_delay = terminate_delay;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+axis2_rm_assertion_get_sandesha2_db(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env)
+{
+ return rm_assertion->sandesha2_db;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_rm_assertion_set_sandesha2_db(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* sandesha2_db)
+{
+ rm_assertion->sandesha2_db = sandesha2_db;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+axis2_rm_assertion_get_spec_version(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env)
+{
+ return rm_assertion->spec_version;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axis2_rm_assertion_set_spec_version(
+ axis2_rm_assertion_t *rm_assertion,
+ const axutil_env_t * env,
+ axis2_char_t* spec_version)
+{
+ rm_assertion->spec_version = spec_version;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_rm_assertion_t* AXIS2_CALL
+axis2_rm_assertion_get_from_policy(
+ const axutil_env_t *env,
+ neethi_policy_t *policy)
+{
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_operator_t *operator = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+ int i = 0;
+
+ alternatives = neethi_policy_get_alternatives(policy, env);
+
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(value)
+ {
+ if(type == ASSERTION_TYPE_RM_ASSERTION)
+ {
+ return (axis2_rm_assertion_t *)value;
+ }
+ }
+ }
+
+ return NULL;
+}
+
diff --git a/neethi/src/rmpolicy/rm_assertion_builder.c b/neethi/src/rmpolicy/rm_assertion_builder.c
new file mode 100644
index 0000000..9b92fd7
--- /dev/null
+++ b/neethi/src/rmpolicy/rm_assertion_builder.c
@@ -0,0 +1,562 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <axis2_rm_assertion_builder.h>
+
+/*private functions*/
+
+static axis2_status_t AXIS2_CALL
+axis2_rm_assertion_builder_process_sandesha2_assertions(
+ const axutil_env_t *env,
+ axis2_rm_assertion_t *rm_assertion,
+ axiom_node_t *node,
+ axiom_element_t *element);
+
+static axis2_status_t AXIS2_CALL
+axis2_rm_assertion_builder_populate_for_10(
+ const axutil_env_t *env,
+ axis2_rm_assertion_t *rm_assertion,
+ axiom_node_t *rm_assertion_node,
+ axiom_element_t *rm_assertion_element);
+
+static axis2_status_t AXIS2_CALL
+axis2_rm_assertion_builder_populate_for_11(
+ const axutil_env_t *env,
+ axis2_rm_assertion_t *rm_assertion,
+ axiom_node_t *rm_assertion_node,
+ axiom_element_t *rm_assertion_element);
+
+static axis2_status_t AXIS2_CALL
+axis2_rm_assertion_builder_process_delivery_assuarance(
+ const axutil_env_t *env,
+ axis2_rm_assertion_t *rm_assertion,
+ axiom_node_t *da_node,
+ axiom_element_t *da_element);
+
+/* This functions retrives a rm_assertion axiom_node
+ * which may be 1.0 or 1.1 and return a rm_assertion
+ * struct */
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+axis2_rm_assertion_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *rm_assertion_node,
+ axiom_element_t *rm_assertion_ele)
+{
+ axis2_rm_assertion_t *rm_assertion = NULL;
+ axis2_status_t status = AXIS2_SUCCESS;
+ axiom_children_iterator_t *children_iter = NULL;
+ neethi_assertion_t *assertion = NULL;
+ axis2_char_t *ns = NULL;
+ axutil_qname_t *node_qname = NULL;
+
+ node_qname = axiom_element_get_qname(rm_assertion_ele, env, rm_assertion_node);
+ if(!node_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Cannot get qname from element");
+ return NULL;
+ }
+
+ ns = axutil_qname_get_uri(node_qname, env);
+ if(!ns)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Cannot get namespace from element.");
+ return NULL;
+ }
+
+ rm_assertion = axis2_rm_assertion_create(env);
+ if(!rm_assertion)
+ {
+ return NULL;
+ }
+
+ /* First we check whether this is in 1.0 or 1.1
+ * namespace. Then we called the appropriate builder */
+
+ children_iter = axiom_element_get_children(rm_assertion_ele, env, rm_assertion_node);
+
+ if(!axutil_strcmp(ns, AXIS2_RM_POLICY_10_NS))
+ {
+ status = axis2_rm_assertion_builder_populate_for_10(env, rm_assertion, rm_assertion_node,
+ rm_assertion_ele);
+
+ axiom_children_iterator_reset(children_iter, env);
+
+ }
+ else if(!axutil_strcmp(ns, AXIS2_RM_POLICY_11_NS))
+ {
+ status = axis2_rm_assertion_builder_populate_for_11(env, rm_assertion, rm_assertion_node,
+ rm_assertion_ele);
+ }
+
+ if(status == AXIS2_FAILURE)
+ {
+ axis2_rm_assertion_free(rm_assertion, env);
+ rm_assertion = NULL;
+ return NULL;
+ }
+
+ /*children_iter = axiom_element_get_children(rm_assertion_ele, env, rm_assertion_node);*/
+ if(children_iter)
+ {
+ while(axiom_children_iterator_has_next(children_iter, env))
+ {
+ axiom_node_t *node = NULL;
+ axiom_element_t *ele = NULL;
+ axis2_char_t *local_name = NULL;
+ axutil_qname_t *node_qname = NULL;
+
+ node = axiom_children_iterator_next(children_iter, env);
+ if(node)
+ {
+ if(axiom_node_get_node_type(node, env) == AXIOM_ELEMENT)
+ {
+ ele = (axiom_element_t *)axiom_node_get_data_element(node, env);
+ node_qname = axiom_element_get_qname(ele, env, node);
+ if(!node_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Cannot get qname from element %s.", local_name);
+ return NULL;
+ }
+ ns = axutil_qname_get_uri(node_qname, env);
+ if(!ns)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Cannot get namespace from element %s.", local_name);
+ return NULL;
+ }
+ if(!axutil_strcmp(ns, AXIS2_SANDESHA2_NS))
+ {
+ status = axis2_rm_assertion_builder_process_sandesha2_assertions(env,
+ rm_assertion, node, ele);
+ if(status == AXIS2_FAILURE)
+ {
+ axis2_rm_assertion_free(rm_assertion, env);
+ rm_assertion = NULL;
+ return NULL;
+ }
+ }
+ }
+ }
+ }
+ }
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)axis2_rm_assertion_free, rm_assertion, ASSERTION_TYPE_RM_ASSERTION);
+ return assertion;
+}
+
+static axis2_status_t AXIS2_CALL
+axis2_rm_assertion_builder_populate_for_10(
+ const axutil_env_t *env,
+ axis2_rm_assertion_t *rm_assertion,
+ axiom_node_t *rm_assertion_node,
+ axiom_element_t *rm_assertion_element)
+{
+ axiom_children_iterator_t *children_iter = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
+
+ /* In rm 1.0 it is just child elements which inside
+ * rm_assertion contains all the properties. */
+
+ status = axis2_rm_assertion_set_spec_version(rm_assertion, env, RM_SPEC_VERSION_1_0);
+
+ children_iter = axiom_element_get_children(rm_assertion_element, env, rm_assertion_node);
+ if(children_iter)
+ {
+ while(axiom_children_iterator_has_next(children_iter, env))
+ {
+ axiom_node_t *node = NULL;
+ axiom_element_t *ele = NULL;
+ axis2_char_t *local_name = NULL;
+ node = axiom_children_iterator_next(children_iter, env);
+ if(node)
+ {
+ if(axiom_node_get_node_type(node, env) == AXIOM_ELEMENT)
+ {
+ ele = (axiom_element_t *)axiom_node_get_data_element(node, env);
+ if(ele)
+ {
+ axutil_qname_t *node_qname = NULL;
+ axis2_char_t *ns = NULL;
+ node_qname = axiom_element_get_qname(ele, env, node);
+ if(!node)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Cannot get qname from element");
+ return AXIS2_FAILURE;
+ }
+
+ ns = axutil_qname_get_uri(node_qname, env);
+ if(!ns)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Cannot get namespace from element.");
+ return AXIS2_FAILURE;
+ }
+
+ if(axutil_strcmp(ns, AXIS2_RM_POLICY_10_NS))
+ {
+ continue;
+ }
+
+ local_name = axiom_element_get_localname(ele, env);
+ if(local_name)
+ {
+
+ if(!axutil_strcmp(local_name, AXIS2_RM_INACTIVITY_TIMEOUT))
+ {
+ axis2_char_t *inactivity_timeout = NULL;
+ axutil_qname_t *qname = NULL;
+
+ qname = axutil_qname_create(env, "Milliseconds", NULL, NULL);
+
+ inactivity_timeout = axiom_element_get_attribute_value(ele, env,
+ qname);
+ if(qname)
+ {
+ axutil_qname_free(qname, env);
+ qname = NULL;
+ }
+ status = axis2_rm_assertion_set_inactivity_timeout(rm_assertion,
+ env, inactivity_timeout);
+ }
+ else if(!axutil_strcmp(local_name,
+ AXIS2_RM_BASE_RETRANSMISSION_INTERVAL))
+ {
+ axis2_char_t *rti = NULL;
+ axutil_qname_t *qname = NULL;
+ qname = axutil_qname_create(env, "Milliseconds", NULL, NULL);
+
+ rti = axiom_element_get_attribute_value(ele, env, qname);
+ if(qname)
+ {
+ axutil_qname_free(qname, env);
+ qname = NULL;
+ }
+ status = axis2_rm_assertion_set_retrans_interval(rm_assertion, env,
+ rti);
+ }
+ else if(!axutil_strcmp(local_name, AXIS2_RM_EXPONENTIAL_BACK_OFF))
+ {
+ status = axis2_rm_assertion_set_is_exp_backoff(rm_assertion, env,
+ AXIS2_TRUE);
+ }
+ else if(!axutil_strcmp(local_name, AXIS2_RM_ACKNOWLEDGEMENT_INTERVAL))
+ {
+ axis2_char_t *ack_interval = NULL;
+ axutil_qname_t *qname = NULL;
+
+ qname = axutil_qname_create(env, "Milliseconds", NULL, NULL);
+
+ ack_interval = axiom_element_get_attribute_value(ele, env, qname);
+ if(qname)
+ {
+ axutil_qname_free(qname, env);
+ qname = NULL;
+ }
+ status = axis2_rm_assertion_set_ack_interval(rm_assertion, env,
+ ack_interval);
+ }
+ else
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Unknown Assertion %s ", local_name);
+ return AXIS2_FAILURE;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return status;
+}
+
+/* In rm 1.1 rm_assertion contains a policy element as
+ * a child element. We are not creating a policy object
+ * for policy element. Becasue then the processing become
+ * complex.So we just parse the axiom model */
+
+static axis2_status_t AXIS2_CALL
+axis2_rm_assertion_builder_populate_for_11(
+ const axutil_env_t *env,
+ axis2_rm_assertion_t *rm_assertion,
+ axiom_node_t *rm_assertion_node,
+ axiom_element_t *rm_assertion_element)
+{
+ axiom_children_iterator_t *children_iter = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+
+ status = axis2_rm_assertion_set_spec_version(rm_assertion, env, RM_SPEC_VERSION_1_1);
+
+ child_node = axiom_node_get_first_element(rm_assertion_node, env);
+ if(child_node)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ children_iter = axiom_element_get_children(child_element, env, child_node);
+ if(children_iter)
+ {
+ while(axiom_children_iterator_has_next(children_iter, env))
+ {
+ axiom_node_t *node = NULL;
+ axiom_element_t *ele = NULL;
+ axis2_char_t *local_name = NULL;
+ node = axiom_children_iterator_next(children_iter, env);
+ if(node)
+ {
+ if(axiom_node_get_node_type(node, env) == AXIOM_ELEMENT)
+ {
+ ele = (axiom_element_t *)axiom_node_get_data_element(node, env);
+ if(ele)
+ {
+ axutil_qname_t *node_qname = NULL;
+ axis2_char_t *ns = NULL;
+ node_qname = axiom_element_get_qname(ele, env, node);
+ if(!node)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Cannot get qname from element");
+ return AXIS2_FAILURE;
+ }
+
+ ns = axutil_qname_get_uri(node_qname, env);
+ if(!ns)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Cannot get namespace from element.");
+ return AXIS2_FAILURE;
+ }
+
+ if(axutil_strcmp(ns, AXIS2_RM_POLICY_11_NS))
+ {
+ continue;
+ }
+ local_name = axiom_element_get_localname(ele, env);
+ if(local_name)
+ {
+ if(!axutil_strcmp(local_name, AXIS2_RM_SEQUENCE_STR))
+ {
+ status = axis2_rm_assertion_set_is_sequence_str(
+ rm_assertion, env, AXIS2_TRUE);
+ }
+ else if(!axutil_strcmp(local_name,
+ AXIS2_RM_SEQUENCE_TRANSPORT_SECURITY))
+ {
+ status
+ = axis2_rm_assertion_set_is_sequence_transport_security(
+ rm_assertion, env, AXIS2_TRUE);
+ }
+ else if(!axutil_strcmp(local_name, AXIS2_RM_DELIVERY_ASSURANCE))
+ {
+ status
+ = axis2_rm_assertion_builder_process_delivery_assuarance(
+ env, rm_assertion, node, ele);
+ }
+ else
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Unknown Assertion %s ", local_name);
+ return AXIS2_FAILURE;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return status;
+}
+
+static axis2_status_t AXIS2_CALL
+axis2_rm_assertion_builder_process_delivery_assuarance(
+ const axutil_env_t *env,
+ axis2_rm_assertion_t *rm_assertion,
+ axiom_node_t *da_node,
+ axiom_element_t *da_element)
+{
+ axiom_children_iterator_t *children_iter = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+
+ child_node = axiom_node_get_first_element(da_node, env);
+ if(child_node)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ children_iter = axiom_element_get_children(child_element, env, child_node);
+ if(children_iter)
+ {
+ while(axiom_children_iterator_has_next(children_iter, env))
+ {
+ axiom_node_t *node = NULL;
+ axiom_element_t *ele = NULL;
+ axis2_char_t *local_name = NULL;
+ node = axiom_children_iterator_next(children_iter, env);
+ if(node)
+ {
+ if(axiom_node_get_node_type(node, env) == AXIOM_ELEMENT)
+ {
+ ele = (axiom_element_t *)axiom_node_get_data_element(node, env);
+ if(ele)
+ {
+ local_name = axiom_element_get_localname(ele, env);
+ if(local_name)
+ {
+ if(!axutil_strcmp(local_name, AXIS2_RM_EXACTLY_ONCE))
+ {
+ status = axis2_rm_assertion_set_is_exactly_once(
+ rm_assertion, env, AXIS2_TRUE);
+ }
+ else if(!axutil_strcmp(local_name, AXIS2_RM_AT_LEAST_ONCE))
+ {
+ status = axis2_rm_assertion_set_is_atleast_once(
+ rm_assertion, env, AXIS2_TRUE);
+ }
+ else if(!axutil_strcmp(local_name, AXIS2_RM_AT_MOST_ONCE))
+ {
+ status = axis2_rm_assertion_set_is_atmost_once(
+ rm_assertion, env, AXIS2_TRUE);
+ }
+ else if(!axutil_strcmp(local_name, AXIS2_RM_IN_ORDER))
+ {
+ status = axis2_rm_assertion_set_is_inorder(rm_assertion,
+ env, AXIS2_TRUE);
+ }
+ else
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Unknown Assertion %s ", local_name);
+ return AXIS2_FAILURE;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return status;
+}
+
+static axis2_status_t AXIS2_CALL
+axis2_rm_assertion_builder_process_sandesha2_assertions(
+ const axutil_env_t *env,
+ axis2_rm_assertion_t *rm_assertion,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ axis2_status_t status = AXIS2_FAILURE;
+ axis2_char_t *local_name = NULL;
+
+ if(element)
+ {
+ local_name = axiom_element_get_localname(element, env);
+ if(local_name)
+ {
+ if(!axutil_strcmp(local_name, AXIS2_RM_BASE_RETRANSMISSION_INTERVAL))
+ {
+ axis2_char_t *rti = NULL;
+ rti = axiom_element_get_text(element, env, node);
+ return axis2_rm_assertion_set_retrans_interval(rm_assertion, env, rti);
+ }
+ else if(!axutil_strcmp(local_name, AXIS2_RM_INACTIVITY_TIMEOUT))
+ {
+ axis2_char_t *inactivity_timeout = NULL;
+ inactivity_timeout = axiom_element_get_text(element, env, node);
+ return axis2_rm_assertion_set_inactivity_timeout(rm_assertion, env,
+ inactivity_timeout);
+ }
+ else if(!axutil_strcmp(local_name, AXIS2_RM_ACKNOWLEDGEMENT_INTERVAL))
+ {
+ axis2_char_t *ack_interval = NULL;
+ ack_interval = axiom_element_get_text(element, env, node);
+ return axis2_rm_assertion_set_ack_interval(rm_assertion, env, ack_interval);
+ }
+ else if(!axutil_strcmp(local_name, AXIS2_RM_STORAGE_MANAGER))
+ {
+ axis2_char_t *storage_mgr = NULL;
+ storage_mgr = axiom_element_get_text(element, env, node);
+ return axis2_rm_assertion_set_storage_mgr(rm_assertion, env, storage_mgr);
+ }
+ else if(!axutil_strcmp(local_name, AXIS2_RM_SANDESHA2_DB))
+ {
+ axis2_char_t *sandesha2_db = NULL;
+ sandesha2_db = axiom_element_get_text(element, env, node);
+ return axis2_rm_assertion_set_sandesha2_db(rm_assertion, env, sandesha2_db);
+ }
+ else if(!axutil_strcmp(local_name, AXIS2_RM_MESSAGE_TYPES_TO_DROP))
+ {
+ axis2_char_t *message_types_to_drop = NULL;
+ message_types_to_drop = axiom_element_get_text(element, env, node);
+ return axis2_rm_assertion_set_message_types_to_drop(rm_assertion, env,
+ message_types_to_drop);
+ }
+ else if(!axutil_strcmp(local_name, AXIS2_RM_MAX_RETRANS_COUNT))
+ {
+ axis2_char_t *retrans_count = NULL;
+ retrans_count = axiom_element_get_text(element, env, node);
+ return axis2_rm_assertion_set_max_retrans_count(rm_assertion, env, retrans_count);
+ }
+ else if(!axutil_strcmp(local_name, AXIS2_RM_SENDER_SLEEP_TIME))
+ {
+ axis2_char_t *sender_sleep_time = NULL;
+ sender_sleep_time = axiom_element_get_text(element, env, node);
+ return axis2_rm_assertion_set_sender_sleep_time(rm_assertion, env,
+ sender_sleep_time);
+ }
+ else if(!axutil_strcmp(local_name, AXIS2_RM_INVOKER_SLEEP_TIME))
+ {
+ axis2_char_t *invoker_sleep_time = NULL;
+ invoker_sleep_time = axiom_element_get_text(element, env, node);
+ return axis2_rm_assertion_set_invoker_sleep_time(rm_assertion, env,
+ invoker_sleep_time);
+ }
+ else if(!axutil_strcmp(local_name, AXIS2_RM_POLLING_WAIT_TIME))
+ {
+ axis2_char_t *polling_wait_time = NULL;
+ polling_wait_time = axiom_element_get_text(element, env, node);
+ return axis2_rm_assertion_set_polling_wait_time(rm_assertion, env,
+ polling_wait_time);
+ }
+ else if(!axutil_strcmp(local_name, AXIS2_RM_TERMINATE_DELAY))
+ {
+ axis2_char_t *terminate_delay = NULL;
+ terminate_delay = axiom_element_get_text(element, env, node);
+ return axis2_rm_assertion_set_terminate_delay(rm_assertion, env, terminate_delay);
+ }
+ else
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Unknown Assertion %s ",
+ local_name);
+ return AXIS2_FAILURE;
+ }
+ }
+ }
+ return status;
+}
+
diff --git a/neethi/src/samples/test1.xml b/neethi/src/samples/test1.xml
new file mode 100644
index 0000000..6cf1539
--- /dev/null
+++ b/neethi/src/samples/test1.xml
@@ -0,0 +1,4 @@
+
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne />
+</wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/samples/test10.xml b/neethi/src/samples/test10.xml
new file mode 100644
index 0000000..0c16d15
--- /dev/null
+++ b/neethi/src/samples/test10.xml
@@ -0,0 +1 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" ><!-- 1E --><wsp:ExactlyOne /></wsp:Policy>
diff --git a/neethi/src/samples/test11.xml b/neethi/src/samples/test11.xml
new file mode 100644
index 0000000..453688a
--- /dev/null
+++ b/neethi/src/samples/test11.xml
@@ -0,0 +1 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" ><!-- 1F --><wsp:All /></wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/samples/test12.xml b/neethi/src/samples/test12.xml
new file mode 100644
index 0000000..322d865
--- /dev/null
+++ b/neethi/src/samples/test12.xml
@@ -0,0 +1 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:sec="http://schemas.xmlsoap.org/ws/2002/12/secext" ><!-- 1G --><wsp:All><sec:SecurityToken><sec:TokenType>sec:X509v3</sec:TokenType></sec:SecurityToken><sec:Integrity><sec:MessageParts Dialect="http://schemas.xmlsoap.org/ws/2002/12/wsse#soap" >wsp:Body()</sec:MessageParts></sec:Integrity><sec:SecurityHeader MustPrepend="true" MustManifestEncryption="true" /></wsp:All></wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/samples/test13.xml b/neethi/src/samples/test13.xml
new file mode 100644
index 0000000..7817caf
--- /dev/null
+++ b/neethi/src/samples/test13.xml
@@ -0,0 +1 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" ><!-- 1H --><wsp:All><wsp:Policy /></wsp:All></wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/samples/test14.xml b/neethi/src/samples/test14.xml
new file mode 100644
index 0000000..00dcab5
--- /dev/null
+++ b/neethi/src/samples/test14.xml
@@ -0,0 +1 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" ><!-- 1I --><wsp:All><wsp:All /></wsp:All></wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/samples/test15.xml b/neethi/src/samples/test15.xml
new file mode 100644
index 0000000..d8b2e20
--- /dev/null
+++ b/neethi/src/samples/test15.xml
@@ -0,0 +1 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" ><!-- 1J --><wsp:All><wsp:ExactlyOne /></wsp:All></wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/samples/test16.xml b/neethi/src/samples/test16.xml
new file mode 100644
index 0000000..7304862
--- /dev/null
+++ b/neethi/src/samples/test16.xml
@@ -0,0 +1 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" ><!-- 1K --><wsp:ExactlyOne /></wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/samples/test17.xml b/neethi/src/samples/test17.xml
new file mode 100644
index 0000000..fc995b1
--- /dev/null
+++ b/neethi/src/samples/test17.xml
@@ -0,0 +1 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:sec="http://schemas.xmlsoap.org/ws/2002/12/secext" ><!-- 1L --><wsp:ExactlyOne><sec:SecurityToken><sec:TokenType>sec:X509v3</sec:TokenType></sec:SecurityToken><sec:SecurityToken><sec:TokenType>sec:Kerberosv5TGT</sec:TokenType></sec:SecurityToken><sec:SecurityToken><sec:TokenType>sec:Kerberosv5ST</sec:TokenType></sec:SecurityToken></wsp:ExactlyOne></wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/samples/test18.xml b/neethi/src/samples/test18.xml
new file mode 100644
index 0000000..0c6f9dc
--- /dev/null
+++ b/neethi/src/samples/test18.xml
@@ -0,0 +1 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" ><wsp:ExactlyOne><wsp:Policy /></wsp:ExactlyOne></wsp:Policy>
diff --git a/neethi/src/samples/test19.xml b/neethi/src/samples/test19.xml
new file mode 100644
index 0000000..243054a
--- /dev/null
+++ b/neethi/src/samples/test19.xml
@@ -0,0 +1 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" ><!-- 1N --><wsp:ExactlyOne><wsp:All /></wsp:ExactlyOne></wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/samples/test2.xml b/neethi/src/samples/test2.xml
new file mode 100644
index 0000000..13d7a1b
--- /dev/null
+++ b/neethi/src/samples/test2.xml
@@ -0,0 +1 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"><wsp:ExactlyOne><wsp:All /></wsp:ExactlyOne></wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/samples/test20.xml b/neethi/src/samples/test20.xml
new file mode 100644
index 0000000..be83fae
--- /dev/null
+++ b/neethi/src/samples/test20.xml
@@ -0,0 +1 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" ><wsp:ExactlyOne><wsp:ExactlyOne /></wsp:ExactlyOne></wsp:Policy>
diff --git a/neethi/src/samples/test21.xml b/neethi/src/samples/test21.xml
new file mode 100644
index 0000000..aecc311
--- /dev/null
+++ b/neethi/src/samples/test21.xml
@@ -0,0 +1,10 @@
+
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:sec="http://schemas.xmlsoap.org/ws/2002/12/secext"><!-- 2 -->
+ <sec:SecurityToken>
+ <sec:TokenType>sec:X509v3</sec:TokenType>
+ </sec:SecurityToken>
+ <sec:SecurityHeader wsp:Optional="true" MustPrepend="true" MustManifestEncryption="true"/>
+ <sec:Integrity wsp:Optional="false">
+ <sec:MessageParts Dialect="http://schemas.xmlsoap.org/ws/2002/12/wsse#soap">wsp:Body()</sec:MessageParts>
+ </sec:Integrity>
+</wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/samples/test22.xml b/neethi/src/samples/test22.xml
new file mode 100644
index 0000000..8942352
--- /dev/null
+++ b/neethi/src/samples/test22.xml
@@ -0,0 +1 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:sec="http://schemas.xmlsoap.org/ws/2002/12/secext"><!-- 2A --><sec:SecurityToken><sec:TokenType>sec:X509v3</sec:TokenType></sec:SecurityToken></wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/samples/test23.xml b/neethi/src/samples/test23.xml
new file mode 100644
index 0000000..e0c1bf8
--- /dev/null
+++ b/neethi/src/samples/test23.xml
@@ -0,0 +1 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:sec="http://schemas.xmlsoap.org/ws/2002/12/secext"><!-- 2B --><sec:SecurityHeader wsp:Optional="true" MustPrepend="true" MustManifestEncryption="true" /></wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/samples/test24.xml b/neethi/src/samples/test24.xml
new file mode 100644
index 0000000..2aa5b09
--- /dev/null
+++ b/neethi/src/samples/test24.xml
@@ -0,0 +1 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:sec="http://schemas.xmlsoap.org/ws/2002/12/secext"><!-- 2C --><sec:Integrity wsp:Optional="false"><sec:MessageParts Dialect="http://schemas.xmlsoap.org/ws/2002/12/wsse#soap" >wsp:Body()</sec:MessageParts></sec:Integrity></wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/samples/test25.xml b/neethi/src/samples/test25.xml
new file mode 100644
index 0000000..378051d
--- /dev/null
+++ b/neethi/src/samples/test25.xml
@@ -0,0 +1,7 @@
+<wsp:Policy
+ xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ xmlns:tst="http://sample.org/Assertions">
+ <tst:A wsp:Optional="true">A</tst:A>
+ <tst:B wsp:Optional="true">B</tst:B>
+ <tst:C wsp:Optional="true">C</tst:C>
+</wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/samples/test3.xml b/neethi/src/samples/test3.xml
new file mode 100644
index 0000000..a3bc427
--- /dev/null
+++ b/neethi/src/samples/test3.xml
@@ -0,0 +1,20 @@
+
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:sec="http://schemas.xmlsoap.org/ws/2002/12/secext">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sec:SecurityToken>
+ <sec:TokenType>sec:X509v3</sec:TokenType>
+ </sec:SecurityToken>
+ </wsp:All>
+ <wsp:All>
+ <sec:SecurityToken>
+ <sec:TokenType>sec:X509v3</sec:TokenType>
+ </sec:SecurityToken>
+ </wsp:All>
+ <wsp:All>
+ <sec:SecurityToken>
+ <sec:TokenType>sec:Kerberosv5TGT</sec:TokenType>
+ </sec:SecurityToken>
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/samples/test4.xml b/neethi/src/samples/test4.xml
new file mode 100644
index 0000000..a6af9f4
--- /dev/null
+++ b/neethi/src/samples/test4.xml
@@ -0,0 +1 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:sec="http://schemas.xmlsoap.org/ws/2002/12/secext"><wsp:ExactlyOne><wsp:All><sec:SecurityToken><sec:TokenType>sec:X509v3</sec:TokenType></sec:SecurityToken></wsp:All><wsp:All><sec:SecurityToken><sec:TokenType>sec:X509v3</sec:TokenType></sec:SecurityToken><sec:SecurityHeader MustPrepend="true" /></wsp:All></wsp:ExactlyOne></wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/samples/test5.xml b/neethi/src/samples/test5.xml
new file mode 100644
index 0000000..7c72aff
--- /dev/null
+++ b/neethi/src/samples/test5.xml
@@ -0,0 +1 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:sec="http://schemas.xmlsoap.org/ws/2002/12/secext"><wsp:ExactlyOne><wsp:All><sec:SecurityToken><sec:TokenType>sec:X509v3</sec:TokenType></sec:SecurityToken><sec:SecurityToken><sec:TokenType>sec:X509v3</sec:TokenType></sec:SecurityToken><sec:SecurityHeader MustPrepend="true" /></wsp:All><wsp:All><sec:SecurityToken><sec:TokenType>sec:Kerberosv5TGT</sec:TokenType></sec:SecurityToken><sec:SecurityHeader MustPrepend="true" /></wsp:All></wsp:ExactlyOne></wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/samples/test6.xml b/neethi/src/samples/test6.xml
new file mode 100644
index 0000000..4003b62
--- /dev/null
+++ b/neethi/src/samples/test6.xml
@@ -0,0 +1 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" ><!-- 1A --></wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/samples/test7.xml b/neethi/src/samples/test7.xml
new file mode 100644
index 0000000..cee2f03
--- /dev/null
+++ b/neethi/src/samples/test7.xml
@@ -0,0 +1 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:sec="http://schemas.xmlsoap.org/ws/2002/12/secext"><!-- 1B --><sec:SecurityToken><sec:TokenType>sec:X509v3</sec:TokenType></sec:SecurityToken><sec:Integrity><sec:MessageParts Dialect="http://schemas.xmlsoap.org/ws/2002/12/wsse#soap" >wsp:Body()</sec:MessageParts></sec:Integrity><sec:SecurityHeader MustPrepend="true" MustManifestEncryption="true" /></wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/samples/test8.xml b/neethi/src/samples/test8.xml
new file mode 100644
index 0000000..31d9377
--- /dev/null
+++ b/neethi/src/samples/test8.xml
@@ -0,0 +1,4 @@
+
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"><!-- 1C -->
+ <wsp:Policy />
+</wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/samples/test9.xml b/neethi/src/samples/test9.xml
new file mode 100644
index 0000000..9f57428
--- /dev/null
+++ b/neethi/src/samples/test9.xml
@@ -0,0 +1 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" ><!-- 1D --><wsp:All /></wsp:Policy> \ No newline at end of file
diff --git a/neethi/src/secpolicy/Makefile.am b/neethi/src/secpolicy/Makefile.am
new file mode 100644
index 0000000..28fd650
--- /dev/null
+++ b/neethi/src/secpolicy/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = model builder
diff --git a/neethi/src/secpolicy/builder/Makefile.am b/neethi/src/secpolicy/builder/Makefile.am
new file mode 100644
index 0000000..d189e16
--- /dev/null
+++ b/neethi/src/secpolicy/builder/Makefile.am
@@ -0,0 +1,25 @@
+TESTS =
+
+noinst_LTLIBRARIES = librp_builder.la
+
+librp_builder_la_SOURCES = algorithmsuite_builder.c \
+ layout_builder.c \
+ supporting_tokens_builder.c \
+ transport_binding_builder.c username_token_builder.c \
+ wss10_builder.c transport_token_builder.c \
+ token_identifier.c https_token_builder.c rampart_config_builder.c \
+ asymmetric_binding_builder.c x509_token_builder.c initiator_token_builder.c \
+ recipient_token_builder.c signed_encrypted_parts_builder.c secpolicy_builder.c \
+ symmetric_binding_builder.c protection_token_builder.c signature_token_builder.c \
+ encryption_token_builder.c wss11_builder.c trust10_builder.c \
+ bootstrap_policy_builder.c security_context_token_builder.c \
+ issued_token_builder.c saml_token_builder.c
+
+librp_builder_la_LIBADD = ../../../../axiom/src/om/libaxis2_axiom.la \
+ ../../../../util/src/libaxutil.la
+
+INCLUDES = -I$(top_builddir)/include \
+ -I ../../../include \
+ -I ../../../../util/include \
+ -I ../../../../axiom/include \
+ -I ../../../../include
diff --git a/neethi/src/secpolicy/builder/algorithmsuite_builder.c b/neethi/src/secpolicy/builder/algorithmsuite_builder.c
new file mode 100644
index 0000000..3f42baf
--- /dev/null
+++ b/neethi/src/secpolicy/builder/algorithmsuite_builder.c
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_algorithmsuite_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_algorithmsuite_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_algorithmsuite_t *algorithmsuite = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_node_t *algo_node = NULL;
+ axiom_element_t *algo_element = NULL;
+ neethi_assertion_t *assertion = NULL;
+
+ algorithmsuite = rp_algorithmsuite_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+
+ if(child_node)
+ {
+ algo_node = axiom_node_get_first_element(child_node, env);
+ if(!algo_node)
+ {
+ return NULL;
+ }
+ }
+ else
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(algo_node, env) == AXIOM_ELEMENT)
+ {
+ algo_element = (axiom_element_t *)axiom_node_get_data_element(algo_node, env);
+ if(algo_element)
+ {
+ axis2_status_t status = AXIS2_FAILURE;
+ axis2_char_t *algosuite_string = NULL;
+
+ algosuite_string = axiom_element_get_localname(algo_element, env);
+ if(!algosuite_string)
+ {
+ return NULL;
+ }
+ status = rp_algorithmsuite_set_algosuite(algorithmsuite, env, algosuite_string);
+ if(AXIS2_FAILURE == status)
+ {
+ return NULL;
+ }
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_algorithmsuite_free, algorithmsuite,
+ ASSERTION_TYPE_ALGORITHM_SUITE);
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
diff --git a/neethi/src/secpolicy/builder/asymmetric_binding_builder.c b/neethi/src/secpolicy/builder/asymmetric_binding_builder.c
new file mode 100644
index 0000000..3a2f889
--- /dev/null
+++ b/neethi/src/secpolicy/builder/asymmetric_binding_builder.c
@@ -0,0 +1,234 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_asymmetric_binding_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+asymmetric_binding_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_asymmetric_binding_t *asymmetric_binding);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_asymmetric_binding_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_asymmetric_binding_t *asymmetric_binding = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ asymmetric_binding = rp_asymmetric_binding_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ asymmetric_binding_process_alternatives(env, all, asymmetric_binding);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_asymmetric_binding_free, asymmetric_binding,
+ ASSERTION_TYPE_ASSYMMETRIC_BINDING);
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+asymmetric_binding_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_asymmetric_binding_t * asymmetric_binding)
+{
+
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+ rp_binding_commons_t *commons = NULL;
+ rp_symmetric_asymmetric_binding_commons_t *as_commons = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+ commons = rp_binding_commons_create(env);
+ as_commons = rp_symmetric_asymmetric_binding_commons_create(env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(type == ASSERTION_TYPE_INITIATOR_TOKEN)
+ {
+ rp_property_t *initiator_token = NULL;
+ initiator_token = (rp_property_t *)neethi_assertion_get_value(assertion, env);
+ if(initiator_token)
+ {
+ rp_asymmetric_binding_set_initiator_token(asymmetric_binding, env, initiator_token);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_RECIPIENT_TOKEN)
+ {
+ rp_property_t *recipient_token = NULL;
+ recipient_token = (rp_property_t *)neethi_assertion_get_value(assertion, env);
+ if(recipient_token)
+ {
+ rp_asymmetric_binding_set_recipient_token(asymmetric_binding, env, recipient_token);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_ALGORITHM_SUITE)
+ {
+ rp_algorithmsuite_t *algorithmsuite = NULL;
+ algorithmsuite = (rp_algorithmsuite_t *)neethi_assertion_get_value(assertion, env);
+ if(algorithmsuite)
+ {
+ rp_binding_commons_set_algorithmsuite(commons, env, algorithmsuite);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_INCLUDE_TIMESTAMP)
+ {
+ rp_binding_commons_set_include_timestamp(commons, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_LAYOUT)
+ {
+ rp_layout_t *layout = NULL;
+ layout = (rp_layout_t *)neethi_assertion_get_value(assertion, env);
+ if(layout)
+ {
+ rp_binding_commons_set_layout(commons, env, layout);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_ENCRYPT_BEFORE_SIGNING)
+ {
+ rp_symmetric_asymmetric_binding_commons_set_protection_order(as_commons, env,
+ RP_ENCRYPT_BEFORE_SIGNING);
+ }
+ else if(type == ASSERTION_TYPE_SIGN_BEFORE_ENCRYPTING)
+ {
+ rp_symmetric_asymmetric_binding_commons_set_protection_order(as_commons, env,
+ RP_SIGN_BEFORE_ENCRYPTING);
+ }
+ else if(type == ASSERTION_TYPE_ENCRYPT_SIGNATURE)
+ {
+ rp_symmetric_asymmetric_binding_commons_set_signature_protection(as_commons, env,
+ AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_PROTECT_TOKENS)
+ {
+ rp_symmetric_asymmetric_binding_commons_set_token_protection(as_commons, env,
+ AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_ONLY_SIGN_ENTIRE_HEADERS_AND_BODY)
+ {
+ rp_symmetric_asymmetric_binding_commons_set_entire_headers_and_body_signatures(
+ as_commons, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_SUPPORTING_TOKENS)
+ {
+ rp_supporting_tokens_t *supporting_tokens = NULL;
+ supporting_tokens
+ = (rp_supporting_tokens_t *)neethi_assertion_get_value(assertion, env);
+ if(supporting_tokens)
+ {
+ rp_property_type_t type;
+ type = rp_supporting_tokens_get_type(supporting_tokens, env);
+ if(type == RP_PROPERTY_SIGNED_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_signed_supporting_tokens(commons, env, supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_SIGNED_ENDORSING_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_signed_endorsing_supporting_tokens(commons, env,
+ supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_SUPPORTING_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_supporting_tokens(commons, env, supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_ENDORSING_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_endorsing_supporting_tokens(commons, env,
+ supporting_tokens);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ rp_symmetric_asymmetric_binding_commons_set_binding_commons(as_commons, env, commons);
+ rp_asymmetric_binding_set_symmetric_asymmetric_binding_commons(asymmetric_binding, env,
+ as_commons);
+
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/bootstrap_policy_builder.c b/neethi/src/secpolicy/builder/bootstrap_policy_builder.c
new file mode 100644
index 0000000..df8c23e
--- /dev/null
+++ b/neethi/src/secpolicy/builder/bootstrap_policy_builder.c
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_bootstrap_policy_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_bootstrap_policy_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ neethi_assertion_t *assertion = NULL;
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ assertion = neethi_assertion_create_with_args(env, NULL, /*this policy should not be deleted*/
+ policy, ASSERTION_TYPE_BOOTSTRAP_POLICY);
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
diff --git a/neethi/src/secpolicy/builder/encryption_token_builder.c b/neethi/src/secpolicy/builder/encryption_token_builder.c
new file mode 100644
index 0000000..5896ac3
--- /dev/null
+++ b/neethi/src/secpolicy/builder/encryption_token_builder.c
@@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_encryption_token_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_assertion.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+encryption_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_property_t *encryption_token);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_encryption_token_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_property_t *encryption_token = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ encryption_token = rp_property_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ encryption_token_process_alternatives(env, all, encryption_token);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_property_free, encryption_token,
+ ASSERTION_TYPE_ENCRYPTION_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+encryption_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_property_t *encryption_token)
+{
+
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(value)
+ {
+ if(type == ASSERTION_TYPE_X509_TOKEN)
+ {
+ rp_x509_token_t *x509_token = NULL;
+ x509_token = (rp_x509_token_t *)neethi_assertion_get_value(assertion, env);
+ if(x509_token)
+ {
+ rp_property_set_value(encryption_token, env, x509_token, RP_PROPERTY_X509_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_ISSUED_TOKEN)
+ {
+ rp_issued_token_t *issued_token = NULL;
+ issued_token = (rp_issued_token_t *)neethi_assertion_get_value(assertion, env);
+ if(issued_token)
+ {
+ rp_property_set_value(encryption_token, env, issued_token,
+ RP_PROPERTY_ISSUED_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_SAML_TOKEN)
+ {
+ rp_saml_token_t *saml_token = NULL;
+ saml_token = (rp_saml_token_t *)neethi_assertion_get_value(assertion, env);
+ if(saml_token)
+ {
+ rp_property_set_value(encryption_token, env, saml_token, RP_PROPERTY_SAML_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_SECURITY_CONTEXT_TOKEN)
+ {
+ rp_security_context_token_t *security_context_token = NULL;
+ security_context_token = (rp_security_context_token_t *)neethi_assertion_get_value(
+ assertion, env);
+
+ if(security_context_token)
+ {
+ rp_property_set_value(encryption_token, env, security_context_token,
+ RP_PROPERTY_SECURITY_CONTEXT_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/https_token_builder.c b/neethi/src/secpolicy/builder/https_token_builder.c
new file mode 100644
index 0000000..9406d19
--- /dev/null
+++ b/neethi/src/secpolicy/builder/https_token_builder.c
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_https_token_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_https_token_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_https_token_t *https_token = NULL;
+ neethi_assertion_t *assertion = NULL;
+ axis2_char_t *value = NULL;
+
+ https_token = rp_https_token_create(env);
+
+ value = axiom_element_get_attribute_value_by_name(element, env, RP_REQUIRE_CLIENT_CERTIFICATE);
+
+ if(value)
+ {
+ if(axutil_strcmp(value, "true") == 0)
+ {
+ rp_https_token_set_require_client_certificate(https_token, env, AXIS2_TRUE);
+ }
+ else if(axutil_strcmp(value, "false") == 0)
+ {
+ rp_https_token_set_require_client_certificate(https_token, env, AXIS2_FALSE);
+ }
+ else
+ return NULL;
+ }
+
+ assertion = neethi_assertion_create_with_args(env, (AXIS2_FREE_VOID_ARG)rp_https_token_free,
+ https_token, ASSERTION_TYPE_HTTPS_TOKEN);
+ return assertion;
+}
diff --git a/neethi/src/secpolicy/builder/initiator_token_builder.c b/neethi/src/secpolicy/builder/initiator_token_builder.c
new file mode 100644
index 0000000..28b6497
--- /dev/null
+++ b/neethi/src/secpolicy/builder/initiator_token_builder.c
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_initiator_token_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_assertion.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+initiator_token_process_alternatives(
+ const axutil_env_t * env,
+ neethi_all_t * all,
+ rp_property_t * initiator_token);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_initiator_token_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element)
+{
+ rp_property_t *initiator_token = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ initiator_token = rp_property_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ initiator_token_process_alternatives(env, all, initiator_token);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_property_free, initiator_token,
+ ASSERTION_TYPE_INITIATOR_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+initiator_token_process_alternatives(
+ const axutil_env_t * env,
+ neethi_all_t * all,
+ rp_property_t * initiator_token)
+{
+
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(value)
+ {
+ if(type == ASSERTION_TYPE_X509_TOKEN)
+ {
+ rp_x509_token_t *x509_token = NULL;
+ x509_token = (rp_x509_token_t *)neethi_assertion_get_value(assertion, env);
+ if(x509_token)
+ {
+ rp_property_set_value(initiator_token, env, x509_token, RP_PROPERTY_X509_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/issued_token_builder.c b/neethi/src/secpolicy/builder/issued_token_builder.c
new file mode 100644
index 0000000..2cfc09f
--- /dev/null
+++ b/neethi/src/secpolicy/builder/issued_token_builder.c
@@ -0,0 +1,164 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_issued_token_builder.h>
+
+AXIS2_EXTERN neethi_assertion_t * AXIS2_CALL
+rp_issued_token_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_issued_token_t *issued_token = NULL;
+ neethi_policy_t *policy = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+ neethi_all_t *all = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ axis2_char_t *inclusion_value = NULL;
+ axutil_qname_t *qname = NULL;
+ axiom_node_t *issuer_node = NULL;
+ axiom_element_t *issuer_ele = NULL;
+ axiom_element_t *issuer_first_child_ele = NULL;
+ axiom_node_t *issuer_first_child_node = NULL;
+ axiom_node_t *req_sec_tok_template_node = NULL;
+ axiom_element_t *req_sec_tok_template_ele = NULL;
+ axiom_node_t *policy_node = NULL;
+ axiom_element_t *policy_ele = NULL;
+ neethi_assertion_t *assertion = NULL;
+
+ issued_token = rp_issued_token_create(env);
+ qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS_11, RP_SP_PREFIX);
+ inclusion_value = axiom_element_get_attribute_value(element, env, qname);
+ axutil_qname_free(qname, env);
+ qname = NULL;
+
+ if(!inclusion_value)
+ {
+ /* we can try whether WS-SP1.2 specific inclusion value */
+ qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS_12, RP_SP_PREFIX);
+ inclusion_value = axiom_element_get_attribute_value(element, env, qname);
+ axutil_qname_free(qname, env);
+ qname = NULL;
+ }
+
+ if(inclusion_value)
+ {
+ rp_issued_token_set_inclusion(issued_token, env, inclusion_value);
+ }
+
+ qname = axutil_qname_create(env, RP_ISSUER, RP_SP_NS_11, RP_SP_PREFIX);
+ issuer_ele = axiom_element_get_first_child_with_qname(element, env, qname, node, &issuer_node);
+ if(issuer_ele)
+ {
+ issuer_first_child_ele = axiom_element_get_first_element(issuer_ele, env, issuer_node,
+ &issuer_first_child_node);
+ if(issuer_first_child_ele)
+ {
+ rp_issued_token_set_issuer_epr(issued_token, env, issuer_first_child_node);
+ }
+ }
+ axutil_qname_free(qname, env);
+ qname = NULL;
+
+ qname = axutil_qname_create(env, RP_REQUEST_SEC_TOKEN_TEMPLATE, RP_SP_NS_11, RP_SP_PREFIX);
+ req_sec_tok_template_ele = axiom_element_get_first_child_with_qname(element, env, qname, node,
+ &req_sec_tok_template_node);
+ if(req_sec_tok_template_ele)
+ {
+ rp_issued_token_set_requested_sec_token_template(issued_token, env,
+ req_sec_tok_template_node);
+ }
+ else
+ {
+ return NULL;
+ }
+
+ axutil_qname_free(qname, env);
+ qname = NULL;
+
+ qname = axutil_qname_create(env, RP_POLICY, RP_POLICY_NS, RP_POLICY_PREFIX);
+ policy_ele = axiom_element_get_first_child_with_qname(element, env, qname, node, &policy_node);
+ if(policy_ele)
+ {
+ policy = neethi_engine_get_policy(env, policy_node, policy_ele);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ if(AXIS2_FAILURE == rp_issued_token_builder_process_alternatives(env, all, issued_token))
+ return NULL;
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_issued_token_free, issued_token, ASSERTION_TYPE_ISSUED_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, issued_token, ASSERTION_TYPE_ISSUED_TOKEN);
+
+ return assertion;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_issued_token_builder_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_issued_token_t *issued_token)
+{
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(type == ASSERTION_TYPE_REQUIRE_DERIVED_KEYS_SC10)
+ {
+ rp_issued_token_set_derivedkeys(issued_token, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_EXTERNAL_REFERENCE)
+ {
+ rp_issued_token_set_require_exernal_reference(issued_token, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_INTERNAL_REFERENCE)
+ {
+ rp_issued_token_set_require_internal_reference(issued_token, env, AXIS2_TRUE);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
+
diff --git a/neethi/src/secpolicy/builder/layout_builder.c b/neethi/src/secpolicy/builder/layout_builder.c
new file mode 100644
index 0000000..9be9ad9
--- /dev/null
+++ b/neethi/src/secpolicy/builder/layout_builder.c
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_layout_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_layout_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_layout_t *layout = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_node_t *layout_node = NULL;
+ axiom_element_t *layout_element = NULL;
+ neethi_assertion_t *assertion = NULL;
+
+ layout = rp_layout_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+
+ if(child_node)
+ {
+ layout_node = axiom_node_get_first_element(child_node, env);
+ if(!layout_node)
+ {
+ return NULL;
+ }
+ }
+ else
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(layout_node, env) == AXIOM_ELEMENT)
+ {
+ layout_element = (axiom_element_t *)axiom_node_get_data_element(layout_node, env);
+ if(layout_element)
+ {
+ axis2_char_t *local_name = NULL;
+
+ local_name = axiom_element_get_localname(layout_element, env);
+ if(!local_name)
+ return NULL;
+ rp_layout_set_value(layout, env, local_name);
+ assertion = neethi_assertion_create_with_args(env, (AXIS2_FREE_VOID_ARG)rp_layout_free,
+ layout, ASSERTION_TYPE_LAYOUT);
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
diff --git a/neethi/src/secpolicy/builder/protection_token_builder.c b/neethi/src/secpolicy/builder/protection_token_builder.c
new file mode 100644
index 0000000..8ea02f2
--- /dev/null
+++ b/neethi/src/secpolicy/builder/protection_token_builder.c
@@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_protection_token_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_assertion.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+protection_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_property_t *protection_token);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_protection_token_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_property_t *protection_token = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ protection_token = rp_property_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ protection_token_process_alternatives(env, all, protection_token);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_property_free, protection_token,
+ ASSERTION_TYPE_PROTECTION_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+protection_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_property_t *protection_token)
+{
+
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(value)
+ {
+ if(type == ASSERTION_TYPE_X509_TOKEN)
+ {
+ rp_x509_token_t *x509_token = NULL;
+ x509_token = (rp_x509_token_t *)neethi_assertion_get_value(assertion, env);
+ if(x509_token)
+ {
+ rp_property_set_value(protection_token, env, x509_token, RP_PROPERTY_X509_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_ISSUED_TOKEN)
+ {
+ rp_issued_token_t *issued_token = NULL;
+ issued_token = (rp_issued_token_t *)neethi_assertion_get_value(assertion, env);
+ if(issued_token)
+ {
+ rp_property_set_value(protection_token, env, issued_token,
+ RP_PROPERTY_ISSUED_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_SAML_TOKEN)
+ {
+ rp_saml_token_t *saml_token = NULL;
+ saml_token = (rp_saml_token_t *)neethi_assertion_get_value(assertion, env);
+ if(saml_token)
+ {
+ rp_property_set_value(protection_token, env, saml_token, RP_PROPERTY_SAML_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_SECURITY_CONTEXT_TOKEN)
+ {
+ rp_security_context_token_t *security_context_token = NULL;
+ security_context_token = (rp_security_context_token_t *)neethi_assertion_get_value(
+ assertion, env);
+
+ if(security_context_token)
+ {
+ rp_property_set_value(protection_token, env, security_context_token,
+ RP_PROPERTY_SECURITY_CONTEXT_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/rampart_config_builder.c b/neethi/src/secpolicy/builder/rampart_config_builder.c
new file mode 100644
index 0000000..1c569b3
--- /dev/null
+++ b/neethi/src/secpolicy/builder/rampart_config_builder.c
@@ -0,0 +1,213 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_rampart_config_builder.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+rp_rampart_config_builder_populate(
+ const axutil_env_t *env,
+ rp_rampart_config_t *rampart_config,
+ axiom_node_t *node,
+ axiom_element_t *element,
+ axis2_char_t *local_name);
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_rampart_config_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *config,
+ axiom_element_t *config_ele)
+{
+ rp_rampart_config_t *rampart_config = NULL;
+ axis2_status_t status = AXIS2_SUCCESS;
+ axiom_children_iterator_t *children_iter = NULL;
+ neethi_assertion_t *assertion = NULL;
+
+ rampart_config = rp_rampart_config_create(env);
+ if(!rampart_config)
+ {
+ return NULL;
+ }
+
+ children_iter = axiom_element_get_children(config_ele, env, config);
+ if(children_iter)
+ {
+ while(axiom_children_iterator_has_next(children_iter, env))
+ {
+ axiom_node_t *node = NULL;
+ axiom_element_t *ele = NULL;
+ axis2_char_t *local_name = NULL;
+ node = axiom_children_iterator_next(children_iter, env);
+ if(node)
+ {
+ if(axiom_node_get_node_type(node, env) == AXIOM_ELEMENT)
+ {
+ ele = (axiom_element_t *)axiom_node_get_data_element(node, env);
+ if(ele)
+ {
+ local_name = axiom_element_get_localname(ele, env);
+ if(local_name)
+ {
+ status = rp_rampart_config_builder_populate(env, rampart_config, node,
+ ele, local_name);
+ if(status != AXIS2_SUCCESS)
+ {
+ return NULL;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ assertion = neethi_assertion_create_with_args(env, (AXIS2_FREE_VOID_ARG)rp_rampart_config_free,
+ rampart_config, ASSERTION_TYPE_RAMPART_CONFIG);
+ return assertion;
+}
+
+axis2_status_t AXIS2_CALL
+rp_rampart_config_builder_populate(
+ const axutil_env_t *env,
+ rp_rampart_config_t *rampart_config,
+ axiom_node_t *node,
+ axiom_element_t *element,
+ axis2_char_t *local_name)
+{
+ axis2_char_t *ns = NULL;
+ axutil_qname_t *node_qname = NULL;
+
+ node_qname = axiom_element_get_qname(element, env, node);
+ if(!node_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Cannot get qname from element %s.",
+ local_name);
+ return AXIS2_FAILURE;
+ }
+
+ ns = axutil_qname_get_uri(node_qname, env);
+ if(!ns)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Cannot get namespace from element %s.",
+ local_name);
+ return AXIS2_FAILURE;
+ }
+
+ if(!axutil_strcmp(ns, RP_RAMPART_NS))
+ {
+ if(!axutil_strcmp(local_name, RP_USER))
+ {
+ axis2_char_t *user = NULL;
+ user = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_user(rampart_config, env, user);
+ }
+ else if(!axutil_strcmp(local_name, RP_ENCRYPTION_USER))
+ {
+ axis2_char_t *encryption_user = NULL;
+ encryption_user = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_encryption_user(rampart_config, env, encryption_user);
+ }
+ else if(!axutil_strcmp(local_name, RP_PASSWORD_CALLBACK_CLASS))
+ {
+ axis2_char_t *password_callback_class = NULL;
+ password_callback_class = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_password_callback_class(rampart_config, env,
+ password_callback_class);
+ }
+ else if(!axutil_strcmp(local_name, RP_AUTHN_MODULE_NAME))
+ {
+ axis2_char_t *authenticate_module = NULL;
+ authenticate_module = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_authenticate_module(rampart_config, env,
+ authenticate_module);
+ }
+ else if(!axutil_strcmp(local_name, RP_RD_MODULE))
+ {
+ axis2_char_t *replay_detector = NULL;
+ replay_detector = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_replay_detector(rampart_config, env, replay_detector);
+ }
+ else if(!axutil_strcmp(local_name, RP_SCT_MODULE))
+ {
+ axis2_char_t *sct_module = NULL;
+ sct_module = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_sct_provider(rampart_config, env, sct_module);
+ }
+ else if(!axutil_strcmp(local_name, RP_PASSWORD_TYPE))
+ {
+ axis2_char_t *password_type = NULL;
+ password_type = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_password_type(rampart_config, env, password_type);
+ }
+ else if(!axutil_strcmp(local_name, RP_CERTIFICATE))
+ {
+ axis2_char_t *certificate_file = NULL;
+ certificate_file = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_certificate_file(rampart_config, env, certificate_file);
+ }
+ else if(!axutil_strcmp(local_name, RP_RECEIVER_CERTIFICATE))
+ {
+ axis2_char_t *receiver_certificate_file = NULL;
+ receiver_certificate_file = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_receiver_certificate_file(rampart_config, env,
+ receiver_certificate_file);
+ }
+ else if(!axutil_strcmp(local_name, RP_PRIVATE_KEY))
+ {
+ axis2_char_t *private_key_file = NULL;
+ private_key_file = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_private_key_file(rampart_config, env, private_key_file);
+ }
+ else if(!axutil_strcmp(local_name, RP_PKCS12_KEY_STORE))
+ {
+ axis2_char_t *pkcs12_key_store = NULL;
+ pkcs12_key_store = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_pkcs12_file(rampart_config, env, pkcs12_key_store);
+ }
+ else if(!axutil_strcmp(local_name, RP_TIME_TO_LIVE))
+ {
+ axis2_char_t *time_to_live = NULL;
+ time_to_live = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_time_to_live(rampart_config, env, time_to_live);
+ }
+ else if(!axutil_strcmp(local_name, RP_CLOCK_SKEW_BUFFER))
+ {
+ axis2_char_t *clock_skew_buffer = NULL;
+ clock_skew_buffer = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_clock_skew_buffer(rampart_config, env, clock_skew_buffer);
+ }
+ else if(!axutil_strcmp(local_name, RP_NEED_MILLISECOND_PRECISION))
+ {
+ axis2_char_t *need_ms_precision = NULL;
+ need_ms_precision = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_need_millisecond_precision(rampart_config, env,
+ need_ms_precision);
+ }
+ else if(!axutil_strcmp(local_name, RP_RD))
+ {
+ axis2_char_t *rd_val = NULL;
+ rd_val = axiom_element_get_text(element, env, node);
+ return rp_rampart_config_set_rd_val(rampart_config, env, rd_val);
+ }
+ }
+
+ /* either the assertion or the namespace is not identified */
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Unknown Assertion %s with namespace %s",
+ local_name, ns);
+ return AXIS2_FAILURE;
+
+}
diff --git a/neethi/src/secpolicy/builder/recipient_token_builder.c b/neethi/src/secpolicy/builder/recipient_token_builder.c
new file mode 100644
index 0000000..d29537d
--- /dev/null
+++ b/neethi/src/secpolicy/builder/recipient_token_builder.c
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_recipient_token_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_assertion.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+recipient_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_property_t *recipient_token);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_recipient_token_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_property_t *recipient_token = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ recipient_token = rp_property_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ recipient_token_process_alternatives(env, all, recipient_token);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_property_free, recipient_token,
+ ASSERTION_TYPE_RECIPIENT_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+recipient_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_property_t *recipient_token)
+{
+
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(value)
+ {
+ if(type == ASSERTION_TYPE_X509_TOKEN)
+ {
+ rp_x509_token_t *x509_token = NULL;
+ x509_token = (rp_x509_token_t *)neethi_assertion_get_value(assertion, env);
+ if(x509_token)
+ {
+ rp_property_set_value(recipient_token, env, x509_token, RP_PROPERTY_X509_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/saml_token_builder.c b/neethi/src/secpolicy/builder/saml_token_builder.c
new file mode 100644
index 0000000..6550d80
--- /dev/null
+++ b/neethi/src/secpolicy/builder/saml_token_builder.c
@@ -0,0 +1,155 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_saml_token_builder.h>
+
+axis2_status_t AXIS2_CALL
+saml_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_saml_token_t *saml_token);
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_saml_token_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_saml_token_t *saml_token = NULL;
+ axis2_char_t *inclusion_value = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ axutil_qname_t *qname = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ saml_token = rp_saml_token_create(env);
+ qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS_11, RP_SP_PREFIX);
+ inclusion_value = axiom_element_get_attribute_value(element, env, qname);
+ axutil_qname_free(qname, env);
+ qname = NULL;
+
+ if(!inclusion_value)
+ {
+ /* we can try whether WS-SP1.2 specific inclusion value */
+ qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS_12, RP_SP_PREFIX);
+ inclusion_value = axiom_element_get_attribute_value(element, env, qname);
+ axutil_qname_free(qname, env);
+ qname = NULL;
+ }
+
+ rp_saml_token_set_inclusion(saml_token, env, inclusion_value);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, saml_token, ASSERTION_TYPE_SAML_TOKEN);
+ return assertion;
+ }
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ saml_token_process_alternatives(env, all, saml_token);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_saml_token_free, saml_token, ASSERTION_TYPE_SAML_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+saml_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_saml_token_t *saml_token)
+{
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(type == ASSERTION_TYPE_REQUIRE_DERIVED_KEYS_SC10)
+ {
+ rp_saml_token_set_derivedkeys(saml_token, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_KEY_IDENTIFIRE_REFERENCE)
+ {
+ rp_saml_token_set_require_key_identifier_reference(saml_token, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_WSS_SAML_V10_TOKEN_V10)
+ {
+ rp_saml_token_set_token_version_and_type(saml_token, env, RP_WSS_SAML_V10_TOKEN_V10);
+ }
+ else if(type == ASSERTION_TYPE_WSS_SAML_V10_TOKEN_V11)
+ {
+ rp_saml_token_set_token_version_and_type(saml_token, env, RP_WSS_SAML_V10_TOKEN_V11);
+ }
+ else if(type == ASSERTION_TYPE_WSS_SAML_V11_TOKEN_V10)
+ {
+ rp_saml_token_set_token_version_and_type(saml_token, env, RP_WSS_SAML_V11_TOKEN_V10);
+ }
+ else if(type == ASSERTION_TYPE_WSS_SAML_V11_TOKEN_V11)
+ {
+ rp_saml_token_set_token_version_and_type(saml_token, env, RP_WSS_SAML_V11_TOKEN_V11);
+ }
+ else if(type == ASSERTION_TYPE_WSS_SAML_V20_TOKEN_V11)
+ {
+ rp_saml_token_set_token_version_and_type(saml_token, env, RP_WSS_SAML_V20_TOKEN_V11);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
+
diff --git a/neethi/src/secpolicy/builder/secpolicy_builder.c b/neethi/src/secpolicy/builder/secpolicy_builder.c
new file mode 100644
index 0000000..8548403
--- /dev/null
+++ b/neethi/src/secpolicy/builder/secpolicy_builder.c
@@ -0,0 +1,241 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_secpolicy_builder.h>
+#include <neethi_operator.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+#include <neethi_assertion.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+secpolicy_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_secpolicy_t *secpolicy);
+
+/***********************************/
+
+AXIS2_EXTERN rp_secpolicy_t *AXIS2_CALL
+rp_secpolicy_builder_build(
+ const axutil_env_t *env,
+ neethi_policy_t *policy)
+{
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ rp_secpolicy_t *secpolicy = NULL;
+
+ secpolicy = rp_secpolicy_create(env);
+
+ alternatives = neethi_policy_get_alternatives(policy, env);
+
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+
+ if(secpolicy_process_alternatives(env, all, secpolicy) == AXIS2_FAILURE)
+ {
+ return NULL;
+ }
+ return secpolicy;
+}
+
+axis2_status_t AXIS2_CALL
+secpolicy_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_secpolicy_t *secpolicy)
+{
+
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(value)
+ {
+ if(type == ASSERTION_TYPE_TRANSPORT_BINDING)
+ {
+ rp_property_t *binding = NULL;
+ rp_transport_binding_t *transport_binding = NULL;
+
+ transport_binding = (rp_transport_binding_t *)neethi_assertion_get_value(assertion,
+ env);
+ if(!transport_binding)
+ {
+ return AXIS2_FAILURE;
+ }
+ binding = rp_property_create(env);
+ rp_property_set_value(binding, env, transport_binding,
+ RP_PROPERTY_TRANSPORT_BINDING);
+ rp_secpolicy_set_binding(secpolicy, env, binding);
+ }
+ else if(type == ASSERTION_TYPE_ASSYMMETRIC_BINDING)
+ {
+ rp_property_t *binding = NULL;
+ rp_asymmetric_binding_t *asymmetric_binding = NULL;
+
+ asymmetric_binding = (rp_asymmetric_binding_t *)neethi_assertion_get_value(
+ assertion, env);
+ if(!asymmetric_binding)
+ {
+ return AXIS2_FAILURE;
+ }
+ binding = rp_property_create(env);
+ rp_property_set_value(binding, env, asymmetric_binding,
+ RP_PROPERTY_ASYMMETRIC_BINDING);
+ rp_secpolicy_set_binding(secpolicy, env, binding);
+ }
+ else if(type == ASSERTION_TYPE_SYMMETRIC_BINDING)
+ {
+ rp_property_t *binding = NULL;
+ rp_symmetric_binding_t *symmetric_binding = NULL;
+
+ symmetric_binding = (rp_symmetric_binding_t *)neethi_assertion_get_value(assertion,
+ env);
+ if(!symmetric_binding)
+ {
+ return AXIS2_FAILURE;
+ }
+ binding = rp_property_create(env);
+ rp_property_set_value(binding, env, symmetric_binding,
+ RP_PROPERTY_SYMMETRIC_BINDING);
+ rp_secpolicy_set_binding(secpolicy, env, binding);
+ }
+ else if(type == ASSERTION_TYPE_SUPPORTING_TOKENS)
+ {
+ rp_supporting_tokens_t *supporting_tokens = NULL;
+ supporting_tokens = (rp_supporting_tokens_t *)neethi_assertion_get_value(assertion,
+ env);
+ if(supporting_tokens)
+ {
+ rp_property_type_t type;
+ type = rp_supporting_tokens_get_type(supporting_tokens, env);
+ if(type == RP_PROPERTY_SIGNED_SUPPORTING_TOKEN)
+ {
+ rp_secpolicy_set_signed_supporting_tokens(secpolicy, env, supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_SIGNED_ENDORSING_SUPPORTING_TOKEN)
+ {
+ rp_secpolicy_set_signed_endorsing_supporting_tokens(secpolicy, env,
+ supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_SUPPORTING_SUPPORTING_TOKEN)
+ {
+ rp_secpolicy_set_supporting_tokens(secpolicy, env, supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_ENDORSING_SUPPORTING_TOKEN)
+ {
+ rp_secpolicy_set_endorsing_supporting_tokens(secpolicy, env,
+ supporting_tokens);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_WSS10)
+ {
+ rp_wss10_t *wss10 = NULL;
+ rp_property_t *wss = NULL;
+ wss10 = (rp_wss10_t *)neethi_assertion_get_value(assertion, env);
+ if(!wss10)
+ {
+ return AXIS2_FAILURE;
+ }
+ wss = rp_property_create(env);
+ rp_property_set_value(wss, env, wss10, RP_PROPERTY_WSS10);
+ rp_secpolicy_set_wss(secpolicy, env, wss);
+ }
+ else if(type == ASSERTION_TYPE_WSS11)
+ {
+ rp_wss11_t *wss11 = NULL;
+ rp_property_t *wss = NULL;
+ wss11 = (rp_wss11_t *)neethi_assertion_get_value(assertion, env);
+ if(!wss11)
+ {
+ return AXIS2_FAILURE;
+ }
+ wss = rp_property_create(env);
+ rp_property_set_value(wss, env, wss11, RP_PROPERTY_WSS11);
+ rp_secpolicy_set_wss(secpolicy, env, wss);
+ }
+ else if(type == ASSERTION_TYPE_TRUST10)
+ {
+ rp_trust10_t *trust10 = NULL;
+ trust10 = (rp_trust10_t *)neethi_assertion_get_value(assertion, env);
+ if(!trust10)
+ {
+ return AXIS2_FAILURE;
+ }
+ rp_secpolicy_set_trust10(secpolicy, env, trust10);
+ }
+ else if(type == ASSERTION_TYPE_SIGNED_ENCRYPTED_PARTS)
+ {
+ rp_signed_encrypted_parts_t *signed_encrypted_parts = NULL;
+ signed_encrypted_parts = (rp_signed_encrypted_parts_t *)neethi_assertion_get_value(
+ assertion, env);
+ if(signed_encrypted_parts)
+ {
+ if(rp_signed_encrypted_parts_get_signedparts(signed_encrypted_parts, env))
+ {
+ rp_secpolicy_set_signed_parts(secpolicy, env, signed_encrypted_parts);
+ }
+ else
+ {
+ rp_secpolicy_set_encrypted_parts(secpolicy, env, signed_encrypted_parts);
+ }
+ }
+ else
+ return AXIS2_FAILURE;
+
+ }
+ else if(type == ASSERTION_TYPE_RAMPART_CONFIG)
+ {
+ rp_rampart_config_t *rampart_config = NULL;
+ rampart_config = (rp_rampart_config_t *)neethi_assertion_get_value(assertion, env);
+ if(!rampart_config)
+ {
+ return AXIS2_FAILURE;
+ }
+ rp_secpolicy_set_rampart_config(secpolicy, env, rampart_config);
+ }
+ else
+ {
+ continue;
+ }
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/security_context_token_builder.c b/neethi/src/secpolicy/builder/security_context_token_builder.c
new file mode 100644
index 0000000..b4ad8e8
--- /dev/null
+++ b/neethi/src/secpolicy/builder/security_context_token_builder.c
@@ -0,0 +1,231 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_security_context_token_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+security_context_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_security_context_token_t * security_context_token);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_security_context_token_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element,
+ axis2_char_t *sp_ns_uri,
+ axis2_bool_t is_secure_conversation_token)
+{
+ rp_security_context_token_t *security_context_token = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axiom_children_iterator_t *children_iter = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ axis2_char_t *inclusion_value = NULL;
+ axutil_qname_t *qname = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ security_context_token = rp_security_context_token_create(env);
+ qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, sp_ns_uri, RP_SP_PREFIX);
+ inclusion_value = axiom_element_get_attribute_value(element, env, qname);
+ axutil_qname_free(qname, env);
+ qname = NULL;
+
+ rp_security_context_token_set_inclusion(security_context_token, env, inclusion_value);
+ rp_security_context_token_set_is_secure_conversation_token(security_context_token, env,
+ is_secure_conversation_token);
+
+ if(!axutil_strcmp(sp_ns_uri, RP_SP_NS_11))
+ {
+ rp_security_context_token_set_sc10_security_context_token(security_context_token, env,
+ AXIS2_TRUE);
+ }
+ else
+ {
+ rp_security_context_token_set_sc10_security_context_token(security_context_token, env,
+ AXIS2_FALSE);
+ }
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ children_iter = axiom_element_get_children(element, env, node);
+ if(children_iter)
+ {
+ while(axiom_children_iterator_has_next(children_iter, env))
+ {
+ child_node = axiom_children_iterator_next(children_iter, env);
+ if(child_node)
+ {
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ axis2_char_t *localname = NULL;
+ localname = axiom_element_get_localname(child_element, env);
+ if(axutil_strcmp(localname, RP_ISSUER) == 0)
+ {
+ axis2_char_t *ns = NULL;
+ axutil_qname_t *node_qname = NULL;
+
+ node_qname = axiom_element_get_qname(child_element, env, child_node);
+ if(!node_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Cannot get qname from element %s.", localname);
+ return NULL;
+ }
+
+ ns = axutil_qname_get_uri(node_qname, env);
+ if(!ns)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Cannot get namespace from element %s.", localname);
+ return NULL;
+ }
+ if(!(axutil_strcmp(ns, RP_SP_NS_11) && axutil_strcmp(ns, RP_SP_NS_12)))
+ {
+ axis2_char_t *issuer = NULL;
+ issuer = axiom_element_get_text(child_element, env, child_node);
+ rp_security_context_token_set_issuer(security_context_token, env,
+ issuer);
+ }
+ else
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Unknown Assertion %s with namespace %s", localname,
+ ns);
+ return NULL;
+ }
+ }
+ else
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE,
+ policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives,
+ env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ security_context_token_process_alternatives(env, all,
+ security_context_token);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_security_context_token_free,
+ security_context_token, ASSERTION_TYPE_SECURITY_CONTEXT_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+ }
+ }
+ }
+ }
+ }
+ }
+ return assertion;
+}
+
+axis2_status_t AXIS2_CALL
+security_context_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_security_context_token_t * security_context_token)
+{
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(type == ASSERTION_TYPE_REQUIRE_DERIVED_KEYS_SC10)
+ {
+ rp_security_context_token_set_derivedkey(security_context_token, env, DERIVEKEY_NEEDED);
+ rp_security_context_token_set_derivedkey_version(security_context_token, env,
+ DERIVEKEY_VERSION_SC10);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_DERIVED_KEYS_SC13)
+ {
+ rp_security_context_token_set_derivedkey(security_context_token, env, DERIVEKEY_NEEDED);
+ rp_security_context_token_set_derivedkey_version(security_context_token, env,
+ DERIVEKEY_VERSION_SC13);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_EXTERNAL_URI)
+ {
+ rp_security_context_token_set_require_external_uri_ref(security_context_token, env,
+ AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_SC10_SECURITY_CONTEXT_TOKEN)
+ {
+ rp_security_context_token_set_sc10_security_context_token(security_context_token, env,
+ AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_SC13_SECURITY_CONTEXT_TOKEN)
+ {
+ rp_security_context_token_set_sc10_security_context_token(security_context_token, env,
+ AXIS2_FALSE);
+ }
+ else if(type == ASSERTION_TYPE_ISSUER)
+ {
+ axis2_char_t *issuer = NULL;
+ issuer = (axis2_char_t *)neethi_assertion_get_value(assertion, env);
+ rp_security_context_token_set_issuer(security_context_token, env, issuer);
+ }
+ else if(type == ASSERTION_TYPE_BOOTSTRAP_POLICY)
+ {
+ neethi_policy_t *bootstrap_policy = NULL;
+ bootstrap_policy = (neethi_policy_t *)neethi_assertion_get_value(assertion, env);
+ rp_security_context_token_set_bootstrap_policy(security_context_token, env,
+ bootstrap_policy);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/signature_token_builder.c b/neethi/src/secpolicy/builder/signature_token_builder.c
new file mode 100644
index 0000000..0c1c0c7
--- /dev/null
+++ b/neethi/src/secpolicy/builder/signature_token_builder.c
@@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_signature_token_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_assertion.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+signature_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_property_t *signature_token);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_signature_token_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_property_t *signature_token = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ signature_token = rp_property_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ signature_token_process_alternatives(env, all, signature_token);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_property_free, signature_token,
+ ASSERTION_TYPE_SIGNATURE_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+signature_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_property_t *signature_token)
+{
+
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(value)
+ {
+ if(type == ASSERTION_TYPE_X509_TOKEN)
+ {
+ rp_x509_token_t *x509_token = NULL;
+ x509_token = (rp_x509_token_t *)neethi_assertion_get_value(assertion, env);
+ if(x509_token)
+ {
+ rp_property_set_value(signature_token, env, x509_token, RP_PROPERTY_X509_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_ISSUED_TOKEN)
+ {
+ rp_issued_token_t *issued_token = NULL;
+ issued_token = (rp_issued_token_t *)neethi_assertion_get_value(assertion, env);
+ if(issued_token)
+ {
+ rp_property_set_value(signature_token, env, issued_token,
+ RP_PROPERTY_ISSUED_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_SAML_TOKEN)
+ {
+ rp_saml_token_t *saml_token = NULL;
+ saml_token = (rp_saml_token_t *)neethi_assertion_get_value(assertion, env);
+ if(saml_token)
+ {
+ rp_property_set_value(signature_token, env, saml_token, RP_PROPERTY_SAML_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_SECURITY_CONTEXT_TOKEN)
+ {
+ rp_security_context_token_t *security_context_token = NULL;
+ security_context_token = (rp_security_context_token_t *)neethi_assertion_get_value(
+ assertion, env);
+
+ if(security_context_token)
+ {
+ rp_property_set_value(signature_token, env, security_context_token,
+ RP_PROPERTY_SECURITY_CONTEXT_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/signed_encrypted_parts_builder.c b/neethi/src/secpolicy/builder/signed_encrypted_parts_builder.c
new file mode 100644
index 0000000..be5008e
--- /dev/null
+++ b/neethi/src/secpolicy/builder/signed_encrypted_parts_builder.c
@@ -0,0 +1,209 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_signed_encrypted_parts_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+static rp_header_t *AXIS2_CALL
+rp_signed_encrypted_parts_builder_build_header(
+ axiom_element_t *element,
+ const axutil_env_t *env);
+
+static axis2_status_t AXIS2_CALL
+rp_signed_encrypted_parts_builder_set_properties(
+ axiom_node_t *node,
+ axiom_element_t *element,
+ axis2_char_t *local_name,
+ rp_signed_encrypted_parts_t *signed_encrypted_parts,
+ const axutil_env_t *env);
+
+/**
+ * Builts EncryptedParts or SignedParts assertion
+ * @param env Pointer to environment struct
+ * @param node Assertion node
+ * @param element Assertion element
+ * @param is_signed boolean showing whether signing or encryption
+ * @returns neethi assertion created. NULL if failure.
+ */
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_signed_encrypted_parts_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *parts,
+ axiom_element_t *parts_ele,
+ axis2_bool_t is_signed)
+{
+ rp_signed_encrypted_parts_t *signed_encrypted_parts = NULL;
+ axiom_children_iterator_t *children_iter = NULL;
+ neethi_assertion_t *assertion = NULL;
+ axis2_status_t status = AXIS2_SUCCESS;
+
+ signed_encrypted_parts = rp_signed_encrypted_parts_create(env);
+ if(!signed_encrypted_parts)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Cannot create signed_encrypted_parts.");
+ return NULL;
+ }
+
+ rp_signed_encrypted_parts_set_signedparts(signed_encrypted_parts, env, is_signed);
+
+ children_iter = axiom_element_get_children(parts_ele, env, parts);
+ if(children_iter)
+ {
+ while(axiom_children_iterator_has_next(children_iter, env))
+ {
+ axiom_node_t *node = NULL;
+ axiom_element_t *ele = NULL;
+ axis2_char_t *local_name = NULL;
+ node = axiom_children_iterator_next(children_iter, env);
+ if(node)
+ {
+ if(axiom_node_get_node_type(node, env) == AXIOM_ELEMENT)
+ {
+ ele = (axiom_element_t *)axiom_node_get_data_element(node, env);
+ if(ele)
+ {
+ local_name = axiom_element_get_localname(ele, env);
+ if(local_name)
+ {
+ status = rp_signed_encrypted_parts_builder_set_properties(node, ele,
+ local_name, signed_encrypted_parts, env);
+ if(status != AXIS2_SUCCESS)
+ {
+ rp_signed_encrypted_parts_free(signed_encrypted_parts, env);
+ signed_encrypted_parts = NULL;
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Cannot create signed_encrypted_parts. "
+ "Error in processing child element %s", local_name);
+ return NULL;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_signed_encrypted_parts_free, signed_encrypted_parts,
+ ASSERTION_TYPE_SIGNED_ENCRYPTED_PARTS);
+ return assertion;
+}
+
+static axis2_status_t AXIS2_CALL
+rp_signed_encrypted_parts_builder_set_properties(
+ axiom_node_t *node,
+ axiom_element_t *element,
+ axis2_char_t *local_name,
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t *env)
+{
+ axis2_char_t *ns = NULL;
+ axutil_qname_t *node_qname = NULL;
+
+ node_qname = axiom_element_get_qname(element, env, node);
+ if(!node_qname)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Cannot get qname from element %s.",
+ local_name);
+ return AXIS2_FAILURE;
+ }
+
+ ns = axutil_qname_get_uri(node_qname, env);
+ if(!ns)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Cannot get namespace from element %s.",
+ local_name);
+ return AXIS2_FAILURE;
+ }
+
+ /* process assertions common for WS-SecPolicy 1.1 and 1.2 */
+ if(!(axutil_strcmp(ns, RP_SP_NS_11) && axutil_strcmp(ns, RP_SP_NS_12)))
+ {
+ /* this assertion is in WS-SecurityPolicy namespace */
+ if(!strcmp(local_name, RP_BODY))
+ {
+ rp_signed_encrypted_parts_set_body(signed_encrypted_parts, env, AXIS2_TRUE);
+ return AXIS2_SUCCESS;
+ }
+ else if(!strcmp(local_name, RP_HEADER))
+ {
+ rp_header_t *header = NULL;
+ header = rp_signed_encrypted_parts_builder_build_header(element, env);
+ if(!header)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Failed to process Header Assertion.");
+ return AXIS2_FAILURE;
+ }
+
+ return rp_signed_encrypted_parts_add_header(signed_encrypted_parts, env, header);
+ }
+ }
+
+ /* process assertions specific to WS-SecPolicy 1.2 */
+ if(!axutil_strcmp(ns, RP_SP_NS_12))
+ {
+ if(!strcmp(local_name, RP_ATTACHMENTS))
+ {
+ rp_signed_encrypted_parts_set_attachments(signed_encrypted_parts, env, AXIS2_TRUE);
+ return AXIS2_SUCCESS;
+ }
+ }
+
+ /* either namespace or assertion is not understood */
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] Unknown Assertion %s with namespace %s",
+ local_name, ns);
+ return AXIS2_FAILURE;
+}
+
+static rp_header_t *AXIS2_CALL
+rp_signed_encrypted_parts_builder_build_header(
+ axiom_element_t *element,
+ const axutil_env_t *env)
+{
+ rp_header_t *header = NULL;
+ axis2_char_t *name = NULL;
+ axis2_char_t *nspace = NULL;
+
+ name = axiom_element_get_attribute_value_by_name(element, env, RP_NAME);
+ nspace = axiom_element_get_attribute_value_by_name(element, env, RP_NAMESPACE);
+ if(!nspace)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Header assertion should have namespace associated with it.");
+ return NULL;
+ }
+
+ header = rp_header_create(env);
+ if(!header)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Cannot create rp_header structure. Insufficient memory.");
+ return NULL;
+ }
+
+ if(name)
+ {
+ rp_header_set_name(header, env, name);
+ }
+
+ rp_header_set_namespace(header, env, nspace);
+ return header;
+}
diff --git a/neethi/src/secpolicy/builder/supporting_tokens_builder.c b/neethi/src/secpolicy/builder/supporting_tokens_builder.c
new file mode 100644
index 0000000..7482144
--- /dev/null
+++ b/neethi/src/secpolicy/builder/supporting_tokens_builder.c
@@ -0,0 +1,203 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_supporting_tokens_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+supporting_tokens_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_supporting_tokens_t *supporting_tokens);
+
+axis2_bool_t AXIS2_CALL
+is_token_assertion(
+ const axutil_env_t *env,
+ neethi_assertion_type_t type);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_supporting_tokens_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_supporting_tokens_t *supporting_tokens = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ axis2_char_t *local_name = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ supporting_tokens = rp_supporting_tokens_create(env);
+ local_name = axiom_element_get_localname(element, env);
+
+ if(local_name)
+ {
+ if(axutil_strcmp(local_name, RP_SIGNED_SUPPORTING_TOKENS) == 0)
+ {
+ rp_supporting_tokens_set_type(supporting_tokens, env,
+ RP_PROPERTY_SIGNED_SUPPORTING_TOKEN);
+ }
+ else if(axutil_strcmp(local_name, RP_SIGNED_ENDORSING_SUPPORTING_TOKENS) == 0)
+ {
+ rp_supporting_tokens_set_type(supporting_tokens, env,
+ RP_PROPERTY_SIGNED_ENDORSING_SUPPORTING_TOKEN);
+ }
+ else if(axutil_strcmp(local_name, RP_SUPPORTING_TOKENS) == 0)
+ {
+ rp_supporting_tokens_set_type(supporting_tokens, env,
+ RP_PROPERTY_SUPPORTING_SUPPORTING_TOKEN);
+ }
+ else if(axutil_strcmp(local_name, RP_ENDORSING_SUPPORTING_TOKENS) == 0)
+ {
+ rp_supporting_tokens_set_type(supporting_tokens, env,
+ RP_PROPERTY_ENDORSING_SUPPORTING_TOKEN);
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ supporting_tokens_process_alternatives(env, all, supporting_tokens);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_supporting_tokens_free, supporting_tokens,
+ ASSERTION_TYPE_SUPPORTING_TOKENS);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+supporting_tokens_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_supporting_tokens_t *supporting_tokens)
+{
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(value)
+ {
+ if(type == ASSERTION_TYPE_ALGORITHM_SUITE)
+ {
+ rp_algorithmsuite_t *algorithmsuite = NULL;
+ algorithmsuite = (rp_algorithmsuite_t *)neethi_assertion_get_value(assertion, env);
+ if(algorithmsuite)
+ {
+ rp_supporting_tokens_set_algorithmsuite(supporting_tokens, env, algorithmsuite);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(is_token_assertion(env, type))
+ {
+ rp_property_t *token = NULL;
+ token = rp_property_create(env);
+ rp_token_identifier_set_token(token, assertion, env);
+ rp_supporting_tokens_add_token(supporting_tokens, env, token);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
+
+axis2_bool_t AXIS2_CALL
+is_token_assertion(
+ const axutil_env_t *env,
+ neethi_assertion_type_t type)
+{
+ if(type == ASSERTION_TYPE_USERNAME_TOKEN)
+ {
+ return AXIS2_TRUE;
+ }
+ else if(type == ASSERTION_TYPE_X509_TOKEN)
+ {
+ return AXIS2_TRUE;
+ }
+ else if(type == ASSERTION_TYPE_ISSUED_TOKEN)
+ {
+ return AXIS2_TRUE;
+ }
+ else if(type == ASSERTION_TYPE_SAML_TOKEN)
+ {
+ return AXIS2_TRUE;
+ }
+ else
+ return AXIS2_FALSE;
+}
diff --git a/neethi/src/secpolicy/builder/symmetric_binding_builder.c b/neethi/src/secpolicy/builder/symmetric_binding_builder.c
new file mode 100644
index 0000000..1338963
--- /dev/null
+++ b/neethi/src/secpolicy/builder/symmetric_binding_builder.c
@@ -0,0 +1,245 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_symmetric_binding_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+symmetric_binding_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_symmetric_binding_t *symmetric_binding);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_symmetric_binding_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_symmetric_binding_t *symmetric_binding = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ symmetric_binding = rp_symmetric_binding_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ symmetric_binding_process_alternatives(env, all, symmetric_binding);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_symmetric_binding_free, symmetric_binding,
+ ASSERTION_TYPE_SYMMETRIC_BINDING);
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+symmetric_binding_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_symmetric_binding_t * symmetric_binding)
+{
+
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+ rp_binding_commons_t *commons = NULL;
+ rp_symmetric_asymmetric_binding_commons_t *as_commons = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+ commons = rp_binding_commons_create(env);
+ as_commons = rp_symmetric_asymmetric_binding_commons_create(env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(type == ASSERTION_TYPE_PROTECTION_TOKEN)
+ {
+ rp_property_t *protection_token = NULL;
+ protection_token = (rp_property_t *)neethi_assertion_get_value(assertion, env);
+ if(protection_token)
+ {
+ rp_symmetric_binding_set_protection_token(symmetric_binding, env, protection_token);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_ENCRYPTION_TOKEN)
+ {
+ rp_property_t *encryption_token = NULL;
+ encryption_token = (rp_property_t *)neethi_assertion_get_value(assertion, env);
+ if(encryption_token)
+ {
+ rp_symmetric_binding_set_encryption_token(symmetric_binding, env, encryption_token);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_SIGNATURE_TOKEN)
+ {
+ rp_property_t *signature_token = NULL;
+ signature_token = (rp_property_t *)neethi_assertion_get_value(assertion, env);
+ if(signature_token)
+ {
+ rp_symmetric_binding_set_signature_token(symmetric_binding, env, signature_token);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_ALGORITHM_SUITE)
+ {
+ rp_algorithmsuite_t *algorithmsuite = NULL;
+ algorithmsuite = (rp_algorithmsuite_t *)neethi_assertion_get_value(assertion, env);
+ if(algorithmsuite)
+ {
+ rp_binding_commons_set_algorithmsuite(commons, env, algorithmsuite);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_INCLUDE_TIMESTAMP)
+ {
+ rp_binding_commons_set_include_timestamp(commons, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_LAYOUT)
+ {
+ rp_layout_t *layout = NULL;
+ layout = (rp_layout_t *)neethi_assertion_get_value(assertion, env);
+ if(layout)
+ {
+ rp_binding_commons_set_layout(commons, env, layout);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_ENCRYPT_BEFORE_SIGNING)
+ {
+ rp_symmetric_asymmetric_binding_commons_set_protection_order(as_commons, env,
+ RP_ENCRYPT_BEFORE_SIGNING);
+ }
+ else if(type == ASSERTION_TYPE_SIGN_BEFORE_ENCRYPTING)
+ {
+ rp_symmetric_asymmetric_binding_commons_set_protection_order(as_commons, env,
+ RP_SIGN_BEFORE_ENCRYPTING);
+ }
+ else if(type == ASSERTION_TYPE_ENCRYPT_SIGNATURE)
+ {
+ rp_symmetric_asymmetric_binding_commons_set_signature_protection(as_commons, env,
+ AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_PROTECT_TOKENS)
+ {
+ rp_symmetric_asymmetric_binding_commons_set_token_protection(as_commons, env,
+ AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_ONLY_SIGN_ENTIRE_HEADERS_AND_BODY)
+ {
+ rp_symmetric_asymmetric_binding_commons_set_entire_headers_and_body_signatures(
+ as_commons, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_SUPPORTING_TOKENS)
+ {
+ rp_supporting_tokens_t *supporting_tokens = NULL;
+ supporting_tokens
+ = (rp_supporting_tokens_t *)neethi_assertion_get_value(assertion, env);
+ if(supporting_tokens)
+ {
+ rp_property_type_t type;
+ type = rp_supporting_tokens_get_type(supporting_tokens, env);
+ if(type == RP_PROPERTY_SIGNED_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_signed_supporting_tokens(commons, env, supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_SIGNED_ENDORSING_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_signed_endorsing_supporting_tokens(commons, env,
+ supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_SUPPORTING_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_supporting_tokens(commons, env, supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_ENDORSING_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_endorsing_supporting_tokens(commons, env,
+ supporting_tokens);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ rp_symmetric_asymmetric_binding_commons_set_binding_commons(as_commons, env, commons);
+ rp_symmetric_binding_set_symmetric_asymmetric_binding_commons(symmetric_binding, env,
+ as_commons);
+
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/token_identifier.c b/neethi/src/secpolicy/builder/token_identifier.c
new file mode 100644
index 0000000..938627e
--- /dev/null
+++ b/neethi/src/secpolicy/builder/token_identifier.c
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_token_identifier.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_assertion.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+/***********************************/
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_token_identifier_set_token(
+ rp_property_t *token,
+ neethi_assertion_t *assertion,
+ const axutil_env_t *env)
+{
+ void *value = NULL;
+ neethi_assertion_type_t type;
+
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(value)
+ {
+ if(type == ASSERTION_TYPE_USERNAME_TOKEN)
+ {
+ rp_username_token_t *username_token = NULL;
+ username_token = (rp_username_token_t *)value;
+ rp_property_set_value(token, env, username_token, RP_PROPERTY_USERNAME_TOKEN);
+ return AXIS2_SUCCESS;
+ }
+ else if(type == ASSERTION_TYPE_X509_TOKEN)
+ {
+ rp_x509_token_t *x509_token = NULL;
+ x509_token = (rp_x509_token_t *)value;
+ rp_property_set_value(token, env, x509_token, RP_PROPERTY_X509_TOKEN);
+ return AXIS2_SUCCESS;
+ }
+ else if(type == ASSERTION_TYPE_SAML_TOKEN)
+ {
+ rp_saml_token_t *saml_token = NULL;
+ saml_token = (rp_saml_token_t *)value;
+ rp_property_set_value(token, env, saml_token, RP_PROPERTY_SAML_TOKEN);
+ return AXIS2_SUCCESS;
+ }
+ else if(type == ASSERTION_TYPE_ISSUED_TOKEN)
+ {
+ rp_issued_token_t *issued_token = NULL;
+ issued_token = (rp_issued_token_t *)value;
+ rp_property_set_value(token, env, issued_token, RP_PROPERTY_ISSUED_TOKEN);
+ return AXIS2_SUCCESS;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+
+ return AXIS2_FAILURE;
+}
+
diff --git a/neethi/src/secpolicy/builder/transport_binding_builder.c b/neethi/src/secpolicy/builder/transport_binding_builder.c
new file mode 100644
index 0000000..be84119
--- /dev/null
+++ b/neethi/src/secpolicy/builder/transport_binding_builder.c
@@ -0,0 +1,196 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_transport_binding_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+transport_binding_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_transport_binding_t *transport_binding);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_transport_binding_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_transport_binding_t *transport_binding = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ transport_binding = rp_transport_binding_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ transport_binding_process_alternatives(env, all, transport_binding);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_transport_binding_free, transport_binding,
+ ASSERTION_TYPE_TRANSPORT_BINDING);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+transport_binding_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_transport_binding_t *transport_binding)
+{
+
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+ rp_binding_commons_t *commons = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+ commons = rp_binding_commons_create(env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(type == ASSERTION_TYPE_TRANSPORT_TOKEN)
+ {
+ rp_property_t *transport_token = NULL;
+ transport_token = (rp_property_t *)neethi_assertion_get_value(assertion, env);
+ if(transport_token)
+ {
+ rp_transport_binding_set_transport_token(transport_binding, env, transport_token);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_ALGORITHM_SUITE)
+ {
+ rp_algorithmsuite_t *algorithmsuite = NULL;
+ algorithmsuite = (rp_algorithmsuite_t *)neethi_assertion_get_value(assertion, env);
+ if(algorithmsuite)
+ {
+ rp_binding_commons_set_algorithmsuite(commons, env, algorithmsuite);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_INCLUDE_TIMESTAMP)
+ {
+ rp_binding_commons_set_include_timestamp(commons, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_LAYOUT)
+ {
+ rp_layout_t *layout = NULL;
+ layout = (rp_layout_t *)neethi_assertion_get_value(assertion, env);
+ if(layout)
+ {
+ rp_binding_commons_set_layout(commons, env, layout);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else if(type == ASSERTION_TYPE_SUPPORTING_TOKENS)
+ {
+ rp_supporting_tokens_t *supporting_tokens = NULL;
+ supporting_tokens
+ = (rp_supporting_tokens_t *)neethi_assertion_get_value(assertion, env);
+ if(supporting_tokens)
+ {
+ rp_property_type_t type;
+ type = rp_supporting_tokens_get_type(supporting_tokens, env);
+ if(type == RP_PROPERTY_SIGNED_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_signed_supporting_tokens(commons, env, supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_SIGNED_ENDORSING_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_signed_endorsing_supporting_tokens(commons, env,
+ supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_SUPPORTING_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_supporting_tokens(commons, env, supporting_tokens);
+ }
+ else if(type == RP_PROPERTY_ENDORSING_SUPPORTING_TOKEN)
+ {
+ rp_binding_commons_set_endorsing_supporting_tokens(commons, env,
+ supporting_tokens);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+
+ rp_transport_binding_set_binding_commons(transport_binding, env, commons);
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/transport_token_builder.c b/neethi/src/secpolicy/builder/transport_token_builder.c
new file mode 100644
index 0000000..f50183d
--- /dev/null
+++ b/neethi/src/secpolicy/builder/transport_token_builder.c
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_transport_token_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_assertion.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+transport_token_process_alternatives(
+ const axutil_env_t * env,
+ neethi_all_t * all,
+ rp_property_t * transport_token);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_transport_token_builder_build(
+ const axutil_env_t * env,
+ axiom_node_t * node,
+ axiom_element_t * element)
+{
+ rp_property_t *transport_token = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ transport_token = rp_property_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ transport_token_process_alternatives(env, all, transport_token);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_property_free, transport_token,
+ ASSERTION_TYPE_TRANSPORT_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+transport_token_process_alternatives(
+ const axutil_env_t * env,
+ neethi_all_t * all,
+ rp_property_t * transport_token)
+{
+
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(value)
+ {
+ if(type == ASSERTION_TYPE_HTTPS_TOKEN)
+ {
+ rp_https_token_t *https_token = NULL;
+ https_token = (rp_https_token_t *)neethi_assertion_get_value(assertion, env);
+ if(https_token)
+ {
+ rp_property_set_value(transport_token, env, https_token,
+ RP_PROPERTY_HTTPS_TOKEN);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/trust10_builder.c b/neethi/src/secpolicy/builder/trust10_builder.c
new file mode 100644
index 0000000..e97f0f7
--- /dev/null
+++ b/neethi/src/secpolicy/builder/trust10_builder.c
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_trust10_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+trust10_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_trust10_t *trust10);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_trust10_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_trust10_t *trust10 = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ trust10 = rp_trust10_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ trust10_process_alternatives(env, all, trust10);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_trust10_free, trust10, ASSERTION_TYPE_TRUST10);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+trust10_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_trust10_t *trust10)
+{
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(type == ASSERTION_TYPE_MUST_SUPPORT_CLIENT_CHALLENGE)
+ {
+ rp_trust10_set_must_support_client_challenge(trust10, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_MUST_SUPPORT_SERVER_CHALLENGE)
+ {
+ rp_trust10_set_must_support_server_challenge(trust10, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_CLIENT_ENTROPY)
+ {
+ rp_trust10_set_require_client_entropy(trust10, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_SERVER_ENTROPHY)
+ {
+ rp_trust10_set_require_server_entropy(trust10, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_MUST_SUPPORT_ISSUED_TOKENS)
+ {
+ rp_trust10_set_must_support_issued_token(trust10, env, AXIS2_TRUE);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/username_token_builder.c b/neethi/src/secpolicy/builder/username_token_builder.c
new file mode 100644
index 0000000..b8ac02b
--- /dev/null
+++ b/neethi/src/secpolicy/builder/username_token_builder.c
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_username_token_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+static axis2_status_t AXIS2_CALL username_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_username_token_t *username_token);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_username_token_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_username_token_t *username_token = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ axis2_char_t *inclusion_value = NULL;
+ axutil_qname_t *qname = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ username_token = rp_username_token_create(env);
+ qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS_11, RP_SP_PREFIX);
+ inclusion_value = axiom_element_get_attribute_value(element, env, qname);
+ axutil_qname_free(qname, env);
+ qname = NULL;
+ if(!inclusion_value)
+ {
+ /* we can try whether WS-SP1.2 specific inclusion value */
+ qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS_12, RP_SP_PREFIX);
+ inclusion_value = axiom_element_get_attribute_value(element, env, qname);
+ axutil_qname_free(qname, env);
+ qname = NULL;
+ }
+
+ rp_username_token_set_inclusion(username_token, env, inclusion_value);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ assertion = neethi_assertion_create(env);
+ neethi_assertion_set_value(assertion, env, username_token, ASSERTION_TYPE_USERNAME_TOKEN);
+ return assertion;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ username_token_process_alternatives(env, all, username_token);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_username_token_free, username_token,
+ ASSERTION_TYPE_USERNAME_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+static axis2_status_t AXIS2_CALL
+username_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_username_token_t *username_token)
+{
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(value)
+ {
+ if(type == ASSERTION_TYPE_WSS_USERNAME_TOKEN_10)
+ {
+ rp_username_token_set_useUTprofile10(username_token, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_WSS_USERNAME_TOKEN_11)
+ {
+ rp_username_token_set_useUTprofile11(username_token, env, AXIS2_TRUE);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/wss10_builder.c b/neethi/src/secpolicy/builder/wss10_builder.c
new file mode 100644
index 0000000..6dd10ae
--- /dev/null
+++ b/neethi/src/secpolicy/builder/wss10_builder.c
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_wss10_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+wss10_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_wss10_t *wss10);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_wss10_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_wss10_t *wss10 = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ wss10 = rp_wss10_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ wss10_process_alternatives(env, all, wss10);
+
+ assertion = neethi_assertion_create_with_args(env, (AXIS2_FREE_VOID_ARG)rp_wss10_free,
+ wss10, ASSERTION_TYPE_WSS10);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+wss10_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_wss10_t *wss10)
+{
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(type == ASSERTION_TYPE_MUST_SUPPORT_REF_KEY_IDENTIFIER)
+ {
+ rp_wss10_set_must_support_ref_key_identifier(wss10, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_MUST_SUPPORT_REF_ISSUER_SERIAL)
+ {
+ rp_wss10_set_must_support_ref_issuer_serial(wss10, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_MUST_SUPPORT_REF_EXTERNAL_URI)
+ {
+ rp_wss10_set_must_support_ref_external_uri(wss10, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_MUST_SUPPORT_REF_EMBEDDED_TOKEN)
+ {
+ rp_wss10_set_must_support_ref_embedded_token(wss10, env, AXIS2_TRUE);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/wss11_builder.c b/neethi/src/secpolicy/builder/wss11_builder.c
new file mode 100644
index 0000000..6249181
--- /dev/null
+++ b/neethi/src/secpolicy/builder/wss11_builder.c
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_wss11_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+wss11_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_wss11_t *wss11);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_wss11_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_wss11_t *wss11 = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ wss11 = rp_wss11_create(env);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ wss11_process_alternatives(env, all, wss11);
+
+ assertion = neethi_assertion_create_with_args(env, (AXIS2_FREE_VOID_ARG)rp_wss11_free,
+ wss11, ASSERTION_TYPE_WSS11);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+wss11_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_wss11_t *wss11)
+{
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+ void *value = NULL;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ value = neethi_assertion_get_value(assertion, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(type == ASSERTION_TYPE_MUST_SUPPORT_REF_KEY_IDENTIFIER)
+ {
+ rp_wss11_set_must_support_ref_key_identifier(wss11, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_MUST_SUPPORT_REF_ISSUER_SERIAL)
+ {
+ rp_wss11_set_must_support_ref_issuer_serial(wss11, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_MUST_SUPPORT_REF_EXTERNAL_URI)
+ {
+ rp_wss11_set_must_support_ref_external_uri(wss11, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_MUST_SUPPORT_REF_EMBEDDED_TOKEN)
+ {
+ rp_wss11_set_must_support_ref_embedded_token(wss11, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_MUST_SUPPORT_REF_THUMBPRINT)
+ {
+ rp_wss11_set_must_support_ref_thumbprint(wss11, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_MUST_SUPPORT_REF_ENCRYPTED_KEY)
+ {
+ rp_wss11_set_must_support_ref_encryptedkey(wss11, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_SIGNATURE_CONFIRMATION)
+ {
+ rp_wss11_set_require_signature_confirmation(wss11, env, AXIS2_TRUE);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/builder/x509_token_builder.c b/neethi/src/secpolicy/builder/x509_token_builder.c
new file mode 100644
index 0000000..fa8d8f9
--- /dev/null
+++ b/neethi/src/secpolicy/builder/x509_token_builder.c
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_x509_token_builder.h>
+#include <neethi_operator.h>
+#include <neethi_policy.h>
+#include <neethi_exactlyone.h>
+#include <neethi_all.h>
+#include <neethi_engine.h>
+
+/*private functions*/
+
+axis2_status_t AXIS2_CALL
+x509_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_x509_token_t *x509_token);
+
+/***********************************/
+
+AXIS2_EXTERN neethi_assertion_t *AXIS2_CALL
+rp_x509_token_builder_build(
+ const axutil_env_t *env,
+ axiom_node_t *node,
+ axiom_element_t *element)
+{
+ rp_x509_token_t *x509_token = NULL;
+ neethi_policy_t *policy = NULL;
+ axiom_node_t *child_node = NULL;
+ axiom_element_t *child_element = NULL;
+ axutil_array_list_t *alternatives = NULL;
+ neethi_operator_t *component = NULL;
+ neethi_all_t *all = NULL;
+ axis2_char_t *inclusion_value = NULL;
+ axutil_qname_t *qname = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
+
+ x509_token = rp_x509_token_create(env);
+ qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS_11, RP_SP_PREFIX);
+ inclusion_value = axiom_element_get_attribute_value(element, env, qname);
+ axutil_qname_free(qname, env);
+ qname = NULL;
+
+ if(!inclusion_value)
+ {
+ /* we can try whether WS-SP1.2 specific inclusion value */
+ qname = axutil_qname_create(env, RP_INCLUDE_TOKEN, RP_SP_NS_12, RP_SP_PREFIX);
+ inclusion_value = axiom_element_get_attribute_value(element, env, qname);
+ axutil_qname_free(qname, env);
+ qname = NULL;
+ }
+
+ rp_x509_token_set_inclusion(x509_token, env, inclusion_value);
+
+ child_node = axiom_node_get_first_element(node, env);
+ if(!child_node)
+ {
+ return NULL;
+ }
+
+ if(axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ child_element = (axiom_element_t *)axiom_node_get_data_element(child_node, env);
+ if(child_element)
+ {
+ policy = neethi_engine_get_policy(env, child_node, child_element);
+ if(!policy)
+ {
+ return NULL;
+ }
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
+ component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
+ all = (neethi_all_t *)neethi_operator_get_value(component, env);
+ x509_token_process_alternatives(env, all, x509_token);
+
+ assertion = neethi_assertion_create_with_args(env,
+ (AXIS2_FREE_VOID_ARG)rp_x509_token_free, x509_token, ASSERTION_TYPE_X509_TOKEN);
+
+ neethi_policy_free(normalized_policy, env);
+ normalized_policy = NULL;
+
+ return assertion;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
+
+axis2_status_t AXIS2_CALL
+x509_token_process_alternatives(
+ const axutil_env_t *env,
+ neethi_all_t *all,
+ rp_x509_token_t *x509_token)
+{
+ neethi_operator_t *operator = NULL;
+ axutil_array_list_t *arraylist = NULL;
+ neethi_assertion_t *assertion = NULL;
+ neethi_assertion_type_t type;
+
+ int i = 0;
+
+ arraylist = neethi_all_get_policy_components(all, env);
+
+ for(i = 0; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ operator = (neethi_operator_t *)axutil_array_list_get(arraylist, env, i);
+ assertion = (neethi_assertion_t *)neethi_operator_get_value(operator, env);
+ type = neethi_assertion_get_type(assertion, env);
+
+ if(type == ASSERTION_TYPE_REQUIRE_DERIVED_KEYS_SC10)
+ {
+ rp_x509_token_set_derivedkey(x509_token, env, DERIVEKEY_NEEDED);
+ rp_x509_token_set_derivedkey_version(x509_token, env, DERIVEKEY_VERSION_SC10);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_DERIVED_KEYS_SC13)
+ {
+ rp_x509_token_set_derivedkey(x509_token, env, DERIVEKEY_NEEDED);
+ rp_x509_token_set_derivedkey_version(x509_token, env, DERIVEKEY_VERSION_SC13);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_KEY_IDENTIFIRE_REFERENCE)
+ {
+ rp_x509_token_set_require_key_identifier_reference(x509_token, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_ISSUER_SERIAL_REFERENCE)
+ {
+ rp_x509_token_set_require_issuer_serial_reference(x509_token, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_EMBEDDED_TOKEN_REFERENCE)
+ {
+ rp_x509_token_set_require_embedded_token_reference(x509_token, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_REQUIRE_THUMBPRINT_REFERENCE)
+ {
+ rp_x509_token_set_require_thumb_print_reference(x509_token, env, AXIS2_TRUE);
+ }
+ else if(type == ASSERTION_TYPE_WSS_X509_V1_TOKEN_10)
+ {
+ rp_x509_token_set_token_version_and_type(x509_token, env, RP_WSS_X509_V1_TOKEN_10);
+ }
+ else if(type == ASSERTION_TYPE_WSS_X509_V3_TOKEN_10)
+ {
+ rp_x509_token_set_token_version_and_type(x509_token, env, RP_WSS_X509_V3_TOKEN_10);
+ }
+ else
+ return AXIS2_FAILURE;
+ }
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/Makefile.am b/neethi/src/secpolicy/model/Makefile.am
new file mode 100644
index 0000000..b24ddb7
--- /dev/null
+++ b/neethi/src/secpolicy/model/Makefile.am
@@ -0,0 +1,21 @@
+TESTS =
+
+noinst_LTLIBRARIES = librp_model.la
+
+librp_model_la_SOURCES = algorithmsuite.c asymmetric_binding.c \
+ binding_commons.c header.c element.c https_token.c layout.c \
+ property.c rampart_config.c secpolicy.c security_context_token.c \
+ signed_encrypted_elements.c signed_encrypted_parts.c signed_encrypted_items.c \
+ supporting_tokens.c symmetric_asymmetric_binding_commons.c \
+ symmetric_binding.c transport_binding.c ut.c wss10.c wss11.c x509_token.c \
+ trust10.c issued_token.c saml_token.c token.c
+
+
+librp_model_la_LIBADD = ../../../../util/src/libaxutil.la
+
+
+INCLUDES = -I$(top_builddir)/include \
+ -I ../../../include \
+ -I ../../../../util/include \
+ -I ../../../../axiom/include \
+ -I ../../../../include
diff --git a/neethi/src/secpolicy/model/algorithmsuite.c b/neethi/src/secpolicy/model/algorithmsuite.c
new file mode 100644
index 0000000..db3426c
--- /dev/null
+++ b/neethi/src/secpolicy/model/algorithmsuite.c
@@ -0,0 +1,627 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_algorithmsuite.h>
+
+struct rp_algorithmsuite_t
+{
+ axis2_char_t *algosuite_string;
+ axis2_char_t *symmetric_signature;
+ axis2_char_t *asymmetric_signature;
+ axis2_char_t *computed_key;
+ int max_symmetric_keylength;
+ int min_asymmetric_keylength;
+ int max_asymmetric_keylength;
+ axis2_char_t *digest;
+ axis2_char_t *encryption;
+ axis2_char_t *symmetrickeywrap;
+ axis2_char_t *asymmetrickeywrap;
+ axis2_char_t *encryption_key_derivation;
+ axis2_char_t *signature_key_derivation;
+ int encryption_key_derivation_keylength;
+ int signature_key_derivation_keylength;
+ int min_symmetric_keylength;
+ axis2_char_t *c14n;
+ axis2_char_t *soap_normalization;
+ axis2_char_t *str_transformation;
+ axis2_char_t *xpath;
+ int ref;
+
+};
+
+AXIS2_EXTERN rp_algorithmsuite_t *AXIS2_CALL
+rp_algorithmsuite_create(
+ const axutil_env_t *env)
+{
+ rp_algorithmsuite_t *algorithmsuite = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ algorithmsuite = (rp_algorithmsuite_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_algorithmsuite_t));
+
+ if(algorithmsuite == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ algorithmsuite->algosuite_string = NULL;
+ algorithmsuite->symmetric_signature = RP_HMAC_SHA1;
+ algorithmsuite->asymmetric_signature = RP_RSA_SHA1;
+ algorithmsuite->computed_key = RP_P_SHA1;
+ algorithmsuite->max_symmetric_keylength = 256;
+ algorithmsuite->min_asymmetric_keylength = 1024;
+ algorithmsuite->max_asymmetric_keylength = 4096;
+ algorithmsuite->digest = NULL;
+ algorithmsuite->encryption = NULL;
+ algorithmsuite->symmetrickeywrap = NULL;
+ algorithmsuite->asymmetrickeywrap = NULL;
+ algorithmsuite->encryption_key_derivation = NULL;
+ algorithmsuite->signature_key_derivation = NULL;
+ algorithmsuite->encryption_key_derivation_keylength = 192;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+ algorithmsuite->min_symmetric_keylength = 0;
+ ;
+ algorithmsuite->c14n = RP_EX_C14N;
+ algorithmsuite->soap_normalization = NULL;
+ algorithmsuite->str_transformation = NULL;
+ algorithmsuite->xpath = NULL;
+ algorithmsuite->ref = 0;
+ return algorithmsuite;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_algorithmsuite_free(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ if(algorithmsuite)
+ {
+ if(--(algorithmsuite->ref) > 0)
+ {
+ return;
+ }
+
+ AXIS2_FREE(env->allocator, algorithmsuite);
+ algorithmsuite = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_algosuite_string(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ if(!algorithmsuite)
+ return NULL;
+ else
+ return algorithmsuite->algosuite_string;
+
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_algosuite(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ axis2_char_t *algosuite_string)
+{
+ AXIS2_PARAM_CHECK(env->error, algosuite_string, AXIS2_FAILURE);
+
+ algorithmsuite->algosuite_string = algosuite_string;
+
+ if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC256) == 0)
+ {
+ algorithmsuite->digest = RP_SHA1;
+ algorithmsuite->encryption = RP_AES256;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES256;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA_OAEP;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L256;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 256;
+ algorithmsuite->encryption_key_derivation_keylength = 256;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC192) == 0)
+ {
+ algorithmsuite->digest = RP_SHA1;
+ algorithmsuite->encryption = RP_AES192;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES192;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA_OAEP;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 192;
+ algorithmsuite->encryption_key_derivation_keylength = 192;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC128) == 0)
+ {
+ algorithmsuite->digest = RP_SHA1;
+ algorithmsuite->encryption = RP_AES128;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES128;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA_OAEP;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L128;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L128;
+ algorithmsuite->min_symmetric_keylength = 128;
+ algorithmsuite->encryption_key_derivation_keylength = 128;
+ algorithmsuite->signature_key_derivation_keylength = 128;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_TRIPLE_DES) == 0)
+ {
+ algorithmsuite->digest = RP_SHA1;
+ algorithmsuite->encryption = RP_TRIPLE_DES;
+ algorithmsuite->symmetrickeywrap = RP_KW_TRIPLE_DES;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA_OAEP;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 192;
+ algorithmsuite->encryption_key_derivation_keylength = 192;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC256_RSA15) == 0)
+ {
+ algorithmsuite->digest = RP_SHA1;
+ algorithmsuite->encryption = RP_AES256;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES256;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA15;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L256;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 256;
+ algorithmsuite->encryption_key_derivation_keylength = 256;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC192_RSA15) == 0)
+ {
+ algorithmsuite->digest = RP_SHA1;
+ algorithmsuite->encryption = RP_AES192;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES192;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA15;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 192;
+ algorithmsuite->encryption_key_derivation_keylength = 192;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC128_RSA15) == 0)
+ {
+ algorithmsuite->digest = RP_SHA1;
+ algorithmsuite->encryption = RP_AES128;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES128;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA15;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L128;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L128;
+ algorithmsuite->min_symmetric_keylength = 128;
+ algorithmsuite->encryption_key_derivation_keylength = 128;
+ algorithmsuite->signature_key_derivation_keylength = 128;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_TRIPLE_DES_RSA15) == 0)
+ {
+ algorithmsuite->digest = RP_SHA1;
+ algorithmsuite->encryption = RP_TRIPLE_DES;
+ algorithmsuite->symmetrickeywrap = RP_KW_TRIPLE_DES;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA15;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 192;
+ algorithmsuite->encryption_key_derivation_keylength = 192;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC256_SHA256) == 0)
+ {
+ algorithmsuite->digest = RP_SHA256;
+ algorithmsuite->encryption = RP_AES256;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES256;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA_OAEP;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L256;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 256;
+ algorithmsuite->encryption_key_derivation_keylength = 256;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC192_SHA256) == 0)
+ {
+ algorithmsuite->digest = RP_SHA256;
+ algorithmsuite->encryption = RP_AES192;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES192;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA_OAEP;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 192;
+ algorithmsuite->encryption_key_derivation_keylength = 192;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC128_SHA256) == 0)
+ {
+ algorithmsuite->digest = RP_SHA256;
+ algorithmsuite->encryption = RP_AES128;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES128;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA_OAEP;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L128;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L128;
+ algorithmsuite->min_symmetric_keylength = 128;
+ algorithmsuite->encryption_key_derivation_keylength = 128;
+ algorithmsuite->signature_key_derivation_keylength = 128;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_TRIPLE_DES_SHA256) == 0)
+ {
+ algorithmsuite->digest = RP_SHA256;
+ algorithmsuite->encryption = RP_TRIPLE_DES;
+ algorithmsuite->symmetrickeywrap = RP_KW_TRIPLE_DES;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA_OAEP;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 192;
+ algorithmsuite->encryption_key_derivation_keylength = 192;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC256_SHA256_RSA15) == 0)
+ {
+ algorithmsuite->digest = RP_SHA256;
+ algorithmsuite->encryption = RP_AES256;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES256;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA15;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L256;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 256;
+ algorithmsuite->encryption_key_derivation_keylength = 256;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC192_SHA256_RSA15) == 0)
+ {
+ algorithmsuite->digest = RP_SHA256;
+ algorithmsuite->encryption = RP_AES192;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES192;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA15;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 192;
+ algorithmsuite->encryption_key_derivation_keylength = 192;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_BASIC128_SHA256_RSA15) == 0)
+ {
+ algorithmsuite->digest = RP_SHA256;
+ algorithmsuite->encryption = RP_AES128;
+ algorithmsuite->symmetrickeywrap = RP_KW_AES128;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA15;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L128;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L128;
+ algorithmsuite->min_symmetric_keylength = 128;
+ algorithmsuite->encryption_key_derivation_keylength = 128;
+ algorithmsuite->signature_key_derivation_keylength = 128;
+
+ return AXIS2_SUCCESS;
+ }
+ else if(axutil_strcmp(algosuite_string, RP_ALGO_SUITE_TRIPLE_DES_SHA256_RSA15) == 0)
+ {
+ algorithmsuite->digest = RP_SHA256;
+ algorithmsuite->encryption = RP_TRIPLE_DES;
+ algorithmsuite->symmetrickeywrap = RP_KW_TRIPLE_DES;
+ algorithmsuite->asymmetrickeywrap = RP_KW_RSA15;
+ algorithmsuite->encryption_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->signature_key_derivation = RP_P_SHA1_L192;
+ algorithmsuite->min_symmetric_keylength = 192;
+ algorithmsuite->encryption_key_derivation_keylength = 192;
+ algorithmsuite->signature_key_derivation_keylength = 192;
+
+ return AXIS2_SUCCESS;
+ }
+ else
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_symmetric_signature(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->symmetric_signature;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_symmetric_signature(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ axis2_char_t *symmetric_signature)
+{
+ AXIS2_PARAM_CHECK(env->error, symmetric_signature, AXIS2_FAILURE);
+
+ algorithmsuite->symmetric_signature = symmetric_signature;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_asymmetric_signature(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->asymmetric_signature;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_asymmetric_signature(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ axis2_char_t *asymmetric_signature)
+{
+ AXIS2_PARAM_CHECK(env->error, asymmetric_signature, AXIS2_FAILURE);
+
+ algorithmsuite->asymmetric_signature = asymmetric_signature;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_computed_key(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->computed_key;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_computed_key(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ axis2_char_t *computed_key)
+{
+ AXIS2_PARAM_CHECK(env->error, computed_key, AXIS2_FAILURE);
+
+ algorithmsuite->computed_key = computed_key;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_digest(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->digest;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_encryption(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->encryption;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+rp_algorithmsuite_get_max_symmetric_keylength(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->max_symmetric_keylength;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_max_symmetric_keylength(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ int max_symmetric_keylength)
+{
+ algorithmsuite->max_symmetric_keylength = max_symmetric_keylength;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+rp_algorithmsuite_get_min_symmetric_keylength(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->min_symmetric_keylength;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+rp_algorithmsuite_get_encryption_derivation_keylength(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->encryption_key_derivation_keylength;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+rp_algorithmsuite_get_signature_derivation_keylength(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->signature_key_derivation_keylength;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+rp_algorithmsuite_get_max_asymmetric_keylength(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->max_asymmetric_keylength;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_max_asymmetric_keylength(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ int max_asymmetric_keylength)
+{
+ algorithmsuite->max_asymmetric_keylength = max_asymmetric_keylength;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+rp_algorithmsuite_get_min_asymmetric_keylength(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->min_asymmetric_keylength;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_min_asymmetric_keylength(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ int min_asymmetric_keylength)
+{
+ algorithmsuite->min_asymmetric_keylength = min_asymmetric_keylength;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_symmetrickeywrap(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->symmetrickeywrap;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_asymmetrickeywrap(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->asymmetrickeywrap;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_signature_key_derivation(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->signature_key_derivation;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_encryption_key_derivation(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->encryption_key_derivation;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_soap_normalization(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->soap_normalization;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_soap_normalization(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ axis2_char_t *soap_normalization)
+{
+ AXIS2_PARAM_CHECK(env->error, soap_normalization, AXIS2_FAILURE);
+ algorithmsuite->soap_normalization = soap_normalization;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_str_transformation(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->str_transformation;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_str_transformation(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ axis2_char_t *str_transformation)
+{
+ AXIS2_PARAM_CHECK(env->error, str_transformation, AXIS2_FAILURE);
+ algorithmsuite->str_transformation = str_transformation;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_c14n(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->c14n;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_c14n(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ axis2_char_t *c14n)
+{
+ AXIS2_PARAM_CHECK(env->error, c14n, AXIS2_FAILURE);
+ algorithmsuite->c14n = c14n;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_algorithmsuite_get_xpath(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ return algorithmsuite->xpath;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_set_xpath(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env,
+ axis2_char_t *xpath)
+{
+ AXIS2_PARAM_CHECK(env->error, xpath, AXIS2_FAILURE);
+ algorithmsuite->xpath = xpath;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_algorithmsuite_increment_ref(
+ rp_algorithmsuite_t *algorithmsuite,
+ const axutil_env_t *env)
+{
+ algorithmsuite->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/asymmetric_binding.c b/neethi/src/secpolicy/model/asymmetric_binding.c
new file mode 100644
index 0000000..0e57dce
--- /dev/null
+++ b/neethi/src/secpolicy/model/asymmetric_binding.c
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_asymmetric_binding.h>
+
+struct rp_asymmetric_binding_t
+{
+ rp_symmetric_asymmetric_binding_commons_t *symmetric_asymmetric_binding_commons;
+ rp_property_t *initiator_token;
+ rp_property_t *recipient_token;
+ int ref;
+};
+
+AXIS2_EXTERN rp_asymmetric_binding_t *AXIS2_CALL
+rp_asymmetric_binding_create(
+ const axutil_env_t *env)
+{
+ rp_asymmetric_binding_t *asymmetric_binding = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ asymmetric_binding = (rp_asymmetric_binding_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_asymmetric_binding_t));
+
+ if(asymmetric_binding == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ asymmetric_binding->symmetric_asymmetric_binding_commons = NULL;
+ asymmetric_binding->initiator_token = NULL;
+ asymmetric_binding->recipient_token = NULL;
+ asymmetric_binding->ref = 0;
+
+ return asymmetric_binding;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_asymmetric_binding_free(
+ rp_asymmetric_binding_t *asymmetric_binding,
+ const axutil_env_t *env)
+{
+ if(asymmetric_binding)
+ {
+
+ if(--(asymmetric_binding->ref) > 0)
+ {
+ return;
+ }
+
+ if(asymmetric_binding->symmetric_asymmetric_binding_commons)
+ {
+ rp_symmetric_asymmetric_binding_commons_free(
+ asymmetric_binding-> symmetric_asymmetric_binding_commons, env);
+ asymmetric_binding->symmetric_asymmetric_binding_commons = NULL;
+ }
+ if(asymmetric_binding->initiator_token)
+ {
+ rp_property_free(asymmetric_binding->initiator_token, env);
+ asymmetric_binding->initiator_token = NULL;
+ }
+ if(asymmetric_binding->recipient_token)
+ {
+ rp_property_free(asymmetric_binding->recipient_token, env);
+ asymmetric_binding->recipient_token = NULL;
+ }
+ AXIS2_FREE(env->allocator, asymmetric_binding);
+ }
+
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN rp_symmetric_asymmetric_binding_commons_t *AXIS2_CALL
+rp_asymmetric_binding_get_symmetric_asymmetric_binding_commons(
+ rp_asymmetric_binding_t *asymmetric_binding,
+ const axutil_env_t *env)
+{
+ return asymmetric_binding->symmetric_asymmetric_binding_commons;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_asymmetric_binding_set_symmetric_asymmetric_binding_commons(
+ rp_asymmetric_binding_t *asymmetric_binding,
+ const axutil_env_t *env,
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons)
+{
+ AXIS2_PARAM_CHECK(env->error, symmetric_asymmetric_binding_commons, AXIS2_FAILURE);
+
+ asymmetric_binding->symmetric_asymmetric_binding_commons = symmetric_asymmetric_binding_commons;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_property_t *AXIS2_CALL
+rp_asymmetric_binding_get_initiator_token(
+ rp_asymmetric_binding_t *asymmetric_binding,
+ const axutil_env_t *env)
+{
+ return asymmetric_binding->initiator_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_asymmetric_binding_set_initiator_token(
+ rp_asymmetric_binding_t *asymmetric_binding,
+ const axutil_env_t *env,
+ rp_property_t *initiator_token)
+{
+ AXIS2_PARAM_CHECK(env->error, initiator_token, AXIS2_FAILURE);
+
+ rp_property_increment_ref(initiator_token, env);
+ asymmetric_binding->initiator_token = initiator_token;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_asymmetric_binding_set_recipient_token(
+ rp_asymmetric_binding_t *asymmetric_binding,
+ const axutil_env_t *env,
+ rp_property_t *recipient_token)
+{
+ AXIS2_PARAM_CHECK(env->error, recipient_token, AXIS2_FAILURE);
+
+ rp_property_increment_ref(recipient_token, env);
+ asymmetric_binding->recipient_token = recipient_token;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_property_t *AXIS2_CALL
+rp_asymmetric_binding_get_recipient_token(
+ rp_asymmetric_binding_t *asymmetric_binding,
+ const axutil_env_t *env)
+{
+ return asymmetric_binding->recipient_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_asymmetric_binding_increment_ref(
+ rp_asymmetric_binding_t *asymmetric_binding,
+ const axutil_env_t *env)
+{
+ asymmetric_binding->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/binding_commons.c b/neethi/src/secpolicy/model/binding_commons.c
new file mode 100644
index 0000000..9795c78
--- /dev/null
+++ b/neethi/src/secpolicy/model/binding_commons.c
@@ -0,0 +1,245 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_binding_commons.h>
+
+struct rp_binding_commons_t
+{
+ rp_algorithmsuite_t *algorithmsuite;
+ axis2_bool_t include_timestamp;
+ rp_layout_t *layout;
+ rp_supporting_tokens_t *signed_supporting_tokens;
+ rp_supporting_tokens_t *signed_endorsing_supporting_tokens;
+ rp_supporting_tokens_t *endorsing_supporting_tokens;
+ rp_supporting_tokens_t *supporting_tokens;
+};
+
+AXIS2_EXTERN rp_binding_commons_t *AXIS2_CALL
+rp_binding_commons_create(
+ const axutil_env_t *env)
+{
+ rp_binding_commons_t *binding_commons = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ binding_commons = (rp_binding_commons_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_binding_commons_t));
+
+ if(binding_commons == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+ binding_commons->algorithmsuite = NULL;
+ binding_commons->include_timestamp = AXIS2_FALSE;
+ binding_commons->layout = NULL;
+ binding_commons->signed_supporting_tokens = NULL;
+ binding_commons->signed_endorsing_supporting_tokens = NULL;
+ binding_commons->endorsing_supporting_tokens = NULL;
+ binding_commons->supporting_tokens = NULL;
+
+ return binding_commons;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_binding_commons_free(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env)
+{
+ if(binding_commons)
+ {
+ if(binding_commons->algorithmsuite)
+ {
+ rp_algorithmsuite_free(binding_commons->algorithmsuite, env);
+ binding_commons->algorithmsuite = NULL;
+ }
+ if(binding_commons->layout)
+ {
+ rp_layout_free(binding_commons->layout, env);
+ binding_commons->layout = NULL;
+ }
+ if(binding_commons->signed_supporting_tokens)
+ {
+ rp_supporting_tokens_free(binding_commons->signed_supporting_tokens, env);
+ binding_commons->signed_supporting_tokens = NULL;
+ }
+ if(binding_commons->signed_endorsing_supporting_tokens)
+ {
+ rp_supporting_tokens_free(binding_commons-> signed_endorsing_supporting_tokens, env);
+ binding_commons->signed_endorsing_supporting_tokens = NULL;
+ }
+ if(binding_commons->endorsing_supporting_tokens)
+ {
+ rp_supporting_tokens_free(binding_commons-> endorsing_supporting_tokens, env);
+ binding_commons->endorsing_supporting_tokens = NULL;
+ }
+ if(binding_commons->supporting_tokens)
+ {
+ rp_supporting_tokens_free(binding_commons->supporting_tokens, env);
+ binding_commons->supporting_tokens = NULL;
+ }
+ AXIS2_FREE(env->allocator, binding_commons);
+ binding_commons = NULL;
+
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_binding_commons_get_include_timestamp(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env)
+{
+ return binding_commons->include_timestamp;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_binding_commons_set_include_timestamp(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env,
+ axis2_bool_t include_timestamp)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, include_timestamp, AXIS2_FAILURE);
+
+ binding_commons->include_timestamp = include_timestamp;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN rp_algorithmsuite_t *AXIS2_CALL
+rp_binding_commons_get_algorithmsuite(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env)
+{
+ return binding_commons->algorithmsuite;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_binding_commons_set_algorithmsuite(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env,
+ rp_algorithmsuite_t *algorithmsuite)
+{
+ AXIS2_PARAM_CHECK(env->error, algorithmsuite, AXIS2_FAILURE);
+
+ rp_algorithmsuite_increment_ref(algorithmsuite, env);
+ binding_commons->algorithmsuite = algorithmsuite;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_layout_t *AXIS2_CALL
+rp_binding_commons_get_layout(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env)
+{
+ return binding_commons->layout;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_binding_commons_set_layout(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env,
+ rp_layout_t *layout)
+{
+ AXIS2_PARAM_CHECK(env->error, layout, AXIS2_FAILURE);
+ rp_layout_increment_ref(layout, env);
+ binding_commons->layout = layout;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+rp_binding_commons_get_signed_supporting_tokens(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env)
+{
+ return binding_commons->signed_supporting_tokens;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_binding_commons_set_signed_supporting_tokens(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env,
+ rp_supporting_tokens_t *signed_supporting_tokens)
+{
+ AXIS2_PARAM_CHECK(env->error, signed_supporting_tokens, AXIS2_FAILURE);
+ binding_commons->signed_supporting_tokens = signed_supporting_tokens;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+rp_binding_commons_get_signed_endorsing_supporting_tokens(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env)
+{
+ return binding_commons->signed_endorsing_supporting_tokens;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_binding_commons_set_signed_endorsing_supporting_tokens(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env,
+ rp_supporting_tokens_t *signed_endorsing_supporting_tokens)
+{
+ AXIS2_PARAM_CHECK(env->error, signed_endorsing_supporting_tokens, AXIS2_FAILURE);
+
+ binding_commons->signed_endorsing_supporting_tokens = signed_endorsing_supporting_tokens;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+rp_binding_commons_get_endorsing_supporting_tokens(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env)
+{
+ return binding_commons->endorsing_supporting_tokens;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_binding_commons_set_endorsing_supporting_tokens(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env,
+ rp_supporting_tokens_t *endorsing_supporting_tokens)
+{
+ AXIS2_PARAM_CHECK(env->error, endorsing_supporting_tokens, AXIS2_FAILURE);
+ binding_commons->endorsing_supporting_tokens = endorsing_supporting_tokens;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+rp_binding_commons_get_supporting_tokens(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env)
+{
+ return binding_commons->supporting_tokens;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_binding_commons_set_supporting_tokens(
+ rp_binding_commons_t *binding_commons,
+ const axutil_env_t *env,
+ rp_supporting_tokens_t *supporting_tokens)
+{
+ AXIS2_PARAM_CHECK(env->error, supporting_tokens, AXIS2_FAILURE);
+ binding_commons->supporting_tokens = supporting_tokens;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/element.c b/neethi/src/secpolicy/model/element.c
new file mode 100644
index 0000000..125fef3
--- /dev/null
+++ b/neethi/src/secpolicy/model/element.c
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_element.h>
+
+struct rp_element_t
+{
+ axis2_char_t *name;
+ axis2_char_t *nspace;
+};
+
+AXIS2_EXTERN rp_element_t *AXIS2_CALL
+rp_element_create(
+ const axutil_env_t * env)
+{
+ rp_element_t *element = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ element = (rp_element_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_element_t));
+
+ if(element == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ element->name = NULL;
+ element->nspace = NULL;
+
+ return element;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_element_free(
+ rp_element_t * element,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(element)
+ {
+ AXIS2_FREE(env->allocator, element);
+ element = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_element_get_name(
+ rp_element_t * element,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return element->name;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_element_set_name(
+ rp_element_t * element,
+ const axutil_env_t * env,
+ axis2_char_t * name)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, name, AXIS2_FAILURE);
+
+ element->name = name;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_element_get_namespace(
+ rp_element_t * element,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return element->nspace;
+
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_element_set_namespace(
+ rp_element_t * element,
+ const axutil_env_t * env,
+ axis2_char_t * nspace)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, nspace, AXIS2_FAILURE);
+
+ element->nspace = nspace;
+
+ return AXIS2_SUCCESS;
+
+}
diff --git a/neethi/src/secpolicy/model/header.c b/neethi/src/secpolicy/model/header.c
new file mode 100644
index 0000000..9aab978
--- /dev/null
+++ b/neethi/src/secpolicy/model/header.c
@@ -0,0 +1,123 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_header.h>
+
+struct rp_header_t
+{
+ axis2_char_t *name;
+ axis2_char_t *nspace;
+};
+
+AXIS2_EXTERN rp_header_t *AXIS2_CALL
+rp_header_create(
+ const axutil_env_t * env)
+{
+ rp_header_t *header = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ header = (rp_header_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_header_t));
+
+ if(header == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ header->name = NULL;
+ header->nspace = NULL;
+
+ return header;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_header_free(
+ rp_header_t * header,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(header)
+ {
+ if(header->name)
+ {
+ AXIS2_FREE(env->allocator, header->name);
+ header->name = NULL;
+ }
+ if(header->nspace)
+ {
+ AXIS2_FREE(env->allocator, header->nspace);
+ header->nspace = NULL;
+ }
+
+ AXIS2_FREE(env->allocator, header);
+ header = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_header_get_name(
+ rp_header_t * header,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return header->name;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_header_set_name(
+ rp_header_t * header,
+ const axutil_env_t * env,
+ axis2_char_t * name)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, name, AXIS2_FAILURE);
+
+ header->name = axutil_strdup(env, name);
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_header_get_namespace(
+ rp_header_t * header,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return header->nspace;
+
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_header_set_namespace(
+ rp_header_t * header,
+ const axutil_env_t * env,
+ axis2_char_t * nspace)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, nspace, AXIS2_FAILURE);
+
+ header->nspace = axutil_strdup(env, nspace);
+
+ return AXIS2_SUCCESS;
+
+}
diff --git a/neethi/src/secpolicy/model/https_token.c b/neethi/src/secpolicy/model/https_token.c
new file mode 100644
index 0000000..100af45
--- /dev/null
+++ b/neethi/src/secpolicy/model/https_token.c
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_https_token.h>
+
+struct rp_https_token_t
+{
+ axis2_char_t *inclusion;
+ axis2_bool_t derivedkeys;
+ axis2_bool_t require_client_certificate;
+ int ref;
+};
+
+AXIS2_EXTERN rp_https_token_t *AXIS2_CALL
+rp_https_token_create(
+ const axutil_env_t * env)
+{
+ rp_https_token_t *https_token = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ https_token = (rp_https_token_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_https_token_t));
+
+ if(https_token == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ https_token->inclusion = RP_INCLUDE_ALWAYS;
+ https_token->derivedkeys = AXIS2_FALSE;
+ https_token->require_client_certificate = AXIS2_FALSE;
+ https_token->ref = 0;
+
+ return https_token;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_https_token_free(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(https_token)
+ {
+ if(--(https_token->ref) > 0)
+ {
+ return;
+ }
+ AXIS2_FREE(env->allocator, https_token);
+ https_token = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_https_token_get_inclusion(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return https_token->inclusion;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_https_token_set_inclusion(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env,
+ axis2_char_t * inclusion)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, inclusion, AXIS2_FAILURE);
+
+ https_token->inclusion = inclusion;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_https_token_get_derivedkeys(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return https_token->derivedkeys;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_https_token_set_derivedkeys(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env,
+ axis2_bool_t derivedkeys)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, derivedkeys, AXIS2_FAILURE);
+
+ https_token->derivedkeys = derivedkeys;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_https_token_get_require_client_certificate(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return https_token->require_client_certificate;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_https_token_set_require_client_certificate(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env,
+ axis2_bool_t require_client_certificate)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, require_client_certificate, AXIS2_FAILURE)
+ https_token->require_client_certificate = require_client_certificate;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_https_token_increment_ref(
+ rp_https_token_t * https_token,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ https_token->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/issued_token.c b/neethi/src/secpolicy/model/issued_token.c
new file mode 100644
index 0000000..00948f2
--- /dev/null
+++ b/neethi/src/secpolicy/model/issued_token.c
@@ -0,0 +1,211 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_issued_token.h>
+
+struct rp_issued_token
+{
+ axis2_char_t *inclusion;
+ axiom_node_t *issuer_epr;
+ axiom_node_t *requested_sec_token_template;
+ axis2_bool_t derivedkeys;
+ axis2_bool_t require_external_reference;
+ axis2_bool_t require_internal_reference;
+ int ref;
+};
+
+AXIS2_EXTERN rp_issued_token_t * AXIS2_CALL
+rp_issued_token_create(
+ const axutil_env_t *env)
+{
+ rp_issued_token_t *issued_token = NULL;
+
+ issued_token = (rp_issued_token_t*)AXIS2_MALLOC(env->allocator, sizeof(rp_issued_token_t));
+
+ if(issued_token == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ issued_token->inclusion = NULL;
+ issued_token->issuer_epr = NULL;
+ issued_token->requested_sec_token_template = NULL;
+ issued_token->derivedkeys = AXIS2_FALSE;
+ issued_token->require_external_reference = AXIS2_FALSE;
+ issued_token->require_internal_reference = AXIS2_FALSE;
+ issued_token->ref = 0;
+
+ return issued_token;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_issued_token_free(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env)
+{
+ if(issued_token)
+ {
+ if(--(issued_token->ref) > 0)
+ {
+ return;
+ }
+
+ AXIS2_FREE(env->allocator, issued_token);
+ issued_token = NULL;
+ }
+ return;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+rp_issued_token_get_inclusion(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env)
+{
+ return issued_token->inclusion;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_issued_token_set_inclusion(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env,
+ axis2_char_t *inclusion)
+{
+ if(inclusion)
+ {
+ issued_token->inclusion = inclusion;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+rp_issued_token_get_issuer_epr(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env)
+{
+ return issued_token->issuer_epr;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_issued_token_set_issuer_epr(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env,
+ axiom_node_t *issuer_epr)
+{
+ if(issuer_epr)
+ {
+ issued_token->issuer_epr = issuer_epr;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axiom_node_t * AXIS2_CALL
+rp_issued_token_get_requested_sec_token_template(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env)
+{
+ return issued_token->requested_sec_token_template;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_issued_token_set_requested_sec_token_template(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env,
+ axiom_node_t *req_sec_token_template)
+{
+ if(req_sec_token_template)
+ {
+ issued_token->requested_sec_token_template = req_sec_token_template;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_issued_token_get_derivedkeys(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env)
+{
+ return issued_token->derivedkeys;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_issued_token_set_derivedkeys(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env,
+ axis2_bool_t derivedkeys)
+{
+ AXIS2_PARAM_CHECK(env->error, derivedkeys, AXIS2_FAILURE);
+ issued_token->derivedkeys = derivedkeys;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_issued_token_get_require_external_reference(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env)
+{
+ return issued_token->require_external_reference;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_issued_token_set_require_exernal_reference(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env,
+ axis2_bool_t require_external_reference)
+{
+ AXIS2_PARAM_CHECK(env->error, require_external_reference, AXIS2_FAILURE);
+ issued_token->require_external_reference = require_external_reference;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_issued_token_get_require_internal_reference(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env)
+{
+ return issued_token->require_internal_reference;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_issued_token_set_require_internal_reference(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env,
+ axis2_bool_t require_internal_reference)
+{
+ AXIS2_PARAM_CHECK(env->error, require_internal_reference, AXIS2_FAILURE);
+ issued_token->require_internal_reference = require_internal_reference;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_issued_token_increment_ref(
+ rp_issued_token_t *issued_token,
+ const axutil_env_t *env)
+{
+ issued_token->ref++;
+ return AXIS2_SUCCESS;
+}
+
diff --git a/neethi/src/secpolicy/model/layout.c b/neethi/src/secpolicy/model/layout.c
new file mode 100644
index 0000000..b4591c4
--- /dev/null
+++ b/neethi/src/secpolicy/model/layout.c
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_layout.h>
+
+struct rp_layout_t
+{
+ axis2_char_t *value;
+ int ref;
+};
+
+AXIS2_EXTERN rp_layout_t *AXIS2_CALL
+rp_layout_create(
+ const axutil_env_t * env)
+{
+ rp_layout_t *layout = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ layout = (rp_layout_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_layout_t));
+
+ if(layout == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ layout->value = RP_LAYOUT_STRICT;
+ layout->ref = 0;
+ return layout;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_layout_free(
+ rp_layout_t * layout,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(layout)
+ {
+ if(--(layout->ref) > 0)
+ {
+ return;
+ }
+ AXIS2_FREE(env->allocator, layout);
+ layout = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_layout_get_value(
+ rp_layout_t * layout,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return layout->value;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_layout_set_value(
+ rp_layout_t * layout,
+ const axutil_env_t * env,
+ axis2_char_t * value)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, value, AXIS2_FAILURE);
+
+ layout->value = value;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_layout_increment_ref(
+ rp_layout_t * layout,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ layout->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/property.c b/neethi/src/secpolicy/model/property.c
new file mode 100644
index 0000000..a8d806c
--- /dev/null
+++ b/neethi/src/secpolicy/model/property.c
@@ -0,0 +1,265 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_property.h>
+#include <rp_symmetric_binding.h>
+#include <rp_asymmetric_binding.h>
+#include <rp_transport_binding.h>
+#include <rp_supporting_tokens.h>
+#include <rp_wss10.h>
+#include <rp_wss11.h>
+
+struct rp_property_t
+{
+ rp_property_type_t type;
+ void *value;
+ int ref;
+};
+
+AXIS2_EXTERN rp_property_t *AXIS2_CALL
+rp_property_create(
+ const axutil_env_t * env)
+{
+ rp_property_t *property = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ property = (rp_property_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_property_t));
+
+ if(property == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ property->type = RP_PROPERTY_UNKNOWN;
+ property->value = NULL;
+ property->ref = 0;
+
+ return property;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_property_free(
+ rp_property_t * property,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(property)
+ {
+ if(--(property->ref) > 0)
+ {
+ return;
+ }
+
+ if(property->value)
+ {
+ switch(property->type)
+ {
+ case RP_PROPERTY_USERNAME_TOKEN:
+ rp_username_token_free((rp_username_token_t *)property->value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_X509_TOKEN:
+ rp_x509_token_free((rp_x509_token_t *)property->value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_ISSUED_TOKEN:
+ rp_issued_token_free((rp_issued_token_t *)property->value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_SAML_TOKEN:
+ rp_saml_token_free((rp_saml_token_t *)property->value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_SECURITY_CONTEXT_TOKEN:
+ rp_security_context_token_free((rp_security_context_token_t *)property->value,
+ env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_HTTPS_TOKEN:
+ rp_https_token_free((rp_https_token_t *)property->value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_SYMMETRIC_BINDING:
+ rp_symmetric_binding_free((rp_symmetric_binding_t *)property-> value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_ASYMMETRIC_BINDING:
+ rp_asymmetric_binding_free((rp_asymmetric_binding_t *)property->value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_TRANSPORT_BINDING:
+ rp_transport_binding_free((rp_transport_binding_t *)property-> value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_SIGNED_SUPPORTING_TOKEN:
+ rp_supporting_tokens_free((rp_supporting_tokens_t *)property-> value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_SIGNED_ENDORSING_SUPPORTING_TOKEN:
+ rp_supporting_tokens_free((rp_supporting_tokens_t *)property-> value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_SUPPORTING_SUPPORTING_TOKEN:
+ rp_supporting_tokens_free((rp_supporting_tokens_t *)property-> value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_ENDORSING_SUPPORTING_TOKEN:
+ rp_supporting_tokens_free((rp_supporting_tokens_t *)property-> value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_SUPPORTING_TOKEN:
+ rp_supporting_tokens_free((rp_supporting_tokens_t *)property-> value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_WSS10:
+ rp_wss10_free((rp_wss10_t *)property->value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_WSS11:
+ rp_wss11_free((rp_wss11_t *)property->value, env);
+ property->value = NULL;
+ break;
+
+ case RP_PROPERTY_UNKNOWN:
+ break;
+ }
+ }
+ AXIS2_FREE(env->allocator, property);
+ }
+
+ return;
+}
+
+/* Implementations */
+AXIS2_EXTERN void *AXIS2_CALL
+rp_property_get_value(
+ rp_property_t * property,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return property->value;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_property_set_value(
+ rp_property_t * property,
+ const axutil_env_t * env,
+ void *value,
+ rp_property_type_t type)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, value, AXIS2_FAILURE);
+
+ property->type = type;
+
+ if(type == RP_PROPERTY_X509_TOKEN)
+ {
+ rp_x509_token_increment_ref((rp_x509_token_t *)value, env);
+ }
+ else if(type == RP_PROPERTY_SECURITY_CONTEXT_TOKEN)
+ {
+ rp_security_context_token_increment_ref((rp_security_context_token_t *)value, env);
+ }
+ else if(type == RP_PROPERTY_WSS10)
+ {
+ rp_wss10_increment_ref((rp_wss10_t *)value, env);
+ }
+ else if(type == RP_PROPERTY_WSS11)
+ {
+ rp_wss11_increment_ref((rp_wss11_t *)value, env);
+ }
+ else if(type == RP_PROPERTY_USERNAME_TOKEN)
+ {
+ rp_username_token_increment_ref((rp_username_token_t *)value, env);
+ }
+
+ else if(type == RP_PROPERTY_HTTPS_TOKEN)
+ {
+ rp_https_token_increment_ref((rp_https_token_t *)value, env);
+ }
+
+ else if(type == RP_PROPERTY_SIGNED_SUPPORTING_TOKEN)
+ {
+ rp_supporting_tokens_increment_ref((rp_supporting_tokens_t *)value, env);
+ }
+ else if(type == RP_PROPERTY_SUPPORTING_SUPPORTING_TOKEN)
+ {
+ rp_supporting_tokens_increment_ref((rp_supporting_tokens_t *)value, env);
+ }
+ else if(type == RP_PROPERTY_SIGNED_ENDORSING_SUPPORTING_TOKEN)
+ {
+ rp_supporting_tokens_increment_ref((rp_supporting_tokens_t *)value, env);
+ }
+ else if(type == RP_PROPERTY_ENDORSING_SUPPORTING_TOKEN)
+ {
+ rp_supporting_tokens_increment_ref((rp_supporting_tokens_t *)value, env);
+ }
+ else if(type == RP_PROPERTY_ASYMMETRIC_BINDING)
+ {
+ rp_asymmetric_binding_increment_ref((rp_asymmetric_binding_t *)value, env);
+ }
+ else if(type == RP_PROPERTY_TRANSPORT_BINDING)
+ {
+ rp_transport_binding_increment_ref((rp_transport_binding_t *)value, env);
+ }
+ else if(type == RP_PROPERTY_SYMMETRIC_BINDING)
+ {
+ rp_symmetric_binding_increment_ref((rp_symmetric_binding_t *)value, env);
+ }
+ property->value = (void *)value;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN rp_property_type_t AXIS2_CALL
+rp_property_get_type(
+ rp_property_t * property,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return property->type;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_property_increment_ref(
+ rp_property_t * property,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ property->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/rampart_config.c b/neethi/src/secpolicy/model/rampart_config.c
new file mode 100644
index 0000000..ba8bebd
--- /dev/null
+++ b/neethi/src/secpolicy/model/rampart_config.c
@@ -0,0 +1,446 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_rampart_config.h>
+
+struct rp_rampart_config_t
+{
+ axis2_char_t *user;
+ axis2_char_t *encryption_user;
+ axis2_char_t *password_callback_class;
+ axis2_char_t *authenticate_module;
+ axis2_char_t *replay_detector;
+ axis2_char_t *sct_provider;
+ axis2_char_t *password_type;
+ axis2_char_t *time_to_live;
+ axis2_char_t *clock_skew_buffer;
+ axis2_char_t *need_millisecond_precision;
+ axis2_char_t *receiver_certificate_file;
+ axis2_char_t *certificate_file;
+ axis2_char_t *private_key_file;
+ axis2_char_t *pkcs12_file;
+ axis2_char_t *rd_val;
+ int ref;
+};
+
+AXIS2_EXTERN rp_rampart_config_t *AXIS2_CALL
+rp_rampart_config_create(
+ const axutil_env_t * env)
+{
+ rp_rampart_config_t *rampart_config = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ rampart_config = (rp_rampart_config_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_rampart_config_t));
+
+ if(rampart_config == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ rampart_config->user = NULL;
+ rampart_config->encryption_user = NULL;
+ rampart_config->password_callback_class = NULL;
+ rampart_config->private_key_file = NULL;
+ rampart_config->receiver_certificate_file = NULL;
+ rampart_config->certificate_file = NULL;
+ rampart_config->authenticate_module = NULL;
+ rampart_config->replay_detector = NULL;
+ rampart_config->sct_provider = NULL;
+ rampart_config->password_type = NULL;
+ rampart_config->time_to_live = NULL;
+ rampart_config->clock_skew_buffer = NULL;
+ rampart_config->need_millisecond_precision = NULL;
+ rampart_config->pkcs12_file = NULL;
+ rampart_config->rd_val = NULL;
+ rampart_config->ref = 0;
+
+ return rampart_config;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_rampart_config_free(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(rampart_config)
+ {
+ if(--(rampart_config->ref) > 0)
+ {
+ return;
+ }
+
+ AXIS2_FREE(env->allocator, rampart_config);
+ rampart_config = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_user(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->user;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_user(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * user)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, user, AXIS2_FAILURE);
+
+ rampart_config->user = user;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_encryption_user(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->encryption_user;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_encryption_user(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * encryption_user)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, encryption_user, AXIS2_FAILURE);
+
+ rampart_config->encryption_user = encryption_user;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_password_callback_class(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->password_callback_class;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_password_callback_class(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * password_callback_class)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, password_callback_class, AXIS2_FAILURE);
+
+ rampart_config->password_callback_class = password_callback_class;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_authenticate_module(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->authenticate_module;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_authenticate_module(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * authenticate_module)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, authenticate_module, AXIS2_FAILURE);
+
+ rampart_config->authenticate_module = authenticate_module;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_replay_detector(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->replay_detector;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_replay_detector(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * replay_detector)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, replay_detector, AXIS2_FAILURE);
+
+ rampart_config->replay_detector = replay_detector;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_sct_provider(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->sct_provider;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_sct_provider(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * sct_module)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, sct_module, AXIS2_FAILURE);
+
+ rampart_config->sct_provider = sct_module;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_password_type(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->password_type;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_password_type(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * password_type)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, password_type, AXIS2_FAILURE);
+
+ rampart_config->password_type = password_type;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_private_key_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->private_key_file;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_private_key_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * private_key_file)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, private_key_file, AXIS2_FAILURE);
+
+ rampart_config->private_key_file = private_key_file;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_receiver_certificate_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->receiver_certificate_file;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_receiver_certificate_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * receiver_certificate_file)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, receiver_certificate_file, AXIS2_FAILURE);
+
+ rampart_config->receiver_certificate_file = receiver_certificate_file;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_certificate_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->certificate_file;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_certificate_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * certificate_file)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, certificate_file, AXIS2_FAILURE);
+
+ rampart_config->certificate_file = certificate_file;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_time_to_live(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->time_to_live;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_time_to_live(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * time_to_live)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, time_to_live, AXIS2_FAILURE);
+
+ rampart_config->time_to_live = time_to_live;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_clock_skew_buffer(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ return rampart_config->clock_skew_buffer;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_clock_skew_buffer(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * clock_skew_buffer)
+{
+ rampart_config->clock_skew_buffer = clock_skew_buffer;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_need_millisecond_precision(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ return rampart_config->need_millisecond_precision;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_need_millisecond_precision(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * need_millisecond_precision)
+{
+ rampart_config->need_millisecond_precision = need_millisecond_precision;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_pkcs12_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ return rampart_config->pkcs12_file;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_pkcs12_file(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t *env,
+ axis2_char_t * pkcs12_file)
+{
+ if(rampart_config)
+ {
+ if(pkcs12_file)
+ {
+ rampart_config->pkcs12_file = pkcs12_file;
+ return AXIS2_SUCCESS;
+ }
+
+ return AXIS2_FAILURE;
+ }
+
+ return AXIS2_FAILURE;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_rampart_config_get_rd_val(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return rampart_config->rd_val;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_set_rd_val(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env,
+ axis2_char_t * rd_val)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, rd_val, AXIS2_FAILURE);
+
+ rampart_config->rd_val = rd_val;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_rampart_config_increment_ref(
+ rp_rampart_config_t * rampart_config,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ rampart_config->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/saml_token.c b/neethi/src/secpolicy/model/saml_token.c
new file mode 100644
index 0000000..ae0f1ea
--- /dev/null
+++ b/neethi/src/secpolicy/model/saml_token.c
@@ -0,0 +1,160 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_saml_token.h>
+
+struct rp_saml_token
+{
+ axis2_char_t *inclusion;
+ axis2_bool_t derivedkeys;
+ axis2_bool_t require_key_identifier_reference;
+ axis2_char_t *token_version_and_type;
+ int ref;
+};
+
+AXIS2_EXTERN rp_saml_token_t * AXIS2_CALL
+rp_saml_token_create(
+ const axutil_env_t *env)
+{
+ rp_saml_token_t * saml_token;
+
+ saml_token = (rp_saml_token_t*)AXIS2_MALLOC(env->allocator, sizeof(rp_saml_token_t));
+
+ if(saml_token == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ saml_token->inclusion = NULL;
+ saml_token->derivedkeys = AXIS2_FALSE;
+ saml_token->require_key_identifier_reference = AXIS2_FALSE;
+ saml_token->token_version_and_type = NULL;
+ saml_token->ref = 0;
+
+ return saml_token;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_saml_token_free(
+ rp_saml_token_t *saml_token,
+ const axutil_env_t *env)
+{
+ if(saml_token)
+ {
+ if(--(saml_token->ref) > 0)
+ {
+ return;
+ }
+
+ AXIS2_FREE(env->allocator, saml_token);
+ saml_token = NULL;
+ }
+
+ return;
+}
+
+AXIS2_EXTERN axis2_char_t * AXIS2_CALL
+rp_saml_token_get_inclusion(
+ rp_saml_token_t *saml_token,
+ const axutil_env_t *env)
+{
+ return saml_token->inclusion;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_saml_token_set_inclusion(
+ rp_saml_token_t *saml_token,
+ const axutil_env_t *env,
+ axis2_char_t * inclusion)
+{
+ AXIS2_PARAM_CHECK(env->error, inclusion, AXIS2_FAILURE);
+ saml_token->inclusion = inclusion;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_saml_token_get_derivedkeys(
+ rp_saml_token_t *saml_token,
+ const axutil_env_t *env)
+{
+ return saml_token->derivedkeys;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_saml_token_set_derivedkeys(
+ rp_saml_token_t *saml_token,
+ const axutil_env_t *env,
+ axis2_bool_t derivedkeys)
+{
+ AXIS2_PARAM_CHECK(env->error, derivedkeys, AXIS2_FAILURE);
+ saml_token->derivedkeys = derivedkeys;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_saml_token_get_require_key_identifier_reference(
+ rp_saml_token_t * saml_token,
+ const axutil_env_t * env)
+{
+ return saml_token->require_key_identifier_reference;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_saml_token_set_require_key_identifier_reference(
+ rp_saml_token_t * saml_token,
+ const axutil_env_t * env,
+ axis2_bool_t require_key_identifier_reference)
+{
+ AXIS2_PARAM_CHECK(env->error, require_key_identifier_reference, AXIS2_FAILURE);
+ saml_token->require_key_identifier_reference = require_key_identifier_reference;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_saml_token_get_token_version_and_type(
+ rp_saml_token_t * saml_token,
+ const axutil_env_t * env)
+{
+ return saml_token->token_version_and_type;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_saml_token_set_token_version_and_type(
+ rp_saml_token_t * saml_token,
+ const axutil_env_t * env,
+ axis2_char_t * token_version_and_type)
+{
+ AXIS2_PARAM_CHECK(env->error, token_version_and_type, AXIS2_FAILURE);
+
+ saml_token->token_version_and_type = token_version_and_type;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_saml_token_increment_ref(
+ rp_saml_token_t * saml_token,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ saml_token->ref++;
+ return AXIS2_SUCCESS;
+}
+
diff --git a/neethi/src/secpolicy/model/secpolicy.c b/neethi/src/secpolicy/model/secpolicy.c
new file mode 100644
index 0000000..fdd112c
--- /dev/null
+++ b/neethi/src/secpolicy/model/secpolicy.c
@@ -0,0 +1,493 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_secpolicy.h>
+
+struct rp_secpolicy_t
+{
+ rp_property_t *binding;
+ rp_property_t *wss;
+ rp_trust10_t *trust10;
+ rp_supporting_tokens_t *supporting_tokens;
+ rp_supporting_tokens_t *signed_supporting_tokens;
+ rp_supporting_tokens_t *endorsing_supporting_tokens;
+ rp_supporting_tokens_t *signed_endorsing_supporting_tokens;
+ rp_signed_encrypted_parts_t *signed_parts;
+ rp_signed_encrypted_parts_t *encrypted_parts;
+ rp_signed_encrypted_elements_t *signed_elements;
+ rp_signed_encrypted_elements_t *encrypted_elements;
+ rp_signed_encrypted_items_t *signed_items;
+ rp_signed_encrypted_items_t *encrypted_items;
+ rp_rampart_config_t *rampart_config;
+
+};
+
+AXIS2_EXTERN rp_secpolicy_t *AXIS2_CALL
+rp_secpolicy_create(
+ const axutil_env_t * env)
+{
+ rp_secpolicy_t *secpolicy = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ secpolicy = (rp_secpolicy_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_secpolicy_t));
+
+ if(secpolicy == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ secpolicy->binding = NULL;
+ secpolicy->wss = NULL;
+ secpolicy->trust10 = NULL;
+ secpolicy->supporting_tokens = NULL;
+ secpolicy->signed_supporting_tokens = NULL;
+ secpolicy->endorsing_supporting_tokens = NULL;
+ secpolicy->signed_endorsing_supporting_tokens = NULL;
+ secpolicy->signed_parts = NULL;
+ secpolicy->encrypted_parts = NULL;
+ secpolicy->signed_elements = NULL;
+ secpolicy->encrypted_elements = NULL;
+ secpolicy->signed_items = NULL;
+ secpolicy->encrypted_items = NULL;
+ secpolicy->rampart_config = NULL;
+
+ return secpolicy;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_secpolicy_free(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(secpolicy)
+ {
+ if(secpolicy->binding)
+ {
+ rp_property_free(secpolicy->binding, env);
+ secpolicy->binding = NULL;
+ }
+ if(secpolicy->wss)
+ {
+ rp_property_free(secpolicy->wss, env);
+ secpolicy->wss = NULL;
+ }
+ if(secpolicy->trust10)
+ {
+ rp_trust10_free(secpolicy->trust10, env);
+ secpolicy->trust10 = NULL;
+ }
+ if(secpolicy->supporting_tokens)
+ {
+ rp_supporting_tokens_free(secpolicy->supporting_tokens, env);
+ secpolicy->supporting_tokens = NULL;
+ }
+ if(secpolicy->signed_supporting_tokens)
+ {
+ rp_supporting_tokens_free(secpolicy->signed_supporting_tokens, env);
+ secpolicy->signed_supporting_tokens = NULL;
+ }
+ if(secpolicy->endorsing_supporting_tokens)
+ {
+ rp_supporting_tokens_free(secpolicy->endorsing_supporting_tokens, env);
+ secpolicy->endorsing_supporting_tokens = NULL;
+ }
+ if(secpolicy->signed_endorsing_supporting_tokens)
+ {
+ rp_supporting_tokens_free(secpolicy-> signed_endorsing_supporting_tokens, env);
+ secpolicy->signed_endorsing_supporting_tokens = NULL;
+ }
+ if(secpolicy->signed_parts)
+ {
+ rp_signed_encrypted_parts_free(secpolicy->signed_parts, env);
+ secpolicy->signed_parts = NULL;
+ }
+ if(secpolicy->encrypted_parts)
+ {
+ rp_signed_encrypted_parts_free(secpolicy->encrypted_parts, env);
+ secpolicy->encrypted_parts = NULL;
+ }
+ if(secpolicy->signed_elements)
+ {
+ rp_signed_encrypted_elements_free(secpolicy->signed_elements, env);
+ secpolicy->signed_elements = NULL;
+ }
+ if(secpolicy->encrypted_elements)
+ {
+ rp_signed_encrypted_elements_free(secpolicy->encrypted_elements, env);
+ secpolicy->encrypted_elements = NULL;
+ }
+ if(secpolicy->signed_items)
+ {
+ rp_signed_encrypted_items_free(secpolicy->signed_items, env);
+ secpolicy->signed_items = NULL;
+ }
+ if(secpolicy->encrypted_items)
+ {
+ rp_signed_encrypted_items_free(secpolicy->encrypted_items, env);
+ secpolicy->encrypted_items = NULL;
+ }
+ if(secpolicy->rampart_config)
+ {
+ rp_rampart_config_free(secpolicy->rampart_config, env);
+ secpolicy->rampart_config = NULL;
+ }
+ AXIS2_FREE(env->allocator, secpolicy);
+ }
+
+ return;
+}
+
+/* Implementations */
+AXIS2_EXTERN rp_property_t *AXIS2_CALL
+rp_secpolicy_get_binding(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->binding;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_binding(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_property_t * binding)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, binding, AXIS2_FAILURE);
+ rp_property_increment_ref(binding, env);
+ secpolicy->binding = binding;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_supporting_tokens_t * supporting_tokens)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, supporting_tokens, AXIS2_FAILURE);
+
+ rp_supporting_tokens_increment_ref(supporting_tokens, env);
+ secpolicy->supporting_tokens = supporting_tokens;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+rp_secpolicy_get_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->supporting_tokens;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_signed_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_supporting_tokens_t * signed_supporting_tokens)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signed_supporting_tokens, AXIS2_FAILURE);
+
+ rp_supporting_tokens_increment_ref(signed_supporting_tokens, env);
+ secpolicy->signed_supporting_tokens = signed_supporting_tokens;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+rp_secpolicy_get_signed_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->signed_supporting_tokens;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_endorsing_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_supporting_tokens_t * endorsing_supporting_tokens)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, endorsing_supporting_tokens, AXIS2_FAILURE);
+
+ rp_supporting_tokens_increment_ref(endorsing_supporting_tokens, env);
+ secpolicy->endorsing_supporting_tokens = endorsing_supporting_tokens;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+rp_secpolicy_get_endorsing_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->endorsing_supporting_tokens;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_signed_endorsing_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_supporting_tokens_t * signed_endorsing_supporting_tokens)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signed_endorsing_supporting_tokens, AXIS2_FAILURE);
+
+ rp_supporting_tokens_increment_ref(signed_endorsing_supporting_tokens, env);
+ secpolicy->signed_endorsing_supporting_tokens = signed_endorsing_supporting_tokens;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+rp_secpolicy_get_signed_endorsing_supporting_tokens(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->signed_endorsing_supporting_tokens;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_signed_parts(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_signed_encrypted_parts_t * signed_parts)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signed_parts, AXIS2_FAILURE);
+ rp_signed_encrypted_parts_increment_ref(signed_parts, env);
+ secpolicy->signed_parts = signed_parts;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN rp_signed_encrypted_parts_t *AXIS2_CALL
+rp_secpolicy_get_signed_parts(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->signed_parts;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_encrypted_parts(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_signed_encrypted_parts_t * encrypted_parts)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, encrypted_parts, AXIS2_FAILURE);
+
+ rp_signed_encrypted_parts_increment_ref(encrypted_parts, env);
+ secpolicy->encrypted_parts = encrypted_parts;
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN rp_signed_encrypted_parts_t *AXIS2_CALL
+rp_secpolicy_get_encrypted_parts(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->encrypted_parts;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_signed_elements(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_signed_encrypted_elements_t * signed_elements)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signed_elements, AXIS2_FAILURE);
+
+ rp_signed_encrypted_elements_increment_ref(signed_elements, env);
+ secpolicy->signed_elements = signed_elements;
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN rp_signed_encrypted_elements_t *AXIS2_CALL
+rp_secpolicy_get_signed_elements(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->signed_elements;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_encrypted_elements(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_signed_encrypted_elements_t * encrypted_elements)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, encrypted_elements, AXIS2_FAILURE);
+
+ rp_signed_encrypted_elements_increment_ref(encrypted_elements, env);
+ secpolicy->encrypted_elements = encrypted_elements;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_signed_encrypted_elements_t *AXIS2_CALL
+rp_secpolicy_get_encrypted_elements(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->encrypted_elements;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_signed_items(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_signed_encrypted_items_t * signed_items)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signed_items, AXIS2_FAILURE);
+
+ secpolicy->signed_items = signed_items;
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN rp_signed_encrypted_items_t *AXIS2_CALL
+rp_secpolicy_get_signed_items(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->signed_items;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_encrypted_items(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_signed_encrypted_items_t * encrypted_items)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, encrypted_items, AXIS2_FAILURE);
+
+ secpolicy->encrypted_items = encrypted_items;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_signed_encrypted_items_t *AXIS2_CALL
+rp_secpolicy_get_encrypted_items(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->encrypted_items;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_wss(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_property_t * wss)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, wss, AXIS2_FAILURE);
+
+ rp_property_increment_ref(wss, env);
+ secpolicy->wss = wss;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_property_t *AXIS2_CALL
+rp_secpolicy_get_wss(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->wss;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_trust10(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_trust10_t * trust10)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, trust10, AXIS2_FAILURE);
+
+ rp_trust10_increment_ref(trust10, env);
+ secpolicy->trust10 = trust10;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_trust10_t *AXIS2_CALL
+rp_secpolicy_get_trust10(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->trust10;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_secpolicy_set_rampart_config(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env,
+ rp_rampart_config_t * rampart_config)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, rampart_config, AXIS2_FAILURE);
+
+ rp_rampart_config_increment_ref(rampart_config, env);
+ secpolicy->rampart_config = rampart_config;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_rampart_config_t *AXIS2_CALL
+rp_secpolicy_get_rampart_config(
+ rp_secpolicy_t * secpolicy,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return secpolicy->rampart_config;
+}
diff --git a/neethi/src/secpolicy/model/security_context_token.c b/neethi/src/secpolicy/model/security_context_token.c
new file mode 100644
index 0000000..9b00465
--- /dev/null
+++ b/neethi/src/secpolicy/model/security_context_token.c
@@ -0,0 +1,239 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_security_context_token.h>
+
+struct rp_security_context_token_t
+{
+ rp_token_t *token;
+ axis2_bool_t require_external_uri_ref;
+ axis2_bool_t sc10_security_context_token;
+ neethi_policy_t *bootstrap_policy;
+ axis2_bool_t is_secure_conversation_token;
+ int ref;
+};
+
+AXIS2_EXTERN rp_security_context_token_t *AXIS2_CALL
+rp_security_context_token_create(
+ const axutil_env_t * env)
+{
+ rp_security_context_token_t *security_context_token = NULL;
+
+ security_context_token = (rp_security_context_token_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_security_context_token_t));
+
+ if(!security_context_token)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Security context token assertion creation failed. Insufficient memory");
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ security_context_token->ref = 0;
+ security_context_token->require_external_uri_ref = AXIS2_FALSE;
+ security_context_token->sc10_security_context_token = AXIS2_FALSE;
+ security_context_token->bootstrap_policy = NULL;
+ security_context_token->is_secure_conversation_token = AXIS2_FALSE;
+
+ security_context_token->token = rp_token_create(env);
+ if(!security_context_token->token)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Security context token assertion creation failed.");
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ rp_security_context_token_free(security_context_token, env);
+ return NULL;
+ }
+
+ return security_context_token;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_security_context_token_free(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env)
+{
+ if(security_context_token)
+ {
+ if(--(security_context_token->ref) > 0)
+ {
+ return;
+ }
+
+ if(security_context_token->bootstrap_policy)
+ {
+ neethi_policy_free(security_context_token->bootstrap_policy, env);
+ }
+
+ rp_token_free(security_context_token->token, env);
+ AXIS2_FREE(env->allocator, security_context_token);
+ security_context_token = NULL;
+ }
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_security_context_token_get_inclusion(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env)
+{
+ return rp_token_get_inclusion(security_context_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_security_context_token_set_inclusion(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env,
+ axis2_char_t * inclusion)
+{
+ return rp_token_set_inclusion(security_context_token->token, env, inclusion);
+}
+
+AXIS2_EXTERN derive_key_type_t AXIS2_CALL
+rp_security_context_token_get_derivedkey(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env)
+{
+ return rp_token_get_derivedkey_type(security_context_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_security_context_token_set_derivedkey(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env,
+ derive_key_type_t derivedkey)
+{
+ return rp_token_set_derivedkey_type(security_context_token->token, env, derivedkey);
+}
+
+AXIS2_EXTERN derive_key_version_t AXIS2_CALL
+rp_security_context_token_get_derivedkey_version(
+ rp_security_context_token_t *security_context_token,
+ const axutil_env_t *env)
+{
+ return rp_token_get_derive_key_version(security_context_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_security_context_token_set_derivedkey_version(
+ rp_security_context_token_t *security_context_token,
+ const axutil_env_t *env,
+ derive_key_version_t version)
+{
+ return rp_token_set_derive_key_version(security_context_token->token, env, version);
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_security_context_token_get_require_external_uri_ref(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env)
+{
+ return security_context_token->require_external_uri_ref;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_security_context_token_set_require_external_uri_ref(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env,
+ axis2_bool_t require_external_uri_ref)
+{
+ security_context_token->require_external_uri_ref = require_external_uri_ref;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_security_context_token_get_sc10_security_context_token(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env)
+{
+ return security_context_token->sc10_security_context_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_security_context_token_set_sc10_security_context_token(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env,
+ axis2_bool_t sc10_security_context_token)
+{
+ security_context_token->sc10_security_context_token = sc10_security_context_token;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_security_context_token_get_issuer(
+ rp_security_context_token_t *security_context_token,
+ const axutil_env_t *env)
+{
+ return rp_token_get_issuer(security_context_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_security_context_token_set_issuer(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env,
+ axis2_char_t *issuer)
+{
+ return rp_token_set_issuer(security_context_token->token, env, issuer);
+}
+
+AXIS2_EXTERN neethi_policy_t *AXIS2_CALL
+rp_security_context_token_get_bootstrap_policy(
+ rp_security_context_token_t *security_context_token,
+ const axutil_env_t *env)
+{
+ return security_context_token->bootstrap_policy;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_security_context_token_set_bootstrap_policy(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env,
+ neethi_policy_t *bootstrap_policy)
+{
+ security_context_token->bootstrap_policy = bootstrap_policy;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_security_context_token_get_is_secure_conversation_token(
+ rp_security_context_token_t *security_context_token,
+ const axutil_env_t *env)
+{
+ return security_context_token->is_secure_conversation_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_security_context_token_set_is_secure_conversation_token(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env,
+ axis2_bool_t is_secure_conversation_token)
+{
+ security_context_token->is_secure_conversation_token = is_secure_conversation_token;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_security_context_token_increment_ref(
+ rp_security_context_token_t * security_context_token,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ security_context_token->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/signed_encrypted_elements.c b/neethi/src/secpolicy/model/signed_encrypted_elements.c
new file mode 100644
index 0000000..b656f0f
--- /dev/null
+++ b/neethi/src/secpolicy/model/signed_encrypted_elements.c
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_signed_encrypted_elements.h>
+
+struct rp_signed_encrypted_elements_t
+{
+ axis2_bool_t signedelements;
+ axutil_array_list_t *xpath_expressions;
+ axis2_char_t *xpath_version;
+ int ref;
+
+};
+
+AXIS2_EXTERN rp_signed_encrypted_elements_t *AXIS2_CALL
+rp_signed_encrypted_elements_create(
+ const axutil_env_t * env)
+{
+ rp_signed_encrypted_elements_t *signed_encrypted_elements = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ signed_encrypted_elements = (rp_signed_encrypted_elements_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_signed_encrypted_elements_t));
+
+ if(signed_encrypted_elements == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ signed_encrypted_elements->xpath_expressions = NULL;
+
+ signed_encrypted_elements->xpath_expressions = axutil_array_list_create(env, 0);
+ if(!(signed_encrypted_elements->xpath_expressions))
+ {
+ rp_signed_encrypted_elements_free(signed_encrypted_elements, env);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ signed_encrypted_elements->xpath_version = NULL;
+ signed_encrypted_elements->ref = 0;
+
+ return signed_encrypted_elements;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_signed_encrypted_elements_free(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(signed_encrypted_elements)
+ {
+ if(--(signed_encrypted_elements->ref) > 0)
+ {
+ return;
+ }
+
+ if(signed_encrypted_elements->xpath_expressions)
+ {
+ int i = 0;
+ for(i = 0; i < axutil_array_list_size(signed_encrypted_elements-> xpath_expressions,
+ env); i++)
+ {
+ axis2_char_t *expression = NULL;
+ expression = (axis2_char_t *)axutil_array_list_get(
+ signed_encrypted_elements-> xpath_expressions, env, i);
+ if(expression)
+ AXIS2_FREE(env->allocator, expression);
+
+ expression = NULL;
+ }
+ axutil_array_list_free(signed_encrypted_elements->xpath_expressions, env);
+ signed_encrypted_elements->xpath_expressions = NULL;
+
+ }
+ AXIS2_FREE(env->allocator, signed_encrypted_elements);
+ signed_encrypted_elements = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_signed_encrypted_elements_get_signedelements(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return signed_encrypted_elements->signedelements;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_elements_set_signedelements(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env,
+ axis2_bool_t signedelements)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signedelements, AXIS2_FAILURE);
+
+ signed_encrypted_elements->signedelements = signedelements;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+rp_signed_encrypted_elements_get_xpath_expressions(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return signed_encrypted_elements->xpath_expressions;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_elements_add_expression(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env,
+ axis2_char_t * expression)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, expression, AXIS2_FAILURE);
+
+ axutil_array_list_add(signed_encrypted_elements->xpath_expressions, env, expression);
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_signed_encrypted_elements_get_xpath_version(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return signed_encrypted_elements->xpath_version;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_elements_set_xpath_version(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env,
+ axis2_char_t * xpath_version)
+{
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, xpath_version, AXIS2_FAILURE);
+
+ signed_encrypted_elements->xpath_version = xpath_version;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_elements_increment_ref(
+ rp_signed_encrypted_elements_t * signed_encrypted_elements,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ signed_encrypted_elements->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/signed_encrypted_items.c b/neethi/src/secpolicy/model/signed_encrypted_items.c
new file mode 100644
index 0000000..e3e6150
--- /dev/null
+++ b/neethi/src/secpolicy/model/signed_encrypted_items.c
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_signed_encrypted_items.h>
+
+struct rp_signed_encrypted_items_t
+{
+ axis2_bool_t signeditems;
+ axutil_array_list_t *elements;
+
+};
+
+AXIS2_EXTERN rp_signed_encrypted_items_t *AXIS2_CALL
+rp_signed_encrypted_items_create(
+ const axutil_env_t * env)
+{
+ rp_signed_encrypted_items_t *signed_encrypted_items = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ signed_encrypted_items = (rp_signed_encrypted_items_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_signed_encrypted_items_t));
+
+ if(signed_encrypted_items == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ signed_encrypted_items->elements = NULL;
+
+ signed_encrypted_items->elements = axutil_array_list_create(env, 0);
+ if(!(signed_encrypted_items->elements))
+ {
+ rp_signed_encrypted_items_free(signed_encrypted_items, env);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ return signed_encrypted_items;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_signed_encrypted_items_free(
+ rp_signed_encrypted_items_t * signed_encrypted_items,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(signed_encrypted_items)
+ {
+
+ if(signed_encrypted_items->elements)
+ {
+ int i = 0;
+ for(i = 0; i < axutil_array_list_size(signed_encrypted_items->elements, env); i++)
+ {
+ rp_element_t *element = NULL;
+ element = (rp_element_t *)axutil_array_list_get(signed_encrypted_items->elements,
+ env, i);
+ if(element)
+ rp_element_free(element, env);
+
+ element = NULL;
+ }
+ axutil_array_list_free(signed_encrypted_items->elements, env);
+ signed_encrypted_items->elements = NULL;
+
+ }
+ AXIS2_FREE(env->allocator, signed_encrypted_items);
+ signed_encrypted_items = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_signed_encrypted_items_get_signeditems(
+ rp_signed_encrypted_items_t * signed_encrypted_items,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return signed_encrypted_items->signeditems;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_items_set_signeditems(
+ rp_signed_encrypted_items_t * signed_encrypted_items,
+ const axutil_env_t * env,
+ axis2_bool_t signeditems)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signeditems, AXIS2_FAILURE);
+ signed_encrypted_items->signeditems = signeditems;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+rp_signed_encrypted_items_get_elements(
+ rp_signed_encrypted_items_t * signed_encrypted_items,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return signed_encrypted_items->elements;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_items_add_element(
+ rp_signed_encrypted_items_t * signed_encrypted_items,
+ const axutil_env_t * env,
+ rp_element_t * element)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, element, AXIS2_FAILURE);
+
+ axutil_array_list_add(signed_encrypted_items->elements, env, element);
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/signed_encrypted_parts.c b/neethi/src/secpolicy/model/signed_encrypted_parts.c
new file mode 100644
index 0000000..0f16e83
--- /dev/null
+++ b/neethi/src/secpolicy/model/signed_encrypted_parts.c
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_signed_encrypted_parts.h>
+
+struct rp_signed_encrypted_parts_t
+{
+ axis2_bool_t body;
+ axis2_bool_t signedparts;
+ axis2_bool_t attachments;
+ axutil_array_list_t *headers;
+ int ref;
+};
+
+AXIS2_EXTERN rp_signed_encrypted_parts_t *AXIS2_CALL
+rp_signed_encrypted_parts_create(
+ const axutil_env_t * env)
+{
+ rp_signed_encrypted_parts_t *signed_encrypted_parts = NULL;
+ signed_encrypted_parts = (rp_signed_encrypted_parts_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_signed_encrypted_parts_t));
+
+ if(!signed_encrypted_parts)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Cannot create signed_encrypted_parts. Insuficient memory.");
+ return NULL;
+ }
+
+ signed_encrypted_parts->headers = axutil_array_list_create(env, 0);
+ if(!signed_encrypted_parts->headers)
+ {
+ rp_signed_encrypted_parts_free(signed_encrypted_parts, env);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Cannot create signed_encrypted_parts. Headers array list creation failed.");
+ return NULL;
+ }
+
+ signed_encrypted_parts->body = AXIS2_FALSE;
+ signed_encrypted_parts->ref = 0;
+ signed_encrypted_parts->signedparts = AXIS2_FALSE;
+ signed_encrypted_parts->attachments = AXIS2_FALSE;
+ return signed_encrypted_parts;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_signed_encrypted_parts_free(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env)
+{
+ if(signed_encrypted_parts)
+ {
+ if(--(signed_encrypted_parts->ref) > 0)
+ {
+ return;
+ }
+
+ if(signed_encrypted_parts->headers)
+ {
+ int i = 0;
+ for(i = 0; i < axutil_array_list_size(signed_encrypted_parts->headers, env); i++)
+ {
+ rp_header_t *header = NULL;
+ header = (rp_header_t *)axutil_array_list_get(signed_encrypted_parts->headers, env,
+ i);
+ if(header)
+ {
+ rp_header_free(header, env);
+ }
+ }
+ axutil_array_list_free(signed_encrypted_parts->headers, env);
+ signed_encrypted_parts->headers = NULL;
+ }
+ AXIS2_FREE(env->allocator, signed_encrypted_parts);
+ signed_encrypted_parts = NULL;
+ }
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_signed_encrypted_parts_get_body(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env)
+{
+ return signed_encrypted_parts->body;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_parts_set_body(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env,
+ axis2_bool_t body)
+{
+ AXIS2_PARAM_CHECK(env->error, body, AXIS2_FAILURE);
+ signed_encrypted_parts->body = body;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_signed_encrypted_parts_get_signedparts(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env)
+{
+ return signed_encrypted_parts->signedparts;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_parts_set_signedparts(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env,
+ axis2_bool_t signedparts)
+{
+ signed_encrypted_parts->signedparts = signedparts;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+rp_signed_encrypted_parts_get_headers(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env)
+{
+ return signed_encrypted_parts->headers;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_parts_add_header(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env,
+ rp_header_t * header)
+{
+ AXIS2_PARAM_CHECK(env->error, header, AXIS2_FAILURE);
+ axutil_array_list_add(signed_encrypted_parts->headers, env, header);
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_parts_increment_ref(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env)
+{
+ signed_encrypted_parts->ref++;
+ return AXIS2_SUCCESS;
+}
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_signed_encrypted_parts_get_attachments(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env)
+{
+ return signed_encrypted_parts->attachments;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_signed_encrypted_parts_set_attachments(
+ rp_signed_encrypted_parts_t * signed_encrypted_parts,
+ const axutil_env_t * env,
+ axis2_bool_t attachments)
+{
+ signed_encrypted_parts->attachments = attachments;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/supporting_tokens.c b/neethi/src/secpolicy/model/supporting_tokens.c
new file mode 100644
index 0000000..7ec2d7f
--- /dev/null
+++ b/neethi/src/secpolicy/model/supporting_tokens.c
@@ -0,0 +1,300 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_supporting_tokens.h>
+
+struct rp_supporting_tokens_t
+{
+ rp_algorithmsuite_t *algorithmsuite;
+ axutil_array_list_t *tokens;
+ rp_signed_encrypted_elements_t *signed_elements;
+ rp_signed_encrypted_parts_t *signed_parts;
+ rp_signed_encrypted_elements_t *encrypted_elements;
+ rp_signed_encrypted_parts_t *encrypted_parts;
+ int type;
+ int ref;
+};
+
+AXIS2_EXTERN rp_supporting_tokens_t *AXIS2_CALL
+rp_supporting_tokens_create(
+ const axutil_env_t * env)
+{
+ rp_supporting_tokens_t *supporting_tokens = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ supporting_tokens = (rp_supporting_tokens_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_supporting_tokens_t));
+
+ if(supporting_tokens == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ supporting_tokens->tokens = NULL;
+ supporting_tokens->tokens = axutil_array_list_create(env, 0);
+ if(!(supporting_tokens->tokens))
+ {
+ rp_supporting_tokens_free(supporting_tokens, env);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ supporting_tokens->algorithmsuite = NULL;
+ supporting_tokens->signed_parts = NULL;
+ supporting_tokens->signed_elements = NULL;
+ supporting_tokens->encrypted_parts = NULL;
+ supporting_tokens->encrypted_elements = NULL;
+ supporting_tokens->type = 0;
+ supporting_tokens->ref = 0;
+ return supporting_tokens;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_supporting_tokens_free(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(supporting_tokens)
+ {
+
+ if(--(supporting_tokens->ref) > 0)
+ {
+ return;
+ }
+
+ if(supporting_tokens->tokens)
+ {
+ int i = 0;
+ for(i = 0; i < axutil_array_list_size(supporting_tokens->tokens, env); i++)
+ {
+ rp_property_t *token = NULL;
+ token = (rp_property_t *)axutil_array_list_get(supporting_tokens->tokens, env, i);
+ if(token)
+ rp_property_free(token, env);
+
+ token = NULL;
+ }
+ axutil_array_list_free(supporting_tokens->tokens, env);
+ supporting_tokens->tokens = NULL;
+
+ }
+ if(supporting_tokens->algorithmsuite)
+ {
+ rp_algorithmsuite_free(supporting_tokens->algorithmsuite, env);
+ supporting_tokens->algorithmsuite = NULL;
+ }
+ if(supporting_tokens->signed_parts)
+ {
+ rp_signed_encrypted_parts_free(supporting_tokens->signed_parts, env);
+ supporting_tokens->signed_parts = NULL;
+ }
+ if(supporting_tokens->signed_elements)
+ {
+ rp_signed_encrypted_elements_free(supporting_tokens-> signed_elements, env);
+ supporting_tokens->signed_elements = NULL;
+ }
+ if(supporting_tokens->encrypted_parts)
+ {
+ rp_signed_encrypted_parts_free(supporting_tokens->encrypted_parts, env);
+ supporting_tokens->encrypted_parts = NULL;
+ }
+ if(supporting_tokens->encrypted_elements)
+ {
+ rp_signed_encrypted_elements_free(supporting_tokens-> encrypted_elements, env);
+ supporting_tokens->encrypted_elements = NULL;
+ }
+ AXIS2_FREE(env->allocator, supporting_tokens);
+ supporting_tokens = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+rp_supporting_tokens_get_tokens(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return supporting_tokens->tokens;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_supporting_tokens_add_token(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env,
+ rp_property_t * token)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, token, AXIS2_FAILURE);
+
+ rp_property_increment_ref(token, env);
+ axutil_array_list_add(supporting_tokens->tokens, env, token);
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_algorithmsuite_t *AXIS2_CALL
+rp_supporting_tokens_get_algorithmsuite(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return supporting_tokens->algorithmsuite;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_supporting_tokens_set_algorithmsuite(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env,
+ rp_algorithmsuite_t * algorithmsuite)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, algorithmsuite, AXIS2_FAILURE);
+
+ rp_algorithmsuite_increment_ref(algorithmsuite, env);
+ supporting_tokens->algorithmsuite = algorithmsuite;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_signed_encrypted_parts_t *AXIS2_CALL
+rp_supporting_tokens_get_signed_parts(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return supporting_tokens->signed_parts;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_supporting_tokens_set_signed_parts(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env,
+ rp_signed_encrypted_parts_t * signed_parts)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signed_parts, AXIS2_FAILURE);
+
+ supporting_tokens->signed_parts = signed_parts;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_signed_encrypted_elements_t *AXIS2_CALL
+rp_supporting_tokens_get_signed_elements(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return supporting_tokens->signed_elements;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_supporting_tokens_set_signed_elements(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env,
+ rp_signed_encrypted_elements_t * signed_elements)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signed_elements, AXIS2_FAILURE);
+
+ supporting_tokens->signed_elements = signed_elements;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_signed_encrypted_parts_t *AXIS2_CALL
+rp_supporting_tokens_get_encrypted_parts(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return supporting_tokens->encrypted_parts;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_supporting_tokens_set_encrypted_parts(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env,
+ rp_signed_encrypted_parts_t * encrypted_parts)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, encrypted_parts, AXIS2_FAILURE);
+
+ supporting_tokens->encrypted_parts = encrypted_parts;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_signed_encrypted_elements_t *AXIS2_CALL
+rp_supporting_tokens_get_encrypted_elements(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return supporting_tokens->encrypted_elements;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_supporting_tokens_set_encrypted_elements(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env,
+ rp_signed_encrypted_elements_t * encrypted_elements)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, encrypted_elements, AXIS2_FAILURE);
+
+ supporting_tokens->encrypted_elements = encrypted_elements;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN int AXIS2_CALL
+rp_supporting_tokens_get_type(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ return supporting_tokens->type;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_supporting_tokens_set_type(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env,
+ int type)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ supporting_tokens->type = type;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_supporting_tokens_increment_ref(
+ rp_supporting_tokens_t * supporting_tokens,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ supporting_tokens->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/symmetric_asymmetric_binding_commons.c b/neethi/src/secpolicy/model/symmetric_asymmetric_binding_commons.c
new file mode 100644
index 0000000..06a4188
--- /dev/null
+++ b/neethi/src/secpolicy/model/symmetric_asymmetric_binding_commons.c
@@ -0,0 +1,192 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_symmetric_asymmetric_binding_commons.h>
+
+struct rp_symmetric_asymmetric_binding_commons_t
+{
+ rp_binding_commons_t *binding_commons;
+ axis2_char_t *protection_order;
+ axis2_bool_t signature_protection;
+ axis2_bool_t token_protection;
+ axis2_bool_t entire_headers_and_body_signatures;
+
+};
+
+AXIS2_EXTERN rp_symmetric_asymmetric_binding_commons_t *AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_create(
+ const axutil_env_t * env)
+{
+ rp_symmetric_asymmetric_binding_commons_t *symmetric_asymmetric_binding_commons = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ symmetric_asymmetric_binding_commons
+ = (rp_symmetric_asymmetric_binding_commons_t *)AXIS2_MALLOC(env-> allocator,
+ sizeof(rp_symmetric_asymmetric_binding_commons_t));
+
+ if(symmetric_asymmetric_binding_commons == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ symmetric_asymmetric_binding_commons->binding_commons = NULL;
+ symmetric_asymmetric_binding_commons->protection_order = RP_SIGN_BEFORE_ENCRYPTING;
+ symmetric_asymmetric_binding_commons->signature_protection = AXIS2_FALSE;
+ symmetric_asymmetric_binding_commons->token_protection = AXIS2_FALSE;
+ symmetric_asymmetric_binding_commons->entire_headers_and_body_signatures = AXIS2_FALSE;
+
+ return symmetric_asymmetric_binding_commons;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_free(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(symmetric_asymmetric_binding_commons)
+ {
+ if(symmetric_asymmetric_binding_commons->binding_commons)
+ {
+ rp_binding_commons_free(symmetric_asymmetric_binding_commons-> binding_commons, env);
+ symmetric_asymmetric_binding_commons->binding_commons = NULL;
+ }
+ AXIS2_FREE(env->allocator, symmetric_asymmetric_binding_commons);
+ symmetric_asymmetric_binding_commons = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+AXIS2_EXTERN rp_binding_commons_t *AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_get_binding_commons(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return symmetric_asymmetric_binding_commons->binding_commons;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_set_binding_commons(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env,
+ rp_binding_commons_t * binding_commons)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, binding_commons, AXIS2_FAILURE);
+
+ symmetric_asymmetric_binding_commons->binding_commons = binding_commons;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_get_signature_protection(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return symmetric_asymmetric_binding_commons->signature_protection;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_set_signature_protection(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env,
+ axis2_bool_t signature_protection)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signature_protection, AXIS2_FAILURE);
+ symmetric_asymmetric_binding_commons->signature_protection = signature_protection;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_get_token_protection(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return symmetric_asymmetric_binding_commons->token_protection;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_set_token_protection(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env,
+ axis2_bool_t token_protection)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, token_protection, AXIS2_FAILURE);
+
+ symmetric_asymmetric_binding_commons->token_protection = token_protection;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_get_entire_headers_and_body_signatures(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return symmetric_asymmetric_binding_commons-> entire_headers_and_body_signatures;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_set_entire_headers_and_body_signatures(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env,
+ axis2_bool_t entire_headers_and_body_signatures)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, entire_headers_and_body_signatures, AXIS2_FAILURE);
+
+ symmetric_asymmetric_binding_commons->entire_headers_and_body_signatures
+ = entire_headers_and_body_signatures;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_get_protection_order(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return symmetric_asymmetric_binding_commons->protection_order;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_symmetric_asymmetric_binding_commons_set_protection_order(
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons,
+ const axutil_env_t * env,
+ axis2_char_t * protection_order)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, protection_order, AXIS2_FAILURE);
+
+ symmetric_asymmetric_binding_commons->protection_order = protection_order;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/symmetric_binding.c b/neethi/src/secpolicy/model/symmetric_binding.c
new file mode 100644
index 0000000..4d6dc2d
--- /dev/null
+++ b/neethi/src/secpolicy/model/symmetric_binding.c
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_symmetric_binding.h>
+
+struct rp_symmetric_binding_t
+{
+ rp_symmetric_asymmetric_binding_commons_t *symmetric_asymmetric_binding_commons;
+ rp_property_t *protection_token;
+ rp_property_t *signature_token;
+ rp_property_t *encryption_token;
+ int ref;
+};
+
+AXIS2_EXTERN rp_symmetric_binding_t *AXIS2_CALL
+rp_symmetric_binding_create(
+ const axutil_env_t * env)
+{
+ rp_symmetric_binding_t *symmetric_binding = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ symmetric_binding = (rp_symmetric_binding_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_symmetric_binding_t));
+
+ if(symmetric_binding == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ symmetric_binding->symmetric_asymmetric_binding_commons = NULL;
+ symmetric_binding->protection_token = NULL;
+ symmetric_binding->signature_token = NULL;
+ symmetric_binding->encryption_token = NULL;
+ symmetric_binding->ref = 0;
+
+ return symmetric_binding;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_symmetric_binding_free(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(symmetric_binding)
+ {
+ if(--(symmetric_binding->ref) > 0)
+ {
+ return;
+ }
+
+ if(symmetric_binding->symmetric_asymmetric_binding_commons)
+ {
+ rp_symmetric_asymmetric_binding_commons_free(
+ symmetric_binding-> symmetric_asymmetric_binding_commons, env);
+ symmetric_binding->symmetric_asymmetric_binding_commons = NULL;
+ }
+ if(symmetric_binding->protection_token)
+ {
+ rp_property_free(symmetric_binding->protection_token, env);
+ symmetric_binding->protection_token = NULL;
+ }
+ if(symmetric_binding->encryption_token)
+ {
+ rp_property_free(symmetric_binding->encryption_token, env);
+ symmetric_binding->encryption_token = NULL;
+ }
+ if(symmetric_binding->signature_token)
+ {
+ rp_property_free(symmetric_binding->signature_token, env);
+ symmetric_binding->signature_token = NULL;
+ }
+ AXIS2_FREE(env->allocator, symmetric_binding);
+ }
+
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN rp_symmetric_asymmetric_binding_commons_t *AXIS2_CALL
+rp_symmetric_binding_get_symmetric_asymmetric_binding_commons(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return symmetric_binding->symmetric_asymmetric_binding_commons;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_symmetric_binding_set_symmetric_asymmetric_binding_commons(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env,
+ rp_symmetric_asymmetric_binding_commons_t * symmetric_asymmetric_binding_commons)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, symmetric_asymmetric_binding_commons, AXIS2_FAILURE);
+
+ symmetric_binding->symmetric_asymmetric_binding_commons = symmetric_asymmetric_binding_commons;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_property_t *AXIS2_CALL
+rp_symmetric_binding_get_protection_token(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return symmetric_binding->protection_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_symmetric_binding_set_protection_token(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env,
+ rp_property_t * protection_token)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, protection_token, AXIS2_FAILURE);
+ if(symmetric_binding->signature_token || symmetric_binding->encryption_token)
+ {
+ return AXIS2_FAILURE;
+ }
+ rp_property_increment_ref(protection_token, env);
+ symmetric_binding->protection_token = protection_token;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_symmetric_binding_set_encryption_token(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env,
+ rp_property_t * encryption_token)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, encryption_token, AXIS2_FAILURE);
+ if(symmetric_binding->protection_token)
+ {
+ return AXIS2_FAILURE;
+ }
+ rp_property_increment_ref(encryption_token, env);
+ symmetric_binding->encryption_token = encryption_token;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN rp_property_t *AXIS2_CALL
+rp_symmetric_binding_get_encryption_token(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return symmetric_binding->encryption_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_symmetric_binding_set_signature_token(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env,
+ rp_property_t * signature_token)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, signature_token, AXIS2_FAILURE);
+ if(symmetric_binding->protection_token)
+ {
+ return AXIS2_FAILURE;
+ }
+ rp_property_increment_ref(signature_token, env);
+ symmetric_binding->signature_token = signature_token;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN rp_property_t *AXIS2_CALL
+rp_symmetric_binding_get_signature_token(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return symmetric_binding->signature_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_symmetric_binding_increment_ref(
+ rp_symmetric_binding_t * symmetric_binding,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ symmetric_binding->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/token.c b/neethi/src/secpolicy/model/token.c
new file mode 100644
index 0000000..ccb80e4
--- /dev/null
+++ b/neethi/src/secpolicy/model/token.c
@@ -0,0 +1,190 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_token.h>
+
+struct rp_token_t
+{
+ axis2_char_t *issuer;
+ axis2_char_t *inclusion;
+ axiom_node_t *claim;
+ axis2_bool_t is_issuer_name; /* shows whether 'issuer' points to issuer name or end point */
+ derive_key_type_t derive_key;
+ derive_key_version_t derive_key_version;
+ int ref;
+};
+
+AXIS2_EXTERN rp_token_t *AXIS2_CALL
+rp_token_create(
+ const axutil_env_t * env)
+{
+ rp_token_t *token = NULL;
+ token = (rp_token_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_token_t));
+
+ if(!token)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] Token creation failed. Insufficient memory");
+ return NULL;
+ }
+ token->issuer = NULL;
+ token->is_issuer_name = AXIS2_FALSE;
+ token->claim = NULL;
+ token->derive_key = DERIVEKEY_NONE;
+ token->derive_key_version = DERIVEKEY_VERSION_SC13;
+ token->inclusion = RP_INCLUDE_ALWAYS_SP12;
+ token->ref = 0;
+
+ return token;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_token_free(
+ rp_token_t * token,
+ const axutil_env_t * env)
+{
+ if(token)
+ {
+ if(--(token->ref) > 0)
+ {
+ return;
+ }
+
+ AXIS2_FREE(env->allocator, token);
+ token = NULL;
+ }
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_token_get_issuer(
+ rp_token_t * token,
+ const axutil_env_t * env)
+{
+ return token->issuer;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_token_set_issuer(
+ rp_token_t * token,
+ const axutil_env_t * env,
+ axis2_char_t * issuer)
+{
+ token->issuer = issuer;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_token_set_derive_key_version(
+ rp_token_t *token,
+ const axutil_env_t *env,
+ derive_key_version_t version)
+{
+ token->derive_key_version = version;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN derive_key_version_t AXIS2_CALL
+rp_token_get_derive_key_version(
+ rp_token_t *token,
+ const axutil_env_t *env)
+{
+ return token->derive_key_version;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_token_set_inclusion(
+ rp_token_t *token,
+ const axutil_env_t *env,
+ axis2_char_t *inclusion)
+{
+ token->inclusion = inclusion;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_token_get_inclusion(
+ rp_token_t *token,
+ const axutil_env_t *env)
+{
+ return token->inclusion;
+}
+
+AXIS2_EXTERN derive_key_type_t AXIS2_CALL
+rp_token_get_derivedkey_type(
+ rp_token_t * token,
+ const axutil_env_t * env)
+{
+ return token->derive_key;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_token_set_derivedkey_type(
+ rp_token_t * token,
+ const axutil_env_t * env,
+ derive_key_type_t derivedkey)
+{
+ token->derive_key = derivedkey;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_token_get_is_issuer_name(
+ rp_token_t * token,
+ const axutil_env_t * env)
+{
+ return token->is_issuer_name;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_token_set_is_issuer_name(
+ rp_token_t * token,
+ const axutil_env_t * env,
+ axis2_bool_t is_issuer_name)
+{
+ token->is_issuer_name = is_issuer_name;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+rp_token_get_claim(
+ rp_token_t * token,
+ const axutil_env_t * env)
+{
+ return token->claim;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_token_set_claim(
+ rp_token_t * token,
+ const axutil_env_t * env,
+ axiom_node_t *claim)
+{
+ token->claim = claim;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_token_increment_ref(
+ rp_token_t * token,
+ const axutil_env_t * env)
+{
+ token->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/transport_binding.c b/neethi/src/secpolicy/model/transport_binding.c
new file mode 100644
index 0000000..cb84fff
--- /dev/null
+++ b/neethi/src/secpolicy/model/transport_binding.c
@@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_transport_binding.h>
+
+struct rp_transport_binding_t
+{
+ rp_binding_commons_t *binding_commons;
+ rp_property_t *transport_token;
+ int ref;
+};
+
+AXIS2_EXTERN rp_transport_binding_t *AXIS2_CALL
+rp_transport_binding_create(
+ const axutil_env_t * env)
+{
+ rp_transport_binding_t *transport_binding = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ transport_binding = (rp_transport_binding_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_transport_binding_t));
+
+ if(transport_binding == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ transport_binding->binding_commons = NULL;
+ transport_binding->transport_token = NULL;
+ transport_binding->ref = 0;
+
+ return transport_binding;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_transport_binding_free(
+ rp_transport_binding_t * transport_binding,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(transport_binding)
+ {
+ if(--(transport_binding->ref) > 0)
+ {
+ return;
+ }
+ if(transport_binding->binding_commons)
+ {
+ rp_binding_commons_free(transport_binding->binding_commons, env);
+ transport_binding->binding_commons = NULL;
+ }
+ if(transport_binding->transport_token)
+ {
+ rp_property_free(transport_binding->transport_token, env);
+ transport_binding->transport_token = NULL;
+ }
+ AXIS2_FREE(env->allocator, transport_binding);
+ }
+
+ return;
+}
+
+/* Implementations */
+
+AXIS2_EXTERN rp_binding_commons_t *AXIS2_CALL
+rp_transport_binding_get_binding_commons(
+ rp_transport_binding_t * transport_binding,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return transport_binding->binding_commons;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_transport_binding_set_binding_commons(
+ rp_transport_binding_t * transport_binding,
+ const axutil_env_t * env,
+ rp_binding_commons_t * binding_commons)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, binding_commons, AXIS2_FAILURE);
+
+ transport_binding->binding_commons = binding_commons;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN rp_property_t *AXIS2_CALL
+rp_transport_binding_get_transport_token(
+ rp_transport_binding_t * transport_binding,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+
+ return transport_binding->transport_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_transport_binding_set_transport_token(
+ rp_transport_binding_t * transport_binding,
+ const axutil_env_t * env,
+ rp_property_t * transport_token)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, transport_token, AXIS2_FAILURE);
+
+ rp_property_increment_ref(transport_token, env);
+ transport_binding->transport_token = transport_token;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_transport_binding_increment_ref(
+ rp_transport_binding_t * transport_binding,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ transport_binding->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/trust10.c b/neethi/src/secpolicy/model/trust10.c
new file mode 100644
index 0000000..54d98c8
--- /dev/null
+++ b/neethi/src/secpolicy/model/trust10.c
@@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_trust10.h>
+
+struct rp_trust10_t
+{
+ axis2_bool_t must_support_client_challenge;
+ axis2_bool_t must_support_server_challenge;
+ axis2_bool_t require_client_entropy;
+ axis2_bool_t require_server_entropy;
+ axis2_bool_t must_support_issued_token;
+ int ref;
+};
+
+AXIS2_EXTERN rp_trust10_t *AXIS2_CALL
+rp_trust10_create(
+ const axutil_env_t * env)
+{
+ rp_trust10_t *trust10 = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ trust10 = (rp_trust10_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_trust10_t));
+
+ if(trust10 == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ trust10->must_support_client_challenge = AXIS2_FALSE;
+ trust10->must_support_server_challenge = AXIS2_FALSE;
+ trust10->require_client_entropy = AXIS2_FALSE;
+ trust10->require_server_entropy = AXIS2_FALSE;
+ trust10->must_support_issued_token = AXIS2_FALSE;
+ trust10->ref = 0;
+
+ return trust10;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_trust10_free(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(trust10)
+ {
+ if(--(trust10->ref) > 0)
+ {
+ return;
+ }
+
+ AXIS2_FREE(env->allocator, trust10);
+ trust10 = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_trust10_get_must_support_client_challenge(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return trust10->must_support_client_challenge;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_trust10_set_must_support_client_challenge(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_client_challenge)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_client_challenge, AXIS2_FAILURE);
+ trust10->must_support_client_challenge = must_support_client_challenge;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_trust10_get_must_support_server_challenge(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return trust10->must_support_server_challenge;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_trust10_set_must_support_server_challenge(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_server_challenge)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_server_challenge, AXIS2_FAILURE);
+ trust10->must_support_server_challenge = must_support_server_challenge;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_trust10_get_require_client_entropy(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return trust10->require_client_entropy;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_trust10_set_require_client_entropy(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env,
+ axis2_bool_t require_client_entropy)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, require_client_entropy, AXIS2_FAILURE);
+ trust10->require_client_entropy = require_client_entropy;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_trust10_get_require_server_entropy(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return trust10->require_server_entropy;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_trust10_set_require_server_entropy(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env,
+ axis2_bool_t require_server_entropy)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, require_server_entropy, AXIS2_FAILURE);
+ trust10->require_server_entropy = require_server_entropy;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_trust10_get_must_support_issued_token(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return trust10->must_support_issued_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_trust10_set_must_support_issued_token(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_issued_token)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_issued_token, AXIS2_FAILURE);
+ trust10->must_support_issued_token = must_support_issued_token;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_trust10_increment_ref(
+ rp_trust10_t * trust10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ trust10->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/ut.c b/neethi/src/secpolicy/model/ut.c
new file mode 100644
index 0000000..867e5c1
--- /dev/null
+++ b/neethi/src/secpolicy/model/ut.c
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_username_token.h>
+#include <rp_token.h>
+
+struct rp_username_token_t
+{
+ axis2_char_t *inclusion;
+ password_type_t password_type;
+ axis2_bool_t useUTprofile10;
+ axis2_bool_t useUTprofile11;
+ rp_token_t *token;
+ int ref;
+};
+
+AXIS2_EXTERN rp_username_token_t *AXIS2_CALL
+rp_username_token_create(
+ const axutil_env_t * env)
+{
+ rp_username_token_t *username_token = NULL;
+ username_token = (rp_username_token_t *)AXIS2_MALLOC(env->allocator,
+ sizeof(rp_username_token_t));
+
+ if(!username_token)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] User name token creation failed. Insufficient memory");
+ return NULL;
+ }
+
+ username_token->token = rp_token_create(env);
+ if(!username_token->token)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] User name token creation failed.");
+ rp_username_token_free(username_token, env);
+ return NULL;
+ }
+
+ username_token->inclusion = RP_INCLUDE_ALWAYS;
+ username_token->password_type = PASSWORD_PLAIN;
+ username_token->useUTprofile10 = AXIS2_TRUE;
+ username_token->useUTprofile11 = AXIS2_FALSE;
+ username_token->ref = 0;
+
+ return username_token;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_username_token_free(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env)
+{
+ if(username_token)
+ {
+ if(--(username_token->ref) > 0)
+ {
+ return;
+ }
+
+ rp_token_free(username_token->token, env);
+ AXIS2_FREE(env->allocator, username_token);
+ username_token = NULL;
+ }
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_username_token_get_inclusion(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env)
+{
+ return username_token->inclusion;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_username_token_set_inclusion(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env,
+ axis2_char_t * inclusion)
+{
+ AXIS2_PARAM_CHECK(env->error, inclusion, AXIS2_FAILURE);
+ username_token->inclusion = inclusion;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_username_token_get_useUTprofile10(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env)
+{
+ return username_token->useUTprofile10;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_username_token_set_useUTprofile10(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env,
+ axis2_bool_t useUTprofile10)
+{
+ username_token->useUTprofile10 = useUTprofile10;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_username_token_get_useUTprofile11(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env)
+{
+ return username_token->useUTprofile10;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_username_token_set_useUTprofile11(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env,
+ axis2_bool_t useUTprofile11)
+{
+ username_token->useUTprofile11 = useUTprofile11;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_username_token_increment_ref(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env)
+{
+ username_token->ref++;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_username_token_get_issuer(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env)
+{
+ return rp_token_get_issuer(username_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_username_token_set_issuer(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env,
+ axis2_char_t * issuer)
+{
+ return rp_token_set_issuer(username_token->token, env, issuer);
+}
+
+AXIS2_EXTERN derive_key_type_t AXIS2_CALL
+rp_username_token_get_derivedkey_type(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env)
+{
+ return rp_token_get_derivedkey_type(username_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_username_token_set_derivedkey_type(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env,
+ derive_key_type_t derivedkey)
+{
+ return rp_token_set_derivedkey_type(username_token->token, env, derivedkey);
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_username_token_get_is_issuer_name(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env)
+{
+ return rp_token_get_is_issuer_name(username_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_username_token_set_is_issuer_name(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env,
+ axis2_bool_t is_issuer_name)
+{
+ return rp_token_set_is_issuer_name(username_token->token, env, is_issuer_name);
+}
+
+AXIS2_EXTERN axiom_node_t *AXIS2_CALL
+rp_username_token_get_claim(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env)
+{
+ return rp_token_get_claim(username_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_username_token_set_claim(
+ rp_username_token_t * username_token,
+ const axutil_env_t * env,
+ axiom_node_t *claim)
+{
+ return rp_token_set_claim(username_token->token, env, claim);
+}
diff --git a/neethi/src/secpolicy/model/wss10.c b/neethi/src/secpolicy/model/wss10.c
new file mode 100644
index 0000000..2ee451d
--- /dev/null
+++ b/neethi/src/secpolicy/model/wss10.c
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_wss10.h>
+
+struct rp_wss10_t
+{
+ axis2_bool_t must_support_ref_key_identifier;
+ axis2_bool_t must_support_ref_issuer_serial;
+ axis2_bool_t must_support_ref_external_uri;
+ axis2_bool_t must_support_ref_embedded_token;
+ axis2_bool_t must_support_direct_reference;
+ int ref;
+};
+
+AXIS2_EXTERN rp_wss10_t *AXIS2_CALL
+rp_wss10_create(
+ const axutil_env_t * env)
+{
+ rp_wss10_t *wss10 = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ wss10 = (rp_wss10_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_wss10_t));
+
+ if(wss10 == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ wss10->must_support_ref_key_identifier = AXIS2_FALSE;
+ wss10->must_support_ref_issuer_serial = AXIS2_FALSE;
+ wss10->must_support_ref_external_uri = AXIS2_FALSE;
+ wss10->must_support_ref_embedded_token = AXIS2_FALSE;
+ wss10->must_support_direct_reference = AXIS2_TRUE;
+ wss10->ref = 0;
+
+ return wss10;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_wss10_free(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(wss10)
+ {
+ if(--(wss10->ref) > 0)
+ {
+ return;
+ }
+
+ AXIS2_FREE(env->allocator, wss10);
+ wss10 = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss10_get_must_support_ref_key_identifier(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss10->must_support_ref_key_identifier;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss10_set_must_support_ref_key_identifier(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_key_identifier)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_ref_key_identifier, AXIS2_FAILURE);
+ wss10->must_support_ref_key_identifier = must_support_ref_key_identifier;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss10_get_must_support_ref_issuer_serial(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss10->must_support_ref_issuer_serial;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss10_set_must_support_ref_issuer_serial(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_issuer_serial)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_ref_issuer_serial, AXIS2_FAILURE);
+ wss10->must_support_ref_issuer_serial = must_support_ref_issuer_serial;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss10_get_must_support_ref_external_uri(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss10->must_support_ref_external_uri;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss10_set_must_support_ref_external_uri(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_external_uri)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_ref_external_uri, AXIS2_FAILURE);
+ wss10->must_support_ref_external_uri = must_support_ref_external_uri;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss10_get_must_support_ref_embedded_token(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss10->must_support_ref_embedded_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss10_set_must_support_ref_embedded_token(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_embedded_token)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_ref_embedded_token, AXIS2_FAILURE);
+ wss10->must_support_ref_embedded_token = must_support_ref_embedded_token;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss10_increment_ref(
+ rp_wss10_t * wss10,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ wss10->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/wss11.c b/neethi/src/secpolicy/model/wss11.c
new file mode 100644
index 0000000..552646c
--- /dev/null
+++ b/neethi/src/secpolicy/model/wss11.c
@@ -0,0 +1,256 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_wss11.h>
+
+struct rp_wss11_t
+{
+ axis2_bool_t must_support_ref_key_identifier;
+ axis2_bool_t must_support_ref_issuer_serial;
+ axis2_bool_t must_support_ref_external_uri;
+ axis2_bool_t must_support_ref_embedded_token;
+ axis2_bool_t must_support_ref_thumbprint;
+ axis2_bool_t must_support_ref_encryptedkey;
+ axis2_bool_t require_signature_confirmation;
+ axis2_bool_t must_support_direct_reference;
+ int ref;
+};
+
+AXIS2_EXTERN rp_wss11_t *AXIS2_CALL
+rp_wss11_create(
+ const axutil_env_t * env)
+{
+ rp_wss11_t *wss11 = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+
+ wss11 = (rp_wss11_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_wss11_t));
+
+ if(wss11 == NULL)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ wss11->must_support_ref_key_identifier = AXIS2_FALSE;
+ wss11->must_support_ref_issuer_serial = AXIS2_FALSE;
+ wss11->must_support_ref_external_uri = AXIS2_FALSE;
+ wss11->must_support_ref_embedded_token = AXIS2_FALSE;
+ wss11->must_support_ref_thumbprint = AXIS2_FALSE;
+ wss11->must_support_ref_encryptedkey = AXIS2_FALSE;
+ wss11->require_signature_confirmation = AXIS2_FALSE;
+ wss11->must_support_direct_reference = AXIS2_TRUE;
+ wss11->ref = 0;
+
+ return wss11;
+
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_wss11_free(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+ if(wss11)
+ {
+ if(--(wss11->ref) > 0)
+ {
+ return;
+ }
+ AXIS2_FREE(env->allocator, wss11);
+ wss11 = NULL;
+ }
+ return;
+}
+
+/* Implementations */
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss11_get_must_support_ref_key_identifier(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss11->must_support_ref_key_identifier;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss11_set_must_support_ref_key_identifier(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_key_identifier)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_ref_key_identifier, AXIS2_FAILURE);
+ wss11->must_support_ref_key_identifier = must_support_ref_key_identifier;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss11_get_must_support_ref_issuer_serial(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss11->must_support_ref_issuer_serial;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss11_set_must_support_ref_issuer_serial(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_issuer_serial)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_ref_issuer_serial, AXIS2_FAILURE);
+ wss11->must_support_ref_issuer_serial = must_support_ref_issuer_serial;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss11_get_must_support_ref_external_uri(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss11->must_support_ref_external_uri;
+
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss11_set_must_support_ref_external_uri(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_external_uri)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_ref_external_uri, AXIS2_FAILURE);
+ wss11->must_support_ref_external_uri = must_support_ref_external_uri;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss11_get_must_support_ref_embedded_token(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss11->must_support_ref_embedded_token;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss11_set_must_support_ref_embedded_token(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_embedded_token)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_ref_embedded_token, AXIS2_FAILURE);
+ wss11->must_support_ref_embedded_token = must_support_ref_embedded_token;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss11_get_must_support_ref_thumbprint(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss11->must_support_ref_thumbprint;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss11_set_must_support_ref_thumbprint(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_thumbprint)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+ AXIS2_PARAM_CHECK(env->error, must_support_ref_thumbprint, AXIS2_FAILURE);
+ wss11->must_support_ref_thumbprint = must_support_ref_thumbprint;
+
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss11_get_must_support_ref_encryptedkey(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss11->must_support_ref_encryptedkey;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss11_set_must_support_ref_encryptedkey(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env,
+ axis2_bool_t must_support_ref_encryptedkey)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, must_support_ref_encryptedkey, AXIS2_FAILURE);
+ wss11->must_support_ref_encryptedkey = must_support_ref_encryptedkey;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_wss11_get_require_signature_confirmation(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FALSE);
+
+ return wss11->require_signature_confirmation;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss11_set_require_signature_confirmation(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env,
+ axis2_bool_t require_signature_confirmation)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, require_signature_confirmation, AXIS2_FAILURE);
+ wss11->require_signature_confirmation = require_signature_confirmation;
+
+ return AXIS2_SUCCESS;
+
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_wss11_increment_ref(
+ rp_wss11_t * wss11,
+ const axutil_env_t * env)
+{
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ wss11->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/secpolicy/model/x509_token.c b/neethi/src/secpolicy/model/x509_token.c
new file mode 100644
index 0000000..057af86
--- /dev/null
+++ b/neethi/src/secpolicy/model/x509_token.c
@@ -0,0 +1,231 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <rp_x509_token.h>
+
+struct rp_x509_token_t
+{
+ rp_token_t *token;
+ axis2_bool_t require_key_identifier_reference;
+ axis2_bool_t require_issuer_serial_reference;
+ axis2_bool_t require_embedded_token_reference;
+ axis2_bool_t require_thumb_print_reference;
+ axis2_char_t *token_version_and_type;
+ int ref;
+
+};
+
+AXIS2_EXTERN rp_x509_token_t *AXIS2_CALL
+rp_x509_token_create(
+ const axutil_env_t * env)
+{
+ rp_x509_token_t *x509_token = NULL;
+ x509_token = (rp_x509_token_t *)AXIS2_MALLOC(env->allocator, sizeof(rp_x509_token_t));
+
+ if(!x509_token)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ "[neethi] X509 token assertion creation failed. Insufficient memory");
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ x509_token->require_key_identifier_reference = AXIS2_FALSE;
+ x509_token->require_issuer_serial_reference = AXIS2_FALSE;
+ x509_token->require_embedded_token_reference = AXIS2_FALSE;
+ x509_token->require_thumb_print_reference = AXIS2_FALSE;
+ x509_token->token_version_and_type = RP_WSS_X509_V3_TOKEN_10;
+ x509_token->ref = 0;
+
+ x509_token->token = rp_token_create(env);
+ if(!x509_token->token)
+ {
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[neethi] X509 token assertion creation failed.");
+ rp_x509_token_free(x509_token, env);
+ return NULL;
+ }
+ return x509_token;
+}
+
+AXIS2_EXTERN void AXIS2_CALL
+rp_x509_token_free(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env)
+{
+ if(x509_token)
+ {
+ if(--(x509_token->ref) > 0)
+ {
+ return;
+ }
+
+ rp_token_free(x509_token->token, env);
+ AXIS2_FREE(env->allocator, x509_token);
+ x509_token = NULL;
+ }
+}
+
+/* Implementations */
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_x509_token_get_inclusion(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env)
+{
+ return rp_token_get_inclusion(x509_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_x509_token_set_inclusion(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env,
+ axis2_char_t * inclusion)
+{
+ return rp_token_set_inclusion(x509_token->token, env, inclusion);
+}
+
+AXIS2_EXTERN derive_key_type_t AXIS2_CALL
+rp_x509_token_get_derivedkey(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env)
+{
+ return rp_token_get_derivedkey_type(x509_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_x509_token_set_derivedkey(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env,
+ derive_key_type_t derivedkeys)
+{
+ return rp_token_set_derivedkey_type(x509_token->token, env, derivedkeys);
+}
+
+AXIS2_EXTERN derive_key_version_t AXIS2_CALL
+rp_x509_token_get_derivedkey_version(
+ rp_x509_token_t *x509_token,
+ const axutil_env_t *env)
+{
+ return rp_token_get_derive_key_version(x509_token->token, env);
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_x509_token_set_derivedkey_version(
+ rp_x509_token_t *x509_token,
+ const axutil_env_t *env,
+ derive_key_version_t version)
+{
+ return rp_token_set_derive_key_version(x509_token->token, env, version);
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_x509_token_get_require_key_identifier_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env)
+{
+ return x509_token->require_key_identifier_reference;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_x509_token_set_require_key_identifier_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env,
+ axis2_bool_t require_key_identifier_reference)
+{
+ x509_token->require_key_identifier_reference = require_key_identifier_reference;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_x509_token_get_require_issuer_serial_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env)
+{
+ return x509_token->require_issuer_serial_reference;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_x509_token_set_require_issuer_serial_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env,
+ axis2_bool_t require_issuer_serial_reference)
+{
+ x509_token->require_issuer_serial_reference = require_issuer_serial_reference;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_x509_token_get_require_embedded_token_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env)
+{
+ return x509_token->require_embedded_token_reference;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_x509_token_set_require_embedded_token_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env,
+ axis2_bool_t require_embedded_token_reference)
+{
+ x509_token->require_embedded_token_reference = require_embedded_token_reference;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_bool_t AXIS2_CALL
+rp_x509_token_get_require_thumb_print_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env)
+{
+ return x509_token->require_thumb_print_reference;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_x509_token_set_require_thumb_print_reference(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env,
+ axis2_bool_t require_thumb_print_reference)
+{
+ x509_token->require_thumb_print_reference = require_thumb_print_reference;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+rp_x509_token_get_token_version_and_type(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env)
+{
+ return x509_token->token_version_and_type;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_x509_token_set_token_version_and_type(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env,
+ axis2_char_t * token_version_and_type)
+{
+ x509_token->token_version_and_type = token_version_and_type;
+ return AXIS2_SUCCESS;
+}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+rp_x509_token_increment_ref(
+ rp_x509_token_t * x509_token,
+ const axutil_env_t * env)
+{
+ x509_token->ref++;
+ return AXIS2_SUCCESS;
+}
diff --git a/neethi/src/util.c b/neethi/src/util.c
new file mode 100644
index 0000000..ca3d790
--- /dev/null
+++ b/neethi/src/util.c
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <neethi_util.h>
+
+AXIS2_EXTERN neethi_policy_t *AXIS2_CALL
+neethi_util_create_policy_from_file(
+ const axutil_env_t *env,
+ axis2_char_t *file_name)
+{
+
+ axiom_xml_reader_t *reader = NULL;
+ axiom_stax_builder_t *builder = NULL;
+ axiom_document_t *document = NULL;
+ axiom_node_t *root_node = NULL;
+
+ reader = axiom_xml_reader_create_for_file(env, file_name, NULL);
+
+ if(!reader)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_CREATING_XML_STREAM_READER, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ return NULL;
+ }
+
+ builder = axiom_stax_builder_create(env, reader);
+ if(!builder)
+ {
+ axiom_xml_reader_free(reader, env);
+ return NULL;
+ }
+ document = axiom_stax_builder_get_document(builder, env);
+
+ if(!document)
+ {
+ axiom_stax_builder_free(builder, env);
+ return NULL;
+ }
+
+ root_node = axiom_document_build_all(document, env);
+ if(!root_node)
+ {
+ axiom_stax_builder_free(builder, env);
+ return NULL;
+ }
+
+ axiom_stax_builder_free_self(builder, env);
+ builder = NULL;
+
+ return neethi_util_create_policy_from_om(env, root_node);
+
+}
+
+AXIS2_EXTERN neethi_policy_t *AXIS2_CALL
+neethi_util_create_policy_from_om(
+ const axutil_env_t *env,
+ axiom_node_t *root_node)
+{
+
+ axiom_element_t *root_ele = NULL;
+
+ if(axiom_node_get_node_type(root_node, env) == AXIOM_ELEMENT)
+ {
+ root_ele = (axiom_element_t *)axiom_node_get_data_element(root_node, env);
+ if(root_ele)
+ {
+ neethi_policy_t *neethi_policy = NULL;
+ neethi_policy = neethi_engine_get_policy(env, root_node, root_ele);
+ if(!neethi_policy)
+ {
+ return NULL;
+ }
+ neethi_policy_set_root_node(neethi_policy, env, root_node);
+ return neethi_policy;
+ }
+ else
+ return NULL;
+ }
+ else
+ return NULL;
+}
diff --git a/neethi/test/Makefile.am b/neethi/test/Makefile.am
new file mode 100644
index 0000000..b7ace58
--- /dev/null
+++ b/neethi/test/Makefile.am
@@ -0,0 +1,14 @@
+TESTS =
+noinst_PROGRAMS = test
+
+test_SOURCES = test.c
+
+INCLUDES = -I$(top_builddir)/include \
+ -I ../../util/include \
+ -I ../../axiom/include \
+ -I ../../include
+
+test_LDADD = $(top_builddir)/src/libneethi.la \
+ ../../axiom/src/om/libaxis2_axiom.la \
+ ../../util/src/libaxutil.la \
+ ../src/libneethi.la
diff --git a/neethi/test/main.c b/neethi/test/main.c
new file mode 100644
index 0000000..53ec367
--- /dev/null
+++ b/neethi/test/main.c
@@ -0,0 +1,362 @@
+#include <axiom.h>
+#include <axutil_utils.h>
+#include <axutil_env.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+#include <stdio.h>
+#include <axiom_xml_reader.h>
+#include <neethi_engine.h>
+#include <axutil_hash.h>
+
+axis2_status_t AXIS2_CALL om_node_serialize(
+ axiom_node_t * node,
+ const axutil_env_t * env);
+
+/*axis2_status_t AXIS2_CALL
+load_policy_array(
+ axutil_array_list_t *arraylist,
+ axis2_char_t *file_name,
+ const axutil_env_t *env);
+*/
+axis2_status_t AXIS2_CALL load_policy_array(
+ axutil_array_list_t * arraylist,
+ axiom_node_t * root,
+ const axutil_env_t * env);
+
+axiom_node_t *return_policy_element(
+ axis2_char_t * name,
+ const axutil_env_t * env,
+ axis2_char_t * wsdl_name);
+
+axis2_char_t *get_policy_ref(
+ axiom_node_t * node,
+ const axutil_env_t * env);
+
+void get_all_policy(
+ axis2_char_t * element_name,
+ const axutil_env_t * env,
+ axutil_array_list_t * policy_node_list,
+ axis2_char_t * wsdl_name);
+
+neethi_policy_t *AXIS2_CALL merge_policylist(
+ axutil_array_list_t * arraylist,
+ const axutil_env_t * env);
+
+int
+main(
+ int argc,
+ char **argv)
+{
+ axis2_status_t status = AXIS2_FAILURE;
+ int i = 0;
+ axutil_array_list_t *policy_list = NULL;
+ axutil_array_list_t *policy_node_list = NULL;
+ neethi_policy_t *resultant = NULL;
+ axutil_allocator_t *allocator = axutil_allocator_init(NULL);
+ axutil_error_t *error = axutil_error_create(allocator);
+ const axutil_env_t *env = axutil_env_create_with_error(allocator, error);
+
+ policy_list = axutil_array_list_create(env, 0);
+ policy_node_list = axutil_array_list_create(env, 0);
+
+ get_all_policy(argv[1], env, policy_node_list, argv[2]);
+
+ for (i = 0; i < axutil_array_list_size(policy_node_list, env); i++)
+ {
+ axiom_node_t *node = NULL;
+ node = (axiom_node_t *) axutil_array_list_get(policy_node_list, env, i);
+ status = load_policy_array(policy_list, node, env);
+ }
+
+ resultant = merge_policylist(policy_list, env);
+ if (!resultant)
+ {
+ printf("Error Merging\n");
+ return 0;
+ }
+ else
+ {
+ axiom_node_t *s_node = NULL;
+ axis2_char_t *buff = NULL;
+ s_node = neethi_engine_serialize(resultant, env);
+ if (!s_node)
+ {
+ printf("Serializing failed\n");
+ return 0;
+ }
+ buff = axiom_node_to_string(s_node, env);
+ printf("\n%s", buff);
+ }
+ printf("Successful\n");
+ return 0;
+
+}
+
+neethi_policy_t *AXIS2_CALL
+merge_policylist(
+ axutil_array_list_t * arraylist,
+ const axutil_env_t * env)
+{
+ int i = 0;
+ neethi_policy_t *policy = NULL;
+ neethi_policy_t *result = NULL;
+
+ result = (neethi_policy_t *) axutil_array_list_get(arraylist, env, 0);
+ result =
+ (neethi_policy_t *) neethi_engine_get_normalize(env, AXIS2_FALSE,
+ result);
+
+ for (i = 1; i < axutil_array_list_size(arraylist, env); i++)
+ {
+ policy = (neethi_policy_t *) axutil_array_list_get(arraylist, env, i);
+ policy =
+ (neethi_policy_t *) neethi_engine_get_normalize(env, AXIS2_FALSE,
+ policy);
+ result = (neethi_policy_t *) neethi_engine_merge(env, policy, result);
+ }
+ return result;
+}
+
+axis2_status_t AXIS2_CALL
+om_node_serialize(
+ axiom_node_t * node,
+ const axutil_env_t * env)
+{
+
+ axiom_output_t *om_output = NULL;
+ axiom_xml_writer_t *writer = NULL;
+ axis2_char_t *output_buffer = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
+
+ writer = axiom_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0,
+ AXIS2_XML_PARSER_TYPE_BUFFER);
+ om_output = axiom_output_create(env, writer);
+
+ status = axiom_node_serialize(node, env, om_output);
+ if (status != AXIS2_SUCCESS)
+ {
+ printf("\naxiom_node_serialize failed\n");
+ return 0;
+ }
+ else
+ printf("\naxiom_node_serialize success\n");
+ /* end serializing stuff */
+
+ /*axiom_node_free_tree(node1, env); */
+ output_buffer = (axis2_char_t *) axiom_xml_writer_get_xml(writer, env);
+
+ printf("\nend test_om_serialize\n");
+
+}
+
+axis2_status_t AXIS2_CALL
+load_policy_array(
+ axutil_array_list_t * arraylist,
+ axiom_node_t * root,
+ const axutil_env_t * env)
+{
+
+ axiom_element_t *root_ele = NULL;
+
+ if (root)
+ {
+ if (axiom_node_get_node_type(root, env) == AXIOM_ELEMENT)
+ {
+ root_ele =
+ (axiom_element_t *) axiom_node_get_data_element(root, env);
+ if (root_ele)
+ {
+ neethi_policy_t *neethi_policy = NULL;
+ neethi_policy = neethi_engine_get_policy(env, root, root_ele);
+ if (!neethi_policy)
+ {
+ printf("Policy Creation fails\n");
+ return AXIS2_FAILURE;
+ }
+ axutil_array_list_add(arraylist, env, neethi_policy);
+ }
+ }
+ }
+ return AXIS2_SUCCESS;
+}
+
+axiom_node_t *
+return_policy_element(
+ axis2_char_t * name,
+ const axutil_env_t * env,
+ axis2_char_t * wsdl_name)
+{
+ axiom_element_t *ele1 = NULL,
+ *ele2 = NULL;
+ axiom_document_t *document = NULL;
+ axiom_node_t *node1 = NULL,
+ *node2 = NULL,
+ *policy_node = NULL;
+ axiom_namespace_t *ns = NULL;
+ axiom_xml_reader_t *reader = NULL;
+ axiom_stax_builder_t *builder = NULL;
+ char *buffer = NULL;
+ axiom_attribute_t *attr = NULL;
+ axis2_char_t *value = NULL;
+ axis2_char_t *val = NULL;
+ axutil_hash_t *attr_hash = NULL;
+ axis2_char_t *xml_output = NULL;
+ axutil_hash_index_t *hi;
+
+/*
+ f = fopen(wsdl_name, "r");
+ if (!f)
+ return NULL;
+
+ reader = axiom_xml_reader_create_for_io(env, read_input, NULL , NULL, NULL);
+*/
+ reader = axiom_xml_reader_create_for_file(env, wsdl_name, NULL);
+
+ if (!reader)
+ {
+ printf("ERROR CREATING PULLPARSER");
+ return NULL;
+ }
+
+ builder = axiom_stax_builder_create(env, reader);
+
+ if (!builder)
+ {
+ printf("ERROR CREATING PULL PARSER");
+ return NULL;
+ }
+
+ document = axiom_stax_builder_get_document(builder, env);
+ if (!document)
+ return NULL;
+
+ node1 = axiom_document_get_root_element(document, env);
+ if (!node1)
+ {
+ printf(" root element null ");
+ axiom_stax_builder_free(builder, env);
+ return NULL;
+ }
+
+ do
+ {
+ node2 = axiom_document_build_next(document, env);
+
+ if (!node2)
+ break;
+
+ if (axiom_node_get_node_type(node2, env) == AXIOM_ELEMENT)
+ {
+ ele2 = (axiom_element_t *) axiom_node_get_data_element(node2, env);
+ attr_hash = axiom_element_get_all_attributes(ele2, env);
+ if (attr_hash)
+ {
+ hi = axutil_hash_first(attr_hash, env);
+ axutil_hash_this(hi, NULL, NULL, &attr);
+
+ if (axutil_strcmp(axiom_attribute_get_value(attr, env), name) ==
+ 0)
+ {
+ policy_node = node2;
+ }
+ }
+ }
+ }
+ while (node2);
+ return policy_node;
+}
+
+axis2_char_t *
+get_policy_ref(
+ axiom_node_t * node,
+ const axutil_env_t * env)
+{
+ axiom_element_t *policy_element = NULL;
+ axiom_children_iterator_t *children_iter = NULL;
+ axiom_node_t *child_node = NULL;
+ axutil_qname_t *qname = NULL;
+ axis2_char_t *value = NULL;
+ axis2_char_t *val = NULL;
+ axiom_attribute_t *attr = NULL;
+
+ policy_element = (axiom_element_t *) axiom_node_get_data_element(node, env);
+ children_iter = axiom_element_get_children(policy_element, env, node);
+
+ while (axiom_children_iterator_has_next(children_iter, env))
+ {
+ child_node = axiom_children_iterator_next(children_iter, env);
+ if (axiom_node_get_node_type(child_node, env) == AXIOM_ELEMENT)
+ {
+ policy_element =
+ (axiom_element_t *) axiom_node_get_data_element(child_node,
+ env);
+
+ if (axutil_strcmp
+ (axiom_element_get_localname(policy_element, env),
+ "PolicyReference") == 0)
+ {
+ qname = axutil_qname_create(env, "URI", NULL, NULL);
+ attr = axiom_element_get_attribute(policy_element, env, qname);
+
+ if (attr)
+ {
+ value = axiom_attribute_get_value(attr, env);
+ val = axutil_string_substring_starting_at(value, 1);
+ return val;
+ }
+ }
+ }
+ }
+ return NULL;
+}
+
+void
+get_all_policy(
+ axis2_char_t * element_name,
+ const axutil_env_t * env,
+ axutil_array_list_t * policy_node_list,
+ axis2_char_t * wsdl_name)
+{
+ axutil_hash_t *attr_hash = NULL;
+ axutil_hash_index_t *hi = NULL;
+ axiom_element_t *element = NULL;
+ axiom_attribute_t *attribute = NULL;
+ axis2_char_t *attribute_val = NULL;
+ axiom_node_t *parent_policy_node = NULL,
+ *parent_node = NULL;
+
+ parent_node = return_policy_element(element_name, env, wsdl_name);
+ if (!parent_node)
+ return;
+
+ parent_policy_node =
+ return_policy_element(get_policy_ref(parent_node, env), env, wsdl_name);
+ axutil_array_list_add(policy_node_list, env, parent_policy_node);
+
+ if (axiom_node_get_node_type(parent_node, env) == AXIOM_ELEMENT)
+ {
+ element =
+ (axiom_element_t *) axiom_node_get_data_element(parent_node, env);
+ attr_hash = axiom_element_get_all_attributes(element, env);
+ if (attr_hash)
+ {
+ hi = axutil_hash_next(env, axutil_hash_first(attr_hash, env));
+ do
+ {
+ if (hi)
+ {
+ axutil_hash_this(hi, NULL, NULL, &attribute);
+ attribute_val = axiom_attribute_get_value(attribute, env);
+ attribute_val = axutil_rindex(attribute_val, ':');
+ attribute_val =
+ axutil_string_substring_starting_at(attribute_val, 1);
+ get_all_policy(attribute_val, env, policy_node_list,
+ wsdl_name);
+ hi = axutil_hash_next(env, hi);
+ }
+ }
+ while (hi);
+ }
+ }
+ return;
+}
diff --git a/neethi/test/policies/1.5symmetric_binding_policy.xml b/neethi/test/policies/1.5symmetric_binding_policy.xml
new file mode 100644
index 0000000..b660ac9
--- /dev/null
+++ b/neethi/test/policies/1.5symmetric_binding_policy.xml
@@ -0,0 +1,75 @@
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:ProtectionToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:RequireDerivedKeys/>
+ <sp:RequireThumbprintReference/>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:ProtectionToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:EncryptSignature/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:SymmetricBinding>
+ <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssUsernameToken10/>
+ </wsp:Policy>
+ </sp:UsernameToken>
+ </wsp:Policy>
+ </sp:SignedSupportingTokens>
+ <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ <sp:MustSupportRefThumbprint/>
+ <sp:MustSupportRefEncryptedKey/>
+ </wsp:Policy>
+ </sp:Wss11>
+ <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportIssuedTokens/>
+ <sp:RequireClientEntropy/>
+ <sp:RequireServerEntropy/>
+ </wsp:Policy>
+ </sp:Trust10>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ <sp:Header Namespace="http://www.w3.org/2005/08/addressing"/>
+ </sp:SignedParts>
+ <rampc:RampartConfig xmlns:rampc="http://ws.apache.org/rampart/c/policy">
+ <rampc:User>Alice</rampc:User>
+ <rampc:TimeToLive>360</rampc:TimeToLive>
+ <rampc:EncryptionUser>a</rampc:EncryptionUser>
+ <rampc:PasswordType>Digest</rampc:PasswordType>
+ <rampc:PasswordCallbackClass>AXIS2C_HOME/bin/samples/rampart/callback/libpwcb.so</rampc:PasswordCallbackClass>
+ <rampc:ReceiverCertificate>AXIS2C_HOME/bin/samples/rampart/keys/ahome/bob_cert.cert</rampc:ReceiverCertificate>
+ <rampc:Certificate>AXIS2C_HOME/bin/samples/rampart/keys/ahome/alice_cert.cert</rampc:Certificate>
+ <rampc:PrivateKey>AXIS2C_HOME/bin/samples/rampart/keys/ahome/alice_key.pem</rampc:PrivateKey>
+ </rampc:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Endpoint-1A.xml b/neethi/test/policies/Policy-for-Endpoint-1A.xml
new file mode 100644
index 0000000..ff1a54f
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Endpoint-1A.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion59 marker="59" />
+ <pa:Assertion22 marker="22" />
+ <pa:Assertion2 marker="2" />
+ <pa:Assertion1 marker="1" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Endpoint-1B.xml b/neethi/test/policies/Policy-for-Endpoint-1B.xml
new file mode 100644
index 0000000..4df87e6
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Endpoint-1B.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion60 marker="60" />
+ <pa:Assertion31 marker="31" />
+ <pa:Assertion2 marker="2" />
+ <pa:Assertion1 marker="1" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Endpoint-2A.xml b/neethi/test/policies/Policy-for-Endpoint-2A.xml
new file mode 100644
index 0000000..1517682
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Endpoint-2A.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion62 marker="62" />
+ <pa:Assertion40 marker="40" />
+ <pa:Assertion12 marker="12" />
+ <pa:Assertion1 marker="1" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Endpoint-2B.xml b/neethi/test/policies/Policy-for-Endpoint-2B.xml
new file mode 100644
index 0000000..359f4bb
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Endpoint-2B.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion63 marker="63" />
+ <pa:Assertion49 marker="49" />
+ <pa:Assertion12 marker="12" />
+ <pa:Assertion1 marker="1" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Input-in-Operation-1A-in-relation-to-Endpoint-1A.xml b/neethi/test/policies/Policy-for-Input-in-Operation-1A-in-relation-to-Endpoint-1A.xml
new file mode 100644
index 0000000..de6cf40
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Input-in-Operation-1A-in-relation-to-Endpoint-1A.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion24 marker="24" />
+ <pa:Assertion5 marker="5" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Input-in-Operation-1A-in-relation-to-Endpoint-1B.xml b/neethi/test/policies/Policy-for-Input-in-Operation-1A-in-relation-to-Endpoint-1B.xml
new file mode 100644
index 0000000..c88dafa
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Input-in-Operation-1A-in-relation-to-Endpoint-1B.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion33 marker="33" />
+ <pa:Assertion5 marker="5" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Input-in-Operation-1B-in-relation-to-Endpoint-1A.xml b/neethi/test/policies/Policy-for-Input-in-Operation-1B-in-relation-to-Endpoint-1A.xml
new file mode 100644
index 0000000..2885491
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Input-in-Operation-1B-in-relation-to-Endpoint-1A.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion28 marker="28" />
+ <pa:Assertion9 marker="9" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Input-in-Operation-1B-in-relation-to-Endpoint-1B.xml b/neethi/test/policies/Policy-for-Input-in-Operation-1B-in-relation-to-Endpoint-1B.xml
new file mode 100644
index 0000000..187a7b7
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Input-in-Operation-1B-in-relation-to-Endpoint-1B.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion37 marker="37" />
+ <pa:Assertion9 marker="9" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Input-in-Operation-2A-in-relation-to-Endpoint-2A.xml b/neethi/test/policies/Policy-for-Input-in-Operation-2A-in-relation-to-Endpoint-2A.xml
new file mode 100644
index 0000000..60e9575
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Input-in-Operation-2A-in-relation-to-Endpoint-2A.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion42 marker="42" />
+ <pa:Assertion15 marker="15" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Input-in-Operation-2A-in-relation-to-Endpoint-2B.xml b/neethi/test/policies/Policy-for-Input-in-Operation-2A-in-relation-to-Endpoint-2B.xml
new file mode 100644
index 0000000..59cc4fa
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Input-in-Operation-2A-in-relation-to-Endpoint-2B.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion51 marker="51" />
+ <pa:Assertion15 marker="15" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Input-in-Operation-2B-in-relation-to-Endpoint-2A.xml b/neethi/test/policies/Policy-for-Input-in-Operation-2B-in-relation-to-Endpoint-2A.xml
new file mode 100644
index 0000000..ee38033
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Input-in-Operation-2B-in-relation-to-Endpoint-2A.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion46 marker="46" />
+ <pa:Assertion19 marker="19" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Input-in-Operation-2B-in-relation-to-Endpoint-2B.xml b/neethi/test/policies/Policy-for-Input-in-Operation-2B-in-relation-to-Endpoint-2B.xml
new file mode 100644
index 0000000..883dcda
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Input-in-Operation-2B-in-relation-to-Endpoint-2B.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion55 marker="55" />
+ <pa:Assertion19 marker="19" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Operation-1A-in-relation-to-Endpoint-1A.xml b/neethi/test/policies/Policy-for-Operation-1A-in-relation-to-Endpoint-1A.xml
new file mode 100644
index 0000000..dfccd95
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Operation-1A-in-relation-to-Endpoint-1A.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion23 marker="23" />
+ <pa:Assertion4 marker="4" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Operation-1A-in-relation-to-Endpoint-1B.xml b/neethi/test/policies/Policy-for-Operation-1A-in-relation-to-Endpoint-1B.xml
new file mode 100644
index 0000000..f86c59d
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Operation-1A-in-relation-to-Endpoint-1B.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion31 marker="31" />
+ <pa:Assertion4 marker="4" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Operation-1B-in-relation-to-Endpoint-1A.xml b/neethi/test/policies/Policy-for-Operation-1B-in-relation-to-Endpoint-1A.xml
new file mode 100644
index 0000000..1f39527
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Operation-1B-in-relation-to-Endpoint-1A.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion27 marker="27" />
+ <pa:Assertion8 marker="8" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Operation-1B-in-relation-to-Endpoint-1B.xml b/neethi/test/policies/Policy-for-Operation-1B-in-relation-to-Endpoint-1B.xml
new file mode 100644
index 0000000..180e72f
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Operation-1B-in-relation-to-Endpoint-1B.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion36 marker="36" />
+ <pa:Assertion8 marker="8" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Operation-2A-in-relation-to-Endpoint-2A.xml b/neethi/test/policies/Policy-for-Operation-2A-in-relation-to-Endpoint-2A.xml
new file mode 100644
index 0000000..07efde6
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Operation-2A-in-relation-to-Endpoint-2A.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion41 marker="41" />
+ <pa:Assertion14 marker="14" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Operation-2A-in-relation-to-Endpoint-2B.xml b/neethi/test/policies/Policy-for-Operation-2A-in-relation-to-Endpoint-2B.xml
new file mode 100644
index 0000000..071fe79
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Operation-2A-in-relation-to-Endpoint-2B.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion50 marker="50" />
+ <pa:Assertion14 marker="14" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Operation-2B-in-relation-to-Endpoint-2A.xml b/neethi/test/policies/Policy-for-Operation-2B-in-relation-to-Endpoint-2A.xml
new file mode 100644
index 0000000..2356e7e
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Operation-2B-in-relation-to-Endpoint-2A.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion45 marker="45" />
+ <pa:Assertion18 marker="18" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Operation-2B-in-relation-to-Endpoint-2B.xml b/neethi/test/policies/Policy-for-Operation-2B-in-relation-to-Endpoint-2B.xml
new file mode 100644
index 0000000..2a1787b
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Operation-2B-in-relation-to-Endpoint-2B.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion54 marker="54" />
+ <pa:Assertion18 marker="18" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-OutFault-in-Operation-1A-in-relation-to-Endpoint-1A.xml b/neethi/test/policies/Policy-for-OutFault-in-Operation-1A-in-relation-to-Endpoint-1A.xml
new file mode 100644
index 0000000..084aa48
--- /dev/null
+++ b/neethi/test/policies/Policy-for-OutFault-in-Operation-1A-in-relation-to-Endpoint-1A.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion26 marker="26" />
+ <pa:Assertion7 marker="7" />
+ <pa:Assertion3 marker="3" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-OutFault-in-Operation-1A-in-relation-to-Endpoint-1B.xml b/neethi/test/policies/Policy-for-OutFault-in-Operation-1A-in-relation-to-Endpoint-1B.xml
new file mode 100644
index 0000000..7873554
--- /dev/null
+++ b/neethi/test/policies/Policy-for-OutFault-in-Operation-1A-in-relation-to-Endpoint-1B.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion35 marker="35" />
+ <pa:Assertion7 marker="7" />
+ <pa:Assertion3 marker="3" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-OutFault-in-Operation-1B-in-relation-to-Endpoint-1A.xml b/neethi/test/policies/Policy-for-OutFault-in-Operation-1B-in-relation-to-Endpoint-1A.xml
new file mode 100644
index 0000000..83acbfb
--- /dev/null
+++ b/neethi/test/policies/Policy-for-OutFault-in-Operation-1B-in-relation-to-Endpoint-1A.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion30 marker="30" />
+ <pa:Assertion11 marker="11" />
+ <pa:Assertion3 marker="3" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-OutFault-in-Operation-1B-in-relation-to-Endpoint-1B.xml b/neethi/test/policies/Policy-for-OutFault-in-Operation-1B-in-relation-to-Endpoint-1B.xml
new file mode 100644
index 0000000..238a6dc
--- /dev/null
+++ b/neethi/test/policies/Policy-for-OutFault-in-Operation-1B-in-relation-to-Endpoint-1B.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion39 marker="39" />
+ <pa:Assertion11 marker="11" />
+ <pa:Assertion3 marker="3" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-OutFault-in-Operation-2A-in-relation-to-Endpoint-2A.xml b/neethi/test/policies/Policy-for-OutFault-in-Operation-2A-in-relation-to-Endpoint-2A.xml
new file mode 100644
index 0000000..df84817
--- /dev/null
+++ b/neethi/test/policies/Policy-for-OutFault-in-Operation-2A-in-relation-to-Endpoint-2A.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion44 marker="44" />
+ <pa:Assertion17 marker="17" />
+ <pa:Assertion13 marker="13" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-OutFault-in-Operation-2A-in-relation-to-Endpoint-2B.xml b/neethi/test/policies/Policy-for-OutFault-in-Operation-2A-in-relation-to-Endpoint-2B.xml
new file mode 100644
index 0000000..83c6448
--- /dev/null
+++ b/neethi/test/policies/Policy-for-OutFault-in-Operation-2A-in-relation-to-Endpoint-2B.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion53 marker="53" />
+ <pa:Assertion17 marker="17" />
+ <pa:Assertion13 marker="13" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-OutFault-in-Operation-2B-in-relation-to-Endpoint-2A.xml b/neethi/test/policies/Policy-for-OutFault-in-Operation-2B-in-relation-to-Endpoint-2A.xml
new file mode 100644
index 0000000..e448339
--- /dev/null
+++ b/neethi/test/policies/Policy-for-OutFault-in-Operation-2B-in-relation-to-Endpoint-2A.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion48 marker="48" />
+ <pa:Assertion21 marker="21" />
+ <pa:Assertion13 marker="13" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-OutFault-in-Operation-2B-in-relation-to-Endpoint-2B.xml b/neethi/test/policies/Policy-for-OutFault-in-Operation-2B-in-relation-to-Endpoint-2B.xml
new file mode 100644
index 0000000..f0332c8
--- /dev/null
+++ b/neethi/test/policies/Policy-for-OutFault-in-Operation-2B-in-relation-to-Endpoint-2B.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion57 marker="57" />
+ <pa:Assertion21 marker="21" />
+ <pa:Assertion13 marker="13" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Output-in-Operation-1A-in-relation-to-Endpoint-1A.xml b/neethi/test/policies/Policy-for-Output-in-Operation-1A-in-relation-to-Endpoint-1A.xml
new file mode 100644
index 0000000..7bb10e5
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Output-in-Operation-1A-in-relation-to-Endpoint-1A.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion25 marker="25" />
+ <pa:Assertion6 marker="6" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Output-in-Operation-1A-in-relation-to-Endpoint-1B.xml b/neethi/test/policies/Policy-for-Output-in-Operation-1A-in-relation-to-Endpoint-1B.xml
new file mode 100644
index 0000000..76493bb
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Output-in-Operation-1A-in-relation-to-Endpoint-1B.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion34 marker="34" />
+ <pa:Assertion6 marker="6" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Output-in-Operation-1B-in-relation-to-Endpoint-1A.xml b/neethi/test/policies/Policy-for-Output-in-Operation-1B-in-relation-to-Endpoint-1A.xml
new file mode 100644
index 0000000..f4734e7
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Output-in-Operation-1B-in-relation-to-Endpoint-1A.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion29 marker="29" />
+ <pa:Assertion10 marker="10" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Output-in-Operation-1B-in-relation-to-Endpoint-1B.xml b/neethi/test/policies/Policy-for-Output-in-Operation-1B-in-relation-to-Endpoint-1B.xml
new file mode 100644
index 0000000..4bffd4e
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Output-in-Operation-1B-in-relation-to-Endpoint-1B.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion38 marker="38" />
+ <pa:Assertion10 marker="10" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Output-in-Operation-2A-in-relation-to-Endpoint-2A.xml b/neethi/test/policies/Policy-for-Output-in-Operation-2A-in-relation-to-Endpoint-2A.xml
new file mode 100644
index 0000000..3cdbe39
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Output-in-Operation-2A-in-relation-to-Endpoint-2A.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion43 marker="43" />
+ <pa:Assertion16 marker="16" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Output-in-Operation-2A-in-relation-to-Endpoint-2B.xml b/neethi/test/policies/Policy-for-Output-in-Operation-2A-in-relation-to-Endpoint-2B.xml
new file mode 100644
index 0000000..54be84f
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Output-in-Operation-2A-in-relation-to-Endpoint-2B.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion52 marker="52" />
+ <pa:Assertion16 marker="16" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Output-in-Operation-2B-in-relation-to-Endpoint-2A.xml b/neethi/test/policies/Policy-for-Output-in-Operation-2B-in-relation-to-Endpoint-2A.xml
new file mode 100644
index 0000000..a891bfc
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Output-in-Operation-2B-in-relation-to-Endpoint-2A.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion47 marker="47" />
+ <pa:Assertion20 marker="20" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Output-in-Operation-2B-in-relation-to-Endpoint-2B.xml b/neethi/test/policies/Policy-for-Output-in-Operation-2B-in-relation-to-Endpoint-2B.xml
new file mode 100644
index 0000000..4dfc80a
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Output-in-Operation-2B-in-relation-to-Endpoint-2B.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion56 marker="56" />
+ <pa:Assertion20 marker="20" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Service-1.xml b/neethi/test/policies/Policy-for-Service-1.xml
new file mode 100644
index 0000000..a94a159
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Service-1.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion58 marker="58" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/Policy-for-Service-2.xml b/neethi/test/policies/Policy-for-Service-2.xml
new file mode 100644
index 0000000..b57b6cf
--- /dev/null
+++ b/neethi/test/policies/Policy-for-Service-2.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
+ xmlns:pa="http://ws-policy.example.com/assertion" >
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <pa:Assertion61 marker="61" />
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/PolicyAttachments.wsdl b/neethi/test/policies/PolicyAttachments.wsdl
new file mode 100644
index 0000000..acf07c1
--- /dev/null
+++ b/neethi/test/policies/PolicyAttachments.wsdl
@@ -0,0 +1,448 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Round 2 test cases for testing effective policy
+ computations for policies attached to WSDL 20 policy subjects.
+
+ xmlns:wsp="http://www.w3.org/ns/ws-policy"
+
+ -->
+
+<wsdl20:description xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:wsdl20="http://www.w3.org/2006/01/wsdl"
+ xmlns:wsoap="http://www.w3.org/2006/01/wsdl/soap"
+ xmlns:wsp="http://www.w3.org/ns/ws-policy"
+ xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ xmlns:pa="http://ws-policy.example.com/assertion"
+ xmlns:s="http://schema.example.com/test"
+ targetNamespace="http://ws-policy.example.com/test"
+ xmlns:tns="http://ws-policy.example.com/test"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema http://www.w3.org/2001/XMLSchema.xsd
+ http://www.w3.org/2006/01/wsdl http://www.w3.org/2006/03/wsdl/wsdl20.xsd
+ http://www.w3.org/2006/01/wsdl/soap http://www.w3.org/2006/03/wsdl/soap.xsd
+ http://www.w3.org/ns/ws-policy http://www.w3.org/2002/ws/policy/ns/ws-policy">
+
+ <wsp:Policy wsu:Id="Policy1">
+ <pa:Assertion1 marker="1"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy2">
+ <pa:Assertion2 marker="2"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy3">
+ <pa:Assertion3 marker="3"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy4">
+ <pa:Assertion4 marker="4"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy5">
+ <pa:Assertion5 marker="5"/>
+ <wsp:PolicyReference URI="#Policy2"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy6">
+ <pa:Assertion6 marker="6"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy7">
+ <pa:Assertion7 marker="7"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy8">
+ <pa:Assertion8 marker="8"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy9">
+ <pa:Assertion9 marker="9"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy10">
+ <pa:Assertion10 marker="10"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy11">
+ <pa:Assertion11 marker="11"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy12">
+ <pa:Assertion12 marker="12"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy13">
+ <pa:Assertion13 marker="13"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy14">
+ <pa:Assertion14 marker="14"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy15">
+ <pa:Assertion15 marker="15"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy16">
+ <pa:Assertion16 marker="16"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy17">
+ <pa:Assertion17 marker="17"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy18">
+ <pa:Assertion18 marker="18"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy19">
+ <pa:Assertion19 marker="19"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy20">
+ <pa:Assertion20 marker="20"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy21">
+ <pa:Assertion21 marker="21"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy22">
+ <pa:Assertion22 marker="22"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy23">
+ <pa:Assertion23 marker="23"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy24">
+ <pa:Assertion24 marker="24"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy25">
+ <pa:Assertion25 marker="25"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy26">
+ <pa:Assertion26 marker="26"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy27">
+ <pa:Assertion27 marker="27"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy28">
+ <pa:Assertion28 marker="28"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy29">
+ <pa:Assertion29 marker="29"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy30">
+ <pa:Assertion30 marker="30"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy31">
+ <pa:Assertion31 marker="31"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy32">
+ <pa:Assertion32 marker="32"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy33">
+ <pa:Assertion33 marker="33"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy34">
+ <pa:Assertion34 marker="34"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy35">
+ <pa:Assertion35 marker="35"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy36">
+ <pa:Assertion36 marker="36"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy37">
+ <pa:Assertion37 marker="37"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy38">
+ <pa:Assertion38 marker="38"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy39">
+ <pa:Assertion39 marker="39"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy40">
+ <pa:Assertion40 marker="40"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy41">
+ <pa:Assertion41 marker="41"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy42">
+ <pa:Assertion42 marker="42"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy43">
+ <pa:Assertion43 marker="43"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy44">
+ <pa:Assertion44 marker="44"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy45">
+ <pa:Assertion45 marker="45"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy46">
+ <pa:Assertion46 marker="46"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy47">
+ <pa:Assertion47 marker="47"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy48">
+ <pa:Assertion48 marker="48"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy49">
+ <pa:Assertion49 marker="49"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy50">
+ <pa:Assertion50 marker="50"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy51">
+ <pa:Assertion51 marker="51"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy52">
+ <pa:Assertion52 marker="52"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy53">
+ <pa:Assertion53 marker="53"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy54">
+ <pa:Assertion54 marker="54"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy55">
+ <pa:Assertion55 marker="55"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy56">
+ <pa:Assertion56 marker="56"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy57">
+ <pa:Assertion57 marker="57"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy58">
+ <pa:Assertion58 marker="58"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy59">
+ <pa:Assertion59 marker="59"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy60">
+ <pa:Assertion60 marker="60"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy61">
+ <pa:Assertion61 marker="61"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy62">
+ <pa:Assertion62 marker="62"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy63">
+ <pa:Assertion63 marker="63"/>
+ </wsp:Policy>
+
+ <wsdl20:types>
+ <xsd:schema elementFormDefault="qualified" targetNamespace="http://schema.example.com/test">
+ <xsd:element name="SimpleRequest">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="request" nillable="true" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="SimpleResponse">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="response" nillable="true" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="SimpleFault">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="fault" nillable="true" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ </wsdl20:types>
+
+ <wsdl20:interface name="Base-Interface">
+ <wsp:PolicyReference URI="#Policy1"></wsp:PolicyReference>
+ </wsdl20:interface>
+
+ <wsdl20:interface name="Interface-1" extends="tns:Base-Interface">
+ <wsp:PolicyReference URI="#Policy2"></wsp:PolicyReference>
+ <wsdl20:fault name="Fault-1" element="s:SimpleFault">
+ <wsp:PolicyReference URI="#Policy3"></wsp:PolicyReference>
+ </wsdl20:fault>
+ <wsdl20:operation name="Operation-1A" pattern="http://www.w3.org/2006/01/wsdl/in-out">
+ <wsp:PolicyReference URI="#Policy4"></wsp:PolicyReference>
+ <wsdl20:input element="s:SimpleRequest">
+ <wsp:PolicyReference URI="#Policy5"></wsp:PolicyReference>
+ </wsdl20:input>
+ <wsdl20:output element="s:SimpleResponse">
+ <wsp:PolicyReference URI="#Policy6"></wsp:PolicyReference>
+ </wsdl20:output>
+ <wsdl20:outfault ref="tns:Fault-1">
+ <wsp:PolicyReference URI="#Policy7"></wsp:PolicyReference>
+ </wsdl20:outfault>
+ </wsdl20:operation>
+ <wsdl20:operation name="Operation-1B" pattern="http://www.w3.org/2006/01/wsdl/in-out">
+ <wsp:PolicyReference URI="#Policy8"></wsp:PolicyReference>
+ <wsdl20:input element="s:SimpleRequest">
+ <wsp:PolicyReference URI="#Policy9"></wsp:PolicyReference>
+ </wsdl20:input>
+ <wsdl20:output element="s:SimpleResponse">
+ <wsp:PolicyReference URI="#Policy10"></wsp:PolicyReference>
+ </wsdl20:output>
+ <wsdl20:outfault ref="tns:Fault-1">
+ <wsp:PolicyReference URI="#Policy11"></wsp:PolicyReference>
+ </wsdl20:outfault>
+ </wsdl20:operation>
+ </wsdl20:interface>
+
+ <wsdl20:interface name="Interface-2" extends="tns:Base-Interface">
+ <wsp:PolicyReference URI="#Policy12"></wsp:PolicyReference>
+ <wsdl20:fault name="Fault-2" element="s:SimpleFault">
+ <wsp:PolicyReference URI="#Policy13"></wsp:PolicyReference>
+ </wsdl20:fault>
+ <wsdl20:operation name="Operation-2A" pattern="http://www.w3.org/2006/01/wsdl/in-out">
+ <wsp:PolicyReference URI="#Policy14"></wsp:PolicyReference>
+ <wsdl20:input element="s:SimpleRequest">
+ <wsp:PolicyReference URI="#Policy15"></wsp:PolicyReference>
+ </wsdl20:input>
+ <wsdl20:output element="s:SimpleResponse">
+ <wsp:PolicyReference URI="#Policy16"></wsp:PolicyReference>
+ </wsdl20:output>
+ <wsdl20:outfault ref="tns:Fault-2">
+ <wsp:PolicyReference URI="#Policy17"></wsp:PolicyReference>
+ </wsdl20:outfault>
+ </wsdl20:operation>
+ <wsdl20:operation name="Operation-2B" pattern="http://www.w3.org/2006/01/wsdl/in-out">
+ <wsp:PolicyReference URI="#Policy18"></wsp:PolicyReference>
+ <wsdl20:input element="s:SimpleRequest">
+ <wsp:PolicyReference URI="#Policy19"></wsp:PolicyReference>
+ </wsdl20:input>
+ <wsdl20:output element="s:SimpleResponse">
+ <wsp:PolicyReference URI="#Policy20"></wsp:PolicyReference>
+ </wsdl20:output>
+ <wsdl20:outfault ref="tns:Fault-2">
+ <wsp:PolicyReference URI="#Policy21"></wsp:PolicyReference>
+ </wsdl20:outfault>
+ </wsdl20:operation>
+ </wsdl20:interface>
+
+ <wsdl20:binding name="Binding-1A" interface="tns:Interface-1"
+ type="http://www.w3.org/2006/01/wsdl/soap"
+ wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP/">
+ <wsp:PolicyReference URI="#Policy22"></wsp:PolicyReference>
+ <wsdl20:operation ref="tns:Operation-1A">
+ <wsp:PolicyReference URI="#Policy23"></wsp:PolicyReference>
+ <wsdl20:input>
+ <wsp:PolicyReference URI="#Policy24"></wsp:PolicyReference>
+ </wsdl20:input>
+ <wsdl20:output>
+ <wsp:PolicyReference URI="#Policy25"></wsp:PolicyReference>
+ </wsdl20:output>
+ <wsdl20:outfault ref="tns:Fault-1">
+ <wsp:PolicyReference URI="#Policy26"></wsp:PolicyReference>
+ </wsdl20:outfault>
+ </wsdl20:operation>
+ <wsdl20:operation ref="tns:Operation-1B">
+ <wsp:PolicyReference URI="#Policy27"></wsp:PolicyReference>
+ <wsdl20:input>
+ <wsp:PolicyReference URI="#Policy28"></wsp:PolicyReference>
+ </wsdl20:input>
+ <wsdl20:output>
+ <wsp:PolicyReference URI="#Policy29"></wsp:PolicyReference>
+ </wsdl20:output>
+ <wsdl20:outfault ref="tns:Fault-1">
+ <wsp:PolicyReference URI="#Policy30"></wsp:PolicyReference>
+ </wsdl20:outfault>
+ </wsdl20:operation>
+ </wsdl20:binding>
+
+ <wsdl20:binding name="Binding-1B" interface="tns:Interface-1"
+ type="http://www.w3.org/2006/01/wsdl/soap"
+ wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP/">
+ <wsp:PolicyReference URI="#Policy31"></wsp:PolicyReference>
+ <wsdl20:operation ref="tns:Operation-1A">
+ <wsp:PolicyReference URI="#Policy32"></wsp:PolicyReference>
+ <wsdl20:input>
+ <wsp:PolicyReference URI="#Policy33"></wsp:PolicyReference>
+ </wsdl20:input>
+ <wsdl20:output>
+ <wsp:PolicyReference URI="#Policy34"></wsp:PolicyReference>
+ </wsdl20:output>
+ <wsdl20:outfault ref="tns:Fault-1">
+ <wsp:PolicyReference URI="#Policy35"></wsp:PolicyReference>
+ </wsdl20:outfault>
+ </wsdl20:operation>
+ <wsdl20:operation ref="tns:Operation-1B">
+ <wsp:PolicyReference URI="#Policy36"></wsp:PolicyReference>
+ <wsdl20:input>
+ <wsp:PolicyReference URI="#Policy37"></wsp:PolicyReference>
+ </wsdl20:input>
+ <wsdl20:output>
+ <wsp:PolicyReference URI="#Policy38"></wsp:PolicyReference>
+ </wsdl20:output>
+ <wsdl20:outfault ref="tns:Fault-1">
+ <wsp:PolicyReference URI="#Policy39"></wsp:PolicyReference>
+ </wsdl20:outfault>
+ </wsdl20:operation>
+ </wsdl20:binding>
+
+ <wsdl20:binding name="Binding-2A" interface="tns:Interface-2"
+ type="http://www.w3.org/2006/01/wsdl/soap"
+ wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP/">
+ <wsp:PolicyReference URI="#Policy40"></wsp:PolicyReference>
+ <wsdl20:operation ref="tns:Operation-2A">
+ <wsp:PolicyReference URI="#Policy41"></wsp:PolicyReference>
+ <wsdl20:input>
+ <wsp:PolicyReference URI="#Policy42"></wsp:PolicyReference>
+ </wsdl20:input>
+ <wsdl20:output>
+ <wsp:PolicyReference URI="#Policy43"></wsp:PolicyReference>
+ </wsdl20:output>
+ <wsdl20:outfault ref="tns:Fault-2">
+ <wsp:PolicyReference URI="#Policy44"></wsp:PolicyReference>
+ </wsdl20:outfault>
+ </wsdl20:operation>
+ <wsdl20:operation ref="tns:Operation-2B">
+ <wsp:PolicyReference URI="#Policy45"></wsp:PolicyReference>
+ <wsdl20:input>
+ <wsp:PolicyReference URI="#Policy46"></wsp:PolicyReference>
+ </wsdl20:input>
+ <wsdl20:output>
+ <wsp:PolicyReference URI="#Policy47"></wsp:PolicyReference>
+ </wsdl20:output>
+ <wsdl20:outfault ref="tns:Fault-2">
+ <wsp:PolicyReference URI="#Policy48"></wsp:PolicyReference>
+ </wsdl20:outfault>
+ </wsdl20:operation>
+ </wsdl20:binding>
+
+ <wsdl20:binding name="Binding-2B" interface="tns:Interface-2"
+ type="http://www.w3.org/2006/01/wsdl/soap"
+ wsoap:protocol="http://www.w3.org/2003/05/soap/bindings/HTTP/">
+ <wsp:PolicyReference URI="#Policy49"></wsp:PolicyReference>
+ <wsdl20:operation ref="tns:Operation-2A">
+ <wsp:PolicyReference URI="#Policy50"></wsp:PolicyReference>
+ <wsdl20:input>
+ <wsp:PolicyReference URI="#Policy51"></wsp:PolicyReference>
+ </wsdl20:input>
+ <wsdl20:output>
+ <wsp:PolicyReference URI="#Policy52"></wsp:PolicyReference>
+ </wsdl20:output>
+ <wsdl20:outfault ref="tns:Fault-2">
+ <wsp:PolicyReference URI="#Policy53"></wsp:PolicyReference>
+ </wsdl20:outfault>
+ </wsdl20:operation>
+ <wsdl20:operation ref="tns:Operation-2B">
+ <wsp:PolicyReference URI="#Policy54"></wsp:PolicyReference>
+ <wsdl20:input>
+ <wsp:PolicyReference URI="#Policy55"></wsp:PolicyReference>
+ </wsdl20:input>
+ <wsdl20:output>
+ <wsp:PolicyReference URI="#Policy56"></wsp:PolicyReference>
+ </wsdl20:output>
+ <wsdl20:outfault ref="tns:Fault-2">
+ <wsp:PolicyReference URI="#Policy57"></wsp:PolicyReference>
+ </wsdl20:outfault>
+ </wsdl20:operation>
+ </wsdl20:binding>
+
+ <wsdl20:service name="Service-1" interface="tns:Interface-1">
+ <wsp:PolicyReference URI="#Policy58"></wsp:PolicyReference>
+ <wsdl20:endpoint name="Endpoint-1A" binding="Binding-1A">
+ <wsp:PolicyReference URI="#Policy59"></wsp:PolicyReference>
+ </wsdl20:endpoint>
+ <wsdl20:endpoint name="Endpoint-1B" binding="Binding-1B">
+ <wsp:PolicyReference URI="#Policy60"></wsp:PolicyReference>
+ </wsdl20:endpoint>
+ </wsdl20:service>
+
+ <wsdl20:service name="Service-2" interface="tns:Interface-2">
+ <wsp:PolicyReference URI="#Policy61"></wsp:PolicyReference>
+ <wsdl20:endpoint name="Endpoint-2A" binding="Binding-2A">
+ <wsp:PolicyReference URI="#Policy62"></wsp:PolicyReference>
+ </wsdl20:endpoint>
+ <wsdl20:endpoint name="Endpoint-2B" binding="Binding-2A">
+ <wsp:PolicyReference URI="#Policy63"></wsp:PolicyReference>
+ </wsdl20:endpoint>
+ </wsdl20:service>
+
+</wsdl20:description>
diff --git a/neethi/test/policies/asymmetric_binding_policy.xml b/neethi/test/policies/asymmetric_binding_policy.xml
new file mode 100644
index 0000000..da136af
--- /dev/null
+++ b/neethi/test/policies/asymmetric_binding_policy.xml
@@ -0,0 +1,70 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256Rsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:EncryptSignature/>
+ <sp:EncryptBeforeSigning/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Always"/>
+ </wsp:Policy>
+ </sp:SignedSupportingTokens>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefEmbeddedToken/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ <sp:Header Namespace="http://www.w3.org/2005/08/addressing"/>
+ </sp:SignedParts>
+ <rampc:RampartConfig xmlns:rampc="http://ws.apache.org/rampart/c/policy">
+ <rampc:User>Alice</rampc:User>
+ <rampc:TimeToLive>360</rampc:TimeToLive>
+ <rampc:EncryptionUser>a</rampc:EncryptionUser>
+ <rampc:PasswordType>Digest</rampc:PasswordType>
+ <rampc:PasswordCallbackClass>AXIS2C_HOME/bin/samples/rampart/callback/libpwcb.so</rampc:PasswordCallbackClass>
+ <rampc:ReceiverCertificate>AXIS2C_HOME/bin/samples/rampart/keys/ahome/bob_cert.cert</rampc:ReceiverCertificate>
+ <rampc:Certificate>AXIS2C_HOME/bin/samples/rampart/keys/ahome/alice_cert.cert</rampc:Certificate>
+ <rampc:PrivateKey>AXIS2C_HOME/bin/samples/rampart/keys/ahome/alice_key.pem</rampc:PrivateKey>
+ </rampc:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/rm-1.0.xml b/neethi/test/policies/rm-1.0.xml
new file mode 100644
index 0000000..353e1ba
--- /dev/null
+++ b/neethi/test/policies/rm-1.0.xml
@@ -0,0 +1,21 @@
+<wsp:Policy wsu:Id="RmPolicy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsrm="http://schemas.xmlsoap.org/ws/2005/02/rm/policy" xmlns:sanc="http://ws.apache.org/sandesha2/c/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <wsrm:RMAssertion>
+ <wsrm:InactivityTimeout Milliseconds="600000"/>
+ <wsrm:AcknowledgementInterval Milliseconds="200"/>
+ <wsrm:BaseRetransmissionInterval Milliseconds="300"/>
+ <wsrm:ExponentialBackoff/>
+ <sanc:sandesha2_db>/tmp/sandesha2_db</sanc:sandesha2_db>
+ <sanc:InactivityTimeout>64</sanc:InactivityTimeout>
+ <sanc:StorageManager>persistent</sanc:StorageManager>
+ <sanc:MessageTypesToDrop>none</sanc:MessageTypesToDrop>
+ <sanc:MaxRetransCount>10</sanc:MaxRetransCount>
+ <sanc:SenderSleepTime>1</sanc:SenderSleepTime><!--In seconds-->
+ <sanc:InvokerSleepTime>1</sanc:InvokerSleepTime>
+ <sanc:PollingWaitTime>4</sanc:PollingWaitTime>
+ <sanc:TerminateDelay>4</sanc:TerminateDelay>
+ </wsrm:RMAssertion>
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/rm-1.1.xml b/neethi/test/policies/rm-1.1.xml
new file mode 100644
index 0000000..6c60dbc
--- /dev/null
+++ b/neethi/test/policies/rm-1.1.xml
@@ -0,0 +1,27 @@
+<wsp:Policy wsu:Id="RmPolicy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsrmp="http://docs.oasis-open.org/ws-rx/wsrmp/200702" xmlns:sanc="http://ws.apache.org/sandesha2/c/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <wsrmp:RMAssertion>
+ <wsp:Policy>
+ <wsrmp:DeliveryAssurance>
+ <wsp:Policy>
+ <wsrmp:ExactlyOnce/>
+ <wsrmp:InOrder/>
+ </wsp:Policy>
+ </wsrmp:DeliveryAssurance>
+ </wsp:Policy>
+ <sanc:InactivityTimeout>600000</sanc:InactivityTimeout>
+ <sanc:AcknowledgementInterval>200</sanc:AcknowledgementInterval>
+ <sanc:BaseRetransmissionInterval>300</sanc:BaseRetransmissionInterval>
+ <sanc:sandesha2_db>/tmp/sandesha2_db</sanc:sandesha2_db>
+ <sanc:StorageManager>persistent</sanc:StorageManager>
+ <sanc:MessageTypesToDrop>none</sanc:MessageTypesToDrop>
+ <sanc:MaxRetransCount>10</sanc:MaxRetransCount>
+ <sanc:SenderSleepTime>1</sanc:SenderSleepTime><!--In seconds-->
+ <sanc:InvokerSleepTime>1</sanc:InvokerSleepTime>
+ <sanc:PollingWaitTime>4</sanc:PollingWaitTime>
+ <sanc:TerminateDelay>4</sanc:TerminateDelay>
+ </wsrmp:RMAssertion>
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/policies/symmetric_binding_policy.xml b/neethi/test/policies/symmetric_binding_policy.xml
new file mode 100644
index 0000000..3db3ed8
--- /dev/null
+++ b/neethi/test/policies/symmetric_binding_policy.xml
@@ -0,0 +1,75 @@
+<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:ProtectionToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:RequireDerivedKeys/>
+ <sp:RequireThumbprintReference/>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:ProtectionToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:EncryptSignature/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:SymmetricBinding>
+ <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssUsernameToken10/>
+ </wsp:Policy>
+ </sp:UsernameToken>
+ </wsp:Policy>
+ </sp:SignedSupportingTokens>
+ <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ <sp:MustSupportRefThumbprint/>
+ <sp:MustSupportRefEncryptedKey/>
+ </wsp:Policy>
+ </sp:Wss11>
+ <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportIssuedTokens/>
+ <sp:RequireClientEntropy/>
+ <sp:RequireServerEntropy/>
+ </wsp:Policy>
+ </sp:Trust10>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ <sp:Header Namespace="http://www.w3.org/2005/08/addressing"/>
+ </sp:SignedParts>
+ <rampc:RampartConfig xmlns:rampc="http://ws.apache.org/rampart/c/policy">
+ <rampc:User>Alice</rampc:User>
+ <rampc:TimeToLive>360</rampc:TimeToLive>
+ <rampc:EncryptionUser>a</rampc:EncryptionUser>
+ <rampc:PasswordType>Digest</rampc:PasswordType>
+ <rampc:PasswordCallbackClass>AXIS2C_HOME/bin/samples/rampart/callback/libpwcb.so</rampc:PasswordCallbackClass>
+ <rampc:ReceiverCertificate>AXIS2C_HOME/bin/samples/rampart/keys/ahome/bob_cert.cert</rampc:ReceiverCertificate>
+ <rampc:Certificate>AXIS2C_HOME/bin/samples/rampart/keys/ahome/alice_cert.cert</rampc:Certificate>
+ <rampc:PrivateKey>AXIS2C_HOME/bin/samples/rampart/keys/ahome/alice_key.pem</rampc:PrivateKey>
+ </rampc:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
diff --git a/neethi/test/security_context_token/build.sh b/neethi/test/security_context_token/build.sh
new file mode 100644
index 0000000..6a5714d
--- /dev/null
+++ b/neethi/test/security_context_token/build.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+gcc security_context_token_test.c ../../../util/test/util/create_env.c -Werror -g -I$AXIS2C_HOME/include/axis2-1.2 -L$AXIS2C_HOME/lib -lneethi -laxutil -laxis2_axiom -laxis2_parser -o security_context_token
diff --git a/neethi/test/security_context_token/security_context_token_test.c b/neethi/test/security_context_token/security_context_token_test.c
new file mode 100644
index 0000000..6f320f3
--- /dev/null
+++ b/neethi/test/security_context_token/security_context_token_test.c
@@ -0,0 +1,54 @@
+#include <rp_security_context_token.h>
+#include "../../../util/test/util/create_env.h"
+
+axutil_env_t *env = NULL;
+rp_security_context_token_t * security_context_token = NULL;
+axis2_char_t * inclusion = NULL ;
+axis2_status_t status = AXIS2_FAILURE ;
+axis2_bool_t derivedkeys ;
+axis2_bool_t require_external_uri_ref;
+axis2_bool_t sc10_security_context_token;
+
+/** @brief test options
+ * build a om from a client options
+ */
+
+axis2_status_t test_security_context_token(axutil_env_t *env)
+{
+ security_context_token = rp_security_context_token_create(env);
+ inclusion = rp_security_context_token_get_inclusion(security_context_token,env);
+ printf("%s\n",inclusion);
+ status = rp_security_context_token_set_inclusion(security_context_token,env,inclusion);
+ if (status == AXIS2_SUCCESS)
+ printf("rp security context token set is success\n");
+ derivedkeys = rp_security_context_token_get_derivedkeys(security_context_token,env);
+ status = rp_security_context_token_set_derivedkeys(security_context_token,env,derivedkeys);
+ if (status == AXIS2_SUCCESS)
+ printf("rp security token derivedkeys set is success\n");
+ require_external_uri_ref = rp_security_context_token_get_require_external_uri_ref(security_context_token,env);
+ status = rp_security_context_token_set_require_external_uri_ref(security_context_token,env,require_external_uri_ref);
+ if (status == AXIS2_SUCCESS)
+ printf("rp security require external uri set is success\n");
+ sc10_security_context_token = rp_security_context_token_get_sc10_security_context_token(security_context_token,env);
+ status = rp_security_context_token_set_sc10_security_context_token(security_context_token,env,sc10_security_context_token);
+ if (status == AXIS2_SUCCESS)
+ printf("rp security sc10 security token set is success\n");
+ rp_security_context_token_increment_ref(security_context_token,env);
+ rp_security_context_token_free(security_context_token,env);
+ return AXIS2_SUCCESS;
+}
+int main()
+{
+ int status = AXIS2_SUCCESS;
+ env = create_environment();
+ status = test_security_context_token(env);
+ if(status == AXIS2_FAILURE)
+ {
+ printf(" test failed");
+ }
+ axutil_env_free(env);
+ return 0;
+}
+
+
+
diff --git a/neethi/test/test-policy.xml b/neethi/test/test-policy.xml
new file mode 100644
index 0000000..8e44f90
--- /dev/null
+++ b/neethi/test/test-policy.xml
@@ -0,0 +1,10 @@
+<wsp:Policy wsu:Id="Policy1">
+ <pa:Assertion1 marker="1"/>
+</wsp:Policy>
+ <wsp:Policy wsu:Id="Policy2">
+ <pa:Assertion2 marker="2"/>
+ </wsp:Policy>
+ <wsp:Policy wsu:Id="Policy3">
+ <pa:Assertion3 marker="3"/>
+ </wsp:Policy>
+
diff --git a/neethi/test/test-resources/different-level-policies.xml b/neethi/test/test-resources/different-level-policies.xml
new file mode 100644
index 0000000..de5a707
--- /dev/null
+++ b/neethi/test/test-resources/different-level-policies.xml
@@ -0,0 +1,109 @@
+<service name="sec_echo">
+ <parameter name="ServiceClass" locked="xsd:false">sec_echo</parameter>
+
+ <description>
+ This is a testing service , to test the system is working or not
+ </description>
+ <module ref="rampart"/>
+ <operation name="echoString">
+ <parameter name="wsamapping">http://example.com/ws/2004/09/policy/Test/EchoRequest</parameter>
+ <wsp:Policy wsu:Id="SigEncrMessage" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+ </wsp:Policy>
+ <!--message label="in">
+ <wsp:Policy wsu:Id="SigEncrMessage" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+ </wsp:Policy>
+ </message-->
+ <!--message label="out">
+ <wsp:Policy wsu:Id="SigEncrMessage" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+ </wsp:Policy>
+ </message-->
+ </operation>
+
+ <wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256Rsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <!--sp:EncryptSignature/-->
+ <!--sp:EncryptBeforeSigning/-->
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Always"/>
+ </wsp:Policy>
+ </sp:SignedSupportingTokens>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefEmbeddedToken/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <!--sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts-->
+ <!--sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts-->
+ <rampc:RampartConfig xmlns:rampc="http://ws.apache.org/rampart/c/policy">
+ <rampc:User>Bob</rampc:User>
+ <rampc:TimeToLive>360</rampc:TimeToLive>
+ <rampc:EncryptionUser>b</rampc:EncryptionUser>
+ <rampc:PasswordType>Digest</rampc:PasswordType>
+ <rampc:PasswordCallbackClass>/home/manjula/axis2/c/deploy/bin/samples/rampart/callback/libpwcb.so</rampc:PasswordCallbackClass>
+ <rampc:ReceiverCertificate>/home/manjula/axis2/c/deploy/bin/samples/rampart/keys/bhome/alice_cert.cert</rampc:ReceiverCertificate>
+ <rampc:Certificate>/home/manjula/axis2/c/deploy/bin/samples/rampart/keys/bhome/bob_cert.cert</rampc:Certificate>
+ <rampc:PrivateKey>/home/manjula/axis2/c/deploy/bin/samples/rampart/keys/bhome/bob_key.pem</rampc:PrivateKey>
+ </rampc:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+</service>
diff --git a/neethi/test/test-resources/echo-services.xml b/neethi/test/test-resources/echo-services.xml
new file mode 100644
index 0000000..c7fc88b
--- /dev/null
+++ b/neethi/test/test-resources/echo-services.xml
@@ -0,0 +1,115 @@
+<service name="echo">
+ <parameter name="ServiceClass" locked="xsd:false">echo</parameter>
+
+ <description>
+ This is a testing service , to test the system is working or not
+ </description>
+
+ <operation name="echoString">
+ <parameter name="wsamapping" >http://ws.apache.org/axis2/c/samples/echoString</parameter>
+ <wsp:Policy wsu:Id="SigEncrMessage" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+ </wsp:Policy>
+ <message label="in">
+ <wsp:Policy wsu:Id="SigEncrMessage" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+ </wsp:Policy>
+ </message>
+ <message label="out">
+ <wsp:Policy wsu:Id="SigEncrMessage" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+ </wsp:Policy>
+ </message>
+ </operation>
+
+ <wsp:Policy wsu:Id="SigEncr" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>alice</ramp:user>
+ <ramp:encryptionUser>bob</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.rampart.PWCallback</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ <ramp:encryptionCypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:encryptionCypto>
+ </ramp:RampartConfig>
+
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+
+</service>
diff --git a/neethi/test/test-resources/message-services-sc.xml b/neethi/test/test-resources/message-services-sc.xml
new file mode 100644
index 0000000..2f293df
--- /dev/null
+++ b/neethi/test/test-resources/message-services-sc.xml
@@ -0,0 +1,116 @@
+<service name="SecureService3">
+
+ <module ref="addressing"/>
+ <module ref="rampart"/>
+
+ <parameter locked="false" name="ServiceClass">org.apache.rampart.Service</parameter>
+
+ <operation name="echo">
+ <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ <actionMapping>urn:echo</actionMapping>
+ <wsp:Policy wsu:Id="SigEncrMessage" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+ </wsp:Policy>
+ <message label="in">
+ <wsp:Policy wsu:Id="SigEncrMessage" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+ </wsp:Policy>
+ </message>
+ <message label="out">
+ <wsp:Policy wsu:Id="SigEncrMessage" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+ </wsp:Policy>
+ </message>
+ </operation>
+
+ <wsp:Policy wsu:Id="SigEncr" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>alice</ramp:user>
+ <ramp:encryptionUser>bob</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.rampart.PWCallback</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ <ramp:encryptionCypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:encryptionCypto>
+ </ramp:RampartConfig>
+
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+
+</service>
diff --git a/neethi/test/test-resources/services-1.xml b/neethi/test/test-resources/services-1.xml
new file mode 100644
index 0000000..4c727d3
--- /dev/null
+++ b/neethi/test/test-resources/services-1.xml
@@ -0,0 +1,51 @@
+<service name="SecureService1">
+
+ <module ref="addressing"/>
+ <module ref="rampart"/>
+
+ <parameter locked="false" name="ServiceClass">org.apache.rampart.Service</parameter>
+
+ <operation name="echo">
+ <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ <actionMapping>urn:echo</actionMapping>
+ </operation>
+
+ <wsp:Policy wsu:Id="UTOverTransport" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:TransportToken>
+ <wsp:Policy>
+ <sp:HttpsToken RequireClientCertificate="false"/>
+ </wsp:Policy>
+ </sp:TransportToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Lax/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ </wsp:Policy>
+ </sp:TransportBinding>
+ <sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient" />
+ </wsp:Policy>
+ </sp:SignedSupportingTokens>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>alice</ramp:user>
+ <ramp:passwordCallbackClass>org.apache.rampart.PWCallback</ramp:passwordCallbackClass>
+ </ramp:RampartConfig>
+
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+
+</service>
diff --git a/neethi/test/test-resources/services-2.xml b/neethi/test/test-resources/services-2.xml
new file mode 100644
index 0000000..ec80dd5
--- /dev/null
+++ b/neethi/test/test-resources/services-2.xml
@@ -0,0 +1,76 @@
+<service name="SecureService2">
+
+ <module ref="addressing"/>
+ <module ref="rampart"/>
+
+ <parameter locked="false" name="ServiceClass">org.apache.rampart.Service</parameter>
+
+ <operation name="echo">
+ <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ <actionMapping>urn:echo</actionMapping>
+ </operation>
+
+ <wsp:Policy wsu:Id="SigOnly" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>alice</ramp:user>
+ <ramp:encryptionUser>bob</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.rampart.PWCallback</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ </ramp:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
+
+</service>
diff --git a/neethi/test/test-resources/services-3.xml b/neethi/test/test-resources/services-3.xml
new file mode 100644
index 0000000..3d1bf60
--- /dev/null
+++ b/neethi/test/test-resources/services-3.xml
@@ -0,0 +1,88 @@
+<service name="SecureService3">
+
+ <module ref="addressing"/>
+ <module ref="rampart"/>
+
+ <parameter locked="false" name="ServiceClass">org.apache.rampart.Service</parameter>
+
+ <operation name="echo">
+ <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ <actionMapping>urn:echo</actionMapping>
+ </operation>
+
+ <wsp:Policy wsu:Id="SigEncr" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>alice</ramp:user>
+ <ramp:encryptionUser>bob</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.rampart.PWCallback</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ <ramp:encryptionCypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:encryptionCypto>
+ </ramp:RampartConfig>
+
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+
+</service>
diff --git a/neethi/test/test-resources/services-4.xml b/neethi/test/test-resources/services-4.xml
new file mode 100644
index 0000000..537164f
--- /dev/null
+++ b/neethi/test/test-resources/services-4.xml
@@ -0,0 +1,89 @@
+<service name="SecureService4">
+
+ <module ref="addressing"/>
+ <module ref="rampart"/>
+
+ <parameter locked="false" name="ServiceClass">org.apache.rampart.Service</parameter>
+
+ <operation name="echo">
+ <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ <actionMapping>urn:echo</actionMapping>
+ </operation>
+
+<wsp:Policy wsu:Id="EncrSig" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:EncryptBeforeSigning />
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>alice</ramp:user>
+ <ramp:encryptionUser>bob</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.rampart.PWCallback</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ <ramp:encryptionCypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:encryptionCypto>
+ </ramp:RampartConfig>
+
+ </wsp:All>
+ </wsp:ExactlyOne>
+</wsp:Policy>
+
+</service>
diff --git a/neethi/test/test-resources/services-5.xml b/neethi/test/test-resources/services-5.xml
new file mode 100644
index 0000000..64fcecb
--- /dev/null
+++ b/neethi/test/test-resources/services-5.xml
@@ -0,0 +1,89 @@
+<service name="SecureService5">
+
+ <module ref="addressing"/>
+ <module ref="rampart"/>
+
+ <parameter locked="false" name="ServiceClass">org.apache.rampart.Service</parameter>
+
+ <operation name="echo">
+ <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ <actionMapping>urn:echo</actionMapping>
+ </operation>
+
+ <wsp:Policy wsu:Id="SigEncrDK" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:RequireDerivedKeys/>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:RequireDerivedKeys/>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>alice</ramp:user>
+ <ramp:encryptionUser>bob</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.rampart.PWCallback</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ <ramp:encryptionCypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:encryptionCypto>
+ </ramp:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+
+</service>
diff --git a/neethi/test/test-resources/services-6.xml b/neethi/test/test-resources/services-6.xml
new file mode 100644
index 0000000..ff37936
--- /dev/null
+++ b/neethi/test/test-resources/services-6.xml
@@ -0,0 +1,86 @@
+<service name="SecureService6">
+
+ <module ref="addressing"/>
+ <module ref="rampart"/>
+
+ <parameter locked="false" name="ServiceClass">org.apache.rampart.Service</parameter>
+
+ <operation name="echo">
+ <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ <actionMapping>urn:echo</actionMapping>
+ </operation>
+
+ <wsp:Policy wsu:Id="SigEncrTripleDesRSA15" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:TripleDesRsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>alice</ramp:user>
+ <ramp:encryptionUser>bob</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.rampart.PWCallback</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ <ramp:encryptionCypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:encryptionCypto>
+ </ramp:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+</service>
diff --git a/neethi/test/test-resources/services-7.xml b/neethi/test/test-resources/services-7.xml
new file mode 100644
index 0000000..b476623
--- /dev/null
+++ b/neethi/test/test-resources/services-7.xml
@@ -0,0 +1,89 @@
+<service name="SecureService7">
+
+ <module ref="addressing"/>
+ <module ref="rampart"/>
+
+ <parameter locked="false" name="ServiceClass">org.apache.rampart.Service</parameter>
+
+ <operation name="echo">
+ <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ <actionMapping>urn:echo</actionMapping>
+ </operation>
+
+ <wsp:Policy wsu:Id="SigEncrTripleDesRSA15DK" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:RequireDerivedKeys/>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:RequireDerivedKeys/>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:TripleDesRsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>alice</ramp:user>
+ <ramp:encryptionUser>bob</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.rampart.PWCallback</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ <ramp:encryptionCypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:encryptionCypto>
+ </ramp:RampartConfig>
+
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+</service>
diff --git a/neethi/test/test-resources/services-8.xml b/neethi/test/test-resources/services-8.xml
new file mode 100644
index 0000000..5e67653
--- /dev/null
+++ b/neethi/test/test-resources/services-8.xml
@@ -0,0 +1,89 @@
+<service name="SecureService8">
+
+ <module ref="addressing"/>
+ <module ref="rampart"/>
+
+ <parameter locked="false" name="ServiceClass">org.apache.rampart.Service</parameter>
+
+ <operation name="echo">
+ <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ <actionMapping>urn:echo</actionMapping>
+ </operation>
+
+ <wsp:Policy wsu:Id="SigEncrTripleDesRSA15DK" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:RequireDerivedKeys/>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:RequireDerivedKeys/>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:TripleDesRsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>alice</ramp:user>
+ <ramp:encryptionUser>useReqSigCert</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.rampart.PWCallback</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ <ramp:encryptionCypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:encryptionCypto>
+ </ramp:RampartConfig>
+
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+</service>
diff --git a/neethi/test/test-resources/services-9.xml b/neethi/test/test-resources/services-9.xml
new file mode 100644
index 0000000..fbf1eda
--- /dev/null
+++ b/neethi/test/test-resources/services-9.xml
@@ -0,0 +1,87 @@
+<service name="SecureService9">
+
+ <module ref="addressing"/>
+ <module ref="rampart"/>
+
+ <parameter locked="false" name="ServiceClass">org.apache.rampart.Service</parameter>
+
+ <operation name="echo">
+ <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ <actionMapping>urn:echo</actionMapping>
+ </operation>
+
+ <wsp:Policy wsu:Id="SigEncrTripleDesRSA15" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:TripleDesRsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:EncryptSignature />
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>alice</ramp:user>
+ <ramp:encryptionUser>bob</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.rampart.PWCallback</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ <ramp:encryptionCypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:encryptionCypto>
+ </ramp:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+</service>
diff --git a/neethi/test/test-resources/services-sc-1.xml b/neethi/test/test-resources/services-sc-1.xml
new file mode 100644
index 0000000..1bd254f
--- /dev/null
+++ b/neethi/test/test-resources/services-sc-1.xml
@@ -0,0 +1,176 @@
+<service name="SecureServiceSC1">
+
+ <module ref="addressing"/>
+ <module ref="rampart"/>
+ <module ref="rahas"/>
+
+ <parameter locked="false" name="ServiceClass">org.apache.rampart.Service</parameter>
+
+ <operation name="echo">
+ <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ <actionMapping>urn:echo</actionMapping>
+ </operation>
+
+ <wsp:Policy wsu:Id="SecConvPolicy1" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:ProtectionToken>
+ <wsp:Policy>
+ <sp:SecureConversationToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:RequireDerivedKeys/>
+ <sp:BootstrapPolicy>
+ <wsp:Policy wsu:Id="SigEncrTripleDesRSA15" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:InitiatorToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:InitiatorToken>
+ <sp:RecipientToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:RecipientToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:TripleDesRsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:AsymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:SignedParts>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+ </sp:BootstrapPolicy>
+ </wsp:Policy>
+ </sp:SecureConversationToken>
+ </wsp:Policy>
+ </sp:ProtectionToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic256/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Lax/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:EncryptSignature/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:SymmetricBinding>
+ <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ </wsp:Policy>
+ </sp:Wss10>
+ <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportIssuedTokens/>
+ <sp:RequireClientEntropy/>
+ <sp:RequireServerEntropy/>
+ </wsp:Policy>
+ </sp:Trust10>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>alice</ramp:user>
+ <ramp:encryptionUser>bob</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.rampart.PWCallback</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ <ramp:encryptionCypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:encryptionCypto>
+ </ramp:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+
+ <parameter name="sct-issuer-config">
+ <sct-issuer-config>
+ <cryptoProperties>
+ <crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</property>
+ <property name="org.apache.ws.security.crypto.merlin.file">sts.jks</property>
+ <property name="org.apache.ws.security.crypto.merlin.keystore.password">password</property>
+ </crypto>
+ </cryptoProperties>
+ <addRequestedAttachedRef />
+ <addRequestedUnattachedRef />
+
+ <!--
+ Key computation mechanism
+ 1 - Use Request Entropy
+ 2 - Provide Entropy
+ 3 - Use Own Key
+ -->
+ <keyComputation>3</keyComputation>
+
+ <!--
+ proofKeyType element is valid only if the keyComputation is set to 3
+ i.e. Use Own Key
+
+ Valid values are: EncryptedKey & BinarySecret
+ -->
+ <proofKeyType>BinarySecret</proofKeyType>
+ </sct-issuer-config>
+ </parameter>
+
+ <parameter name="token-canceler-config">
+ <token-canceler-config>
+ <!--<proofToken>EncryptedKey</proofToken>-->
+ <!--<cryptoProperties>sctIssuer.properties</cryptoProperties>-->
+ <!--<addRequestedAttachedRef />-->
+ </token-canceler-config>
+ </parameter>
+
+
+</service>
diff --git a/neethi/test/test-resources/services-sc-2.xml b/neethi/test/test-resources/services-sc-2.xml
new file mode 100644
index 0000000..2d0febe
--- /dev/null
+++ b/neethi/test/test-resources/services-sc-2.xml
@@ -0,0 +1,186 @@
+<service name="SecureServiceSC2">
+
+ <module ref="addressing"/>
+ <module ref="rampart"/>
+ <module ref="rahas"/>
+
+ <parameter locked="false" name="ServiceClass">org.apache.rampart.Service</parameter>
+
+ <operation name="echo">
+ <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+ <actionMapping>urn:echo</actionMapping>
+ </operation>
+
+ <wsp:Policy wsu:Id="SecConvPolicy2" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
+ <wsp:ExactlyOne>
+ <wsp:All>
+ <sp:SymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:ProtectionToken>
+ <wsp:Policy>
+ <sp:SecureConversationToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:RequireDerivedKeys/>
+ <sp:BootstrapPolicy>
+ <wsp:Policy>
+ <sp:EncryptedParts>
+ <sp:Body/>
+ </sp:EncryptedParts>
+ <sp:SymmetricBinding>
+ <wsp:Policy>
+ <sp:ProtectionToken>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never">
+ <wsp:Policy>
+ <sp:RequireDerivedKeys/>
+ <sp:RequireThumbprintReference/>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:ProtectionToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic128Rsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:EncryptSignature/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:SymmetricBinding>
+ <sp:EndorsingSupportingTokens>
+ <wsp:Policy>
+ <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
+ <wsp:Policy>
+ <sp:RequireThumbprintReference/>
+ <sp:WssX509V3Token10/>
+ </wsp:Policy>
+ </sp:X509Token>
+ </wsp:Policy>
+ </sp:EndorsingSupportingTokens>
+ <sp:Wss11>
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ <sp:MustSupportRefThumbprint/>
+ <sp:MustSupportRefEncryptedKey/>
+ <sp:RequireSignatureConfirmation/>
+ </wsp:Policy>
+ </sp:Wss11>
+ <sp:Trust10>
+ <wsp:Policy>
+ <sp:MustSupportIssuedTokens/>
+ <sp:RequireClientEntropy/>
+ <sp:RequireServerEntropy/>
+ </wsp:Policy>
+ </sp:Trust10>
+ </wsp:Policy>
+ </sp:BootstrapPolicy>
+ </wsp:Policy>
+ </sp:SecureConversationToken>
+ </wsp:Policy>
+ </sp:ProtectionToken>
+ <sp:AlgorithmSuite>
+ <wsp:Policy>
+ <sp:Basic128Rsa15/>
+ </wsp:Policy>
+ </sp:AlgorithmSuite>
+ <sp:Layout>
+ <wsp:Policy>
+ <sp:Strict/>
+ </wsp:Policy>
+ </sp:Layout>
+ <sp:IncludeTimestamp/>
+ <sp:EncryptSignature/>
+ <sp:OnlySignEntireHeadersAndBody/>
+ </wsp:Policy>
+ </sp:SymmetricBinding>
+ <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportRefKeyIdentifier/>
+ <sp:MustSupportRefIssuerSerial/>
+ <sp:MustSupportRefThumbprint/>
+ <sp:MustSupportRefEncryptedKey/>
+ </wsp:Policy>
+ </sp:Wss11>
+ <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <wsp:Policy>
+ <sp:MustSupportIssuedTokens/>
+ <sp:RequireClientEntropy/>
+ <sp:RequireServerEntropy/>
+ </wsp:Policy>
+ </sp:Trust10>
+ <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+ <sp:Body/>
+ </sp:EncryptedParts>
+ <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy">
+ <ramp:user>bob</ramp:user>
+ <ramp:encryptionUser>alice</ramp:encryptionUser>
+ <ramp:passwordCallbackClass>org.apache.rampart.PWCallback</ramp:passwordCallbackClass>
+
+ <ramp:signatureCrypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:signatureCrypto>
+ <ramp:encryptionCypto>
+ <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.file">store.jks</ramp:property>
+ <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property>
+ </ramp:crypto>
+ </ramp:encryptionCypto>
+
+ </ramp:RampartConfig>
+ </wsp:All>
+ </wsp:ExactlyOne>
+ </wsp:Policy>
+
+ <parameter name="sct-issuer-config">
+ <sct-issuer-config>
+ <cryptoProperties>
+ <crypto provider="org.apache.ws.security.components.crypto.Merlin">
+ <property name="org.apache.ws.security.crypto.merlin.keystore.type">JKS</property>
+ <property name="org.apache.ws.security.crypto.merlin.file">sts.jks</property>
+ <property name="org.apache.ws.security.crypto.merlin.keystore.password">password</property>
+ </crypto>
+ </cryptoProperties>
+ <addRequestedAttachedRef />
+ <addRequestedUnattachedRef />
+
+ <!--
+ Key computation mechanism
+ 1 - Use Request Entropy
+ 2 - Provide Entropy
+ 3 - Use Own Key
+ -->
+ <keyComputation>3</keyComputation>
+
+ <!--
+ proofKeyType element is valid only if the keyComputation is set to 3
+ i.e. Use Own Key
+
+ Valid values are: EncryptedKey & BinarySecret
+ -->
+ <proofKeyType>BinarySecret</proofKeyType>
+ </sct-issuer-config>
+ </parameter>
+
+ <parameter name="token-canceler-config">
+ <token-canceler-config>
+ <!--<proofToken>EncryptedKey</proofToken>-->
+ <!--<cryptoProperties>sctIssuer.properties</cryptoProperties>-->
+ <!--<addRequestedAttachedRef />-->
+ </token-canceler-config>
+ </parameter>
+
+
+</service>
diff --git a/neethi/test/test.c b/neethi/test/test.c
new file mode 100644
index 0000000..9585599
--- /dev/null
+++ b/neethi/test/test.c
@@ -0,0 +1,239 @@
+#include <axiom.h>
+#include <axutil_utils.h>
+#include <axutil_env.h>
+#include <axutil_log_default.h>
+#include <axutil_error_default.h>
+#include <stdio.h>
+#include <axiom_xml_reader.h>
+#include <neethi_engine.h>
+#include <axutil_array_list.h>
+
+axis2_status_t AXIS2_CALL om_node_serialize(
+ axiom_node_t * node,
+ const axutil_env_t * env);
+
+int
+main(
+ int argc,
+ char **argv)
+{
+ /*axutil_allocator_t *allocator = axutil_allocator_init(NULL);
+ axutil_error_t *error = axutil_error_create(allocator);
+ const axutil_env_t *env = axutil_env_create_with_error(allocator, error);*/
+ const axutil_env_t *env = NULL;
+ axiom_xml_reader_t *reader = NULL;
+ axiom_stax_builder_t *builder = NULL;
+ axiom_document_t *document = NULL;
+ axiom_node_t *root = NULL;
+ axiom_element_t *root_ele = NULL;
+
+ env = axutil_env_create_all("test.log", AXIS2_LOG_LEVEL_TRACE);
+
+ reader = axiom_xml_reader_create_for_file(env, argv[1], NULL);
+
+ if (!reader)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_CREATING_XML_STREAM_READER,
+ AXIS2_FAILURE);
+ printf("xml reader creation failed\n");
+ return 0;
+ }
+
+ builder = axiom_stax_builder_create(env, reader);
+ if (!builder)
+ {
+ axiom_xml_reader_free(reader, env);
+ printf("Builder creation failed\n");
+ return 0;
+ }
+ document = axiom_stax_builder_get_document(builder, env);
+ if (!document)
+ {
+ axiom_stax_builder_free(builder, env);
+ printf("Document creation failed\n");
+ return 0;
+ }
+
+ /*root = axiom_document_get_root_element(document, env); */
+ root = axiom_document_build_all(document, env);
+ if (!root)
+ {
+ axiom_stax_builder_free(builder, env);
+ return 0;
+ }
+
+ if (root)
+ {
+ if (axiom_node_get_node_type(root, env) == AXIOM_ELEMENT)
+ {
+ root_ele =
+ (axiom_element_t *) axiom_node_get_data_element(root, env);
+ if (root_ele)
+ {
+ neethi_policy_t *neethi_policy = NULL;
+ neethi_policy = neethi_engine_get_policy(env, root, root_ele);
+ if (!neethi_policy)
+ {
+ printf("Policy Creation fails\n");
+ return 0;
+ }
+
+ if(neethi_policy)
+ {
+ axis2_char_t *id = NULL;
+ axis2_char_t *name = NULL;
+
+ id = neethi_policy_get_id(neethi_policy, env);
+ if(id)
+ {
+ printf("Id is : %s\n", id);
+ }
+ name = neethi_policy_get_name(neethi_policy, env);
+ if(name)
+ {
+ printf("Name is : %s\n", name);
+ }
+ neethi_policy_free(neethi_policy, env);
+ neethi_policy = NULL;
+
+ printf("Successful \n");
+ }
+
+ /*else
+ {
+ axiom_node_t *s_node = NULL;
+ s_node = neethi_engine_serialize(neethi_policy, env);
+ if (!s_node)
+ {
+ printf("Serializing failed\n");
+ return 0;
+ }
+ if (om_node_serialize(s_node, env) != AXIS2_SUCCESS)
+ return 0;
+ }*/
+ }
+ }
+ }
+
+ if(builder)
+ {
+ axiom_stax_builder_free(builder, env);
+ builder = NULL;
+ }
+
+ axutil_env_free((axutil_env_t *)env);
+ env = NULL;
+
+ printf("Successful\n");
+ return 0;
+
+}
+
+axis2_status_t AXIS2_CALL
+om_node_serialize(
+ axiom_node_t * node,
+ const axutil_env_t * env)
+{
+
+ axiom_output_t *om_output = NULL;
+ axiom_xml_writer_t *writer = NULL;
+ axis2_char_t *output_buffer = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
+
+ writer = axiom_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0,
+ AXIS2_XML_PARSER_TYPE_BUFFER);
+ om_output = axiom_output_create(env, writer);
+
+ status = axiom_node_serialize(node, env, om_output);
+ if (status != AXIS2_SUCCESS)
+ {
+ printf("\naxiom_node_serialize failed\n");
+ return 0;
+ }
+ else
+ printf("\naxiom_node_serialize success\n");
+ /* end serializing stuff */
+
+ /*axiom_node_free_tree(node1, environment); */
+ output_buffer = (axis2_char_t *) axiom_xml_writer_get_xml(writer, env);
+
+ printf("\nend test_om_serialize\n");
+
+ return AXIS2_SUCCESS;
+
+}
+
+axutil_array_list_t *AXIS2_CALL
+load_policy_array(
+ int argc,
+ char **argv,
+ const axutil_env_t * env)
+{
+
+ axiom_xml_reader_t *reader = NULL;
+ axiom_stax_builder_t *builder = NULL;
+ axiom_document_t *document = NULL;
+ axiom_node_t *root = NULL;
+ axiom_element_t *root_ele = NULL;
+ int i = 0;
+ axutil_array_list_t *arraylist = NULL;
+
+ arraylist = axutil_array_list_create(env, 0);
+
+ for (i = 1; i < argc; i++)
+ {
+ reader = axiom_xml_reader_create_for_file(env, argv[i], NULL);
+
+ if (!reader)
+ {
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_CREATING_XML_STREAM_READER,
+ AXIS2_FAILURE);
+ printf("xml reader creation failed\n");
+ return NULL;
+ }
+
+ builder = axiom_stax_builder_create(env, reader);
+ if (!builder)
+ {
+ axiom_xml_reader_free(reader, env);
+ printf("Builder creation failed\n");
+ return NULL;
+ }
+ document = axiom_stax_builder_get_document(builder, env);
+ if (!document)
+ {
+ axiom_stax_builder_free(builder, env);
+ printf("Document creation failed\n");
+ return NULL;
+ }
+
+ /*root = axiom_document_get_root_element(document, env); */
+ root = axiom_document_build_all(document, env);
+ if (!root)
+ {
+ axiom_stax_builder_free(builder, env);
+ return NULL;
+ }
+ if (root)
+ {
+ if (axiom_node_get_node_type(root, env) == AXIOM_ELEMENT)
+ {
+ root_ele =
+ (axiom_element_t *) axiom_node_get_data_element(root, env);
+ if (root_ele)
+ {
+ neethi_policy_t *neethi_policy = NULL;
+ neethi_policy =
+ neethi_engine_get_policy(env, root, root_ele);
+ if (!neethi_policy)
+ {
+ printf("Policy Creation fails\n");
+ return NULL;
+ }
+ axutil_array_list_add(arraylist, env, neethi_policy);
+ }
+ }
+ }
+ }
+ return arraylist;
+}