aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/gv
AgeCommit message (Collapse)AuthorFilesLines
2019-05-28Integrate Sign.Verification and Improve Error Handling of PipelineChristof Rabensteiner12-77/+308
- Ensure proper communication of errors between pipeline and mzs service by converting MoaZSExceptions into DeliveryRequestStatus messages. - Revise MoaZSException: Add optional fields; those fields are a) helpful to construct meaningful error messages and b) optional because, depending on where an exception appears, either existent or non-existent and thus optional. Add inner-class Builder. - Integrate Signature Verification into pipeline and add Stub for SignatureVerification. - Move TNVZResponse's Mimetype check into dedicated class (Reason: separate abstration layers). - Update api changes in testcases.
2019-05-27Intercept Incoming DeliveryRequestStatus and Store as byte[]Christof Rabensteiner7-60/+237
- Add egovutils dependency (Reason: Need DomUtils to serialize / unserialize Soap Message via DOMParser) - Add Incerceptor to MsgClient / -Factory that stores the message content byte-by-byte in the DeliveryRepository. The format is required for successfully validating a DeliveryRequestStatus. - Add SoapUtils, which interacts with byte[] Soap message. - Add CXFMessageUtils, which interacts with CXF Messages from interceptor chains. - Refactor xsd namespaces: Move them out from the PrefixMapper and into a dedicated class.
2019-05-23Refactor: Cleanup CodesmellsChristof Rabensteiner4-9/+5
- Remove unused imports, commented code and copy-pasted code
2019-05-23MZS Schema Changes + Changes in InterfaceChristof Rabensteiner7-15/+129
- MZS cant reply with a msg:DeliveryRequestStatusType to a mzs:DeliveryRequest. Reason: unmarshalling a msg:DeliveryRequestStatusType with JAXB (after receiving the msg reply) breaks the signature in msg:DeliveryRequestStatusType. Why? Because JAXB marshalling tinkers with the namespaces and, as for the current state of knowledge, we cannot configure the JAXB marshaller to reconstruct a XML Document byte-by-byte such that a signature that went through this process can be verified successfully (see [1]). - For this reason, we revert back to mzs:DeliveryResponse and add new fields / remove obsolete fields / capture all changes between zusemsg 1.5.3 and zusemsg 2.0.0. - The easier solution would be to wrap and transmit signed data + signature in a binary (base64) container, such that apache cxf and other web service frameworks won't unmarshall them. This doesnt work because zusemsg 2.0.0 is final. app2mzs.xsd Changes in Detail : - Add DeliverySystem, ZSDeliveryID and GZ to MessageType (MessageType is the base type of DeliveryResponse.Success, -PartialSuccess, and -Error); Reason: It was added to zusemsg 2.0.0. - Add SignedDeliveryRequestStatus to MessageType. Reason: If msg returns signed reply, this element contains the reply as byte[] such that the signature does not break. - Add optional PreadvicenoteSend to ErrorType (because it was added in zusemsg 2.0.0) - Remove MZSDeliveryID from every instance because this ID does not exist anymore (moa zs does not maintain requests in a database). - Remove DocumentReference from ErrorType as it was removed from zusemsg 2.0.0. - Remove DeliveryConfirmation as node in DeliveryNotificiationType because it does not exist anymore in zusemsg 2.0.0; DeliveryConfirmation is also obsolete because all msg' replies are signed and need to be transferred to the sender application as a byte[], which is done by SignedDeliveryRequestStatus node in MessageType. - Remove DeliveryStatement as node in DeliveryNotificiationType because it does not exist anymore in zusemsg 2.0.0. Other Changes - Adapt codebase: MzsService returns mzs:DeliveryResponse. - Implement conversion from msg:DeliveryRequestStatus to mzs:DeliveryResponse. - Add store / retrieve interface to DeliveryRepository that stores signed delivery request statuses as byte[]. Temporary Changes - Disable integration tests which have external dependencies. [1] https://download.oracle.com/javaee-archive/jaxb.java.net/users/2007/03/6674.html Signed-off-by: Christof Rabensteiner <christof.rabensteiner@iaik.tugraz.at>
2019-05-21WIP: SSL Client AuthChristof Rabensteiner3-11/+67
- Refactor MsgClient: Not a Singleton anymore. Use MsgClientFactory to make a client. Make request and config private fields. - Add configuration parameters to application.yaml. - Init SSL client auth testcase, but dont include in testsuite because it aint working yet.
2019-05-20Add Testcase for MsgClientChristof Rabensteiner1-1/+0
2019-05-16Refactor + Document in preprocessChristof Rabensteiner3-28/+30
- Refactor: Move ConfigType.merge's null check to caller. - Revise documentation of preprocess' public methods.
2019-05-16Document Method in ConfigUtilChristof Rabensteiner1-1/+1
2019-05-16Refactor: Merge Converter, Validator, and Merger into UtilChristof Rabensteiner7-137/+114
- Reason: All three classes opertate with the same data type, have the same clients, and have the same reasons for change. - Makes code in client more readable as it reduces number of dependencies.
2019-05-16Refactor and Test ConfigProfileGeneratorChristof Rabensteiner5-81/+192
Refactor - Add Builder to ConfigProfileGenerator. Reason: Constructor had too many arguments. - Move Conversion from Map to Config from ConfigProfileGenerator into dedicated 'ConvertMapToConfig' Class; Reason: I expect additional configuration properties and I don't want those changes to affect the ConfigProfileGenerator (or it's test cases) - Move Access to Spring's env into facade to simplify ConfigProfileGenerator.
2019-05-15Move Services / Clients To Dedicated PackagesChristof Rabensteiner4-15/+16
2019-05-15Handle Config Related Edge Cases in Augmenter & ProfileGeneratorChristof Rabensteiner5-23/+113
ConfigProfileGenerator: - Cancel startup if default Config profile is incomplete. - Add property flag 'verify-completeness-of-default-delivery-request-configuration', which allows admin to disable completeness check. In that case, just log a warning if the default profile is incomplete. Augmenter: - Ensure that after merging the config is complete (or throw an exception otherwise). - Refactor: Move ConfigProfileValidator from ConfigProfileGenerator to dedicated "ConfigProfileValidator" class; Reason: Augmenter needs to check completness of at-runtime-compiled configuration. - Refactor: Rewrote code for better readability. Others - NPE Fix in ConfigProfileMerger: If FallbackConfigProfile/Server is empty, use PrimaryProfile/Server.
2019-05-15Refactor ConfigProfileGeneratorChristof Rabensteiner1-16/+29
- Add Source for Code Snippet. - Break down generate() into smaller chunks.
2019-05-15Integrate Config Profiles + RefactoringChristof Rabensteiner3-52/+90
Config Profile Integration: - Merge generated Configs from ConfigProfileGenerator with the default Config; Reason: Merging profile Configs with default Config asap ensures that profile Configs are "as complete as possible" while allowing profile Configs to "on-demand"-override values from the default Config. - Adapt Augmenter to work with Config profiles: Select a Config on the basis of on msg:DeliveryRequest/Config/ProfileId, fall back to 'default' Config. - Schema change: Make ProfileID optional. Refactoring: - Move Config-merging code from Augmenter into dedicated 'ConfigProfileMerger' class. - ConfigProfileGenerator: Clarify stream pipeline and comply with coding standard w.r.t. constant members. - Add Augmenter test cases for profile selection.
2019-05-15WIP: Generate Map of Config Profiles from Spring EnvironmentChristof Rabensteiner4-23/+101
Augmenter - Replace default Config Profile with map of Config Profiles. Now, Augmenter can choose a config profile at runtime and augment it. - Move Augmenter to sub package. WIP - Implement ConfigProfileGenerator, which retrieves Config profiles from Spring Environment and returns an easy-to-use map with profiles that is keyed with profile id's. - Replace application.properties with application.yaml. - Remove Augmenter test cases: They need to be adapted.
2019-05-14Minor Fixes: Remove Unused Imports; Fix of Error Message; Add TODOChristof Rabensteiner1-1/+2
2019-05-14Implement Per-Field-Overriding of Configuration in AugmenterChristof Rabensteiner6-33/+102
- Rewrite DeliveryRequestAugmenter to allow per-field-overriding of configuration parameters and add test suite. - Mzs schema change: Move DeliveryRequest/Server into DeliveryRequest/Config; Reason: DeliveryRequest/Config contains all parameters exclusively needed by moazs to execute the delivery request. The msg's server url belongs to this set of parameters. - WIP: Add prototype implementation of MsgClient and move MsgClient to dedicated package. - Refactor: move TnvzClient to dedicated package.
2019-05-13Add Unit Tests for DeliveryPipelineChristof Rabensteiner2-7/+8
- Refactor: Move TnvzClient in sub package - Autowire all parameters instead of each parameter individually
2019-05-13Refactor: Throw UnsupportedOperationEx For `Yet To Implement` ClientChristof Rabensteiner1-1/+1
2019-05-13Refactor RedisConfig: Use Diamond OperatorChristof Rabensteiner1-4/+1
2019-05-13Refactor MarshallerChristof Rabensteiner1-4/+4
- Rename jaxbmarshaller field to prevent confusion with class name.
2019-05-13Refactor and Format Fixes in Mzs2MsgConverterChristof Rabensteiner1-3/+3
- Fix: Replace MessageFormat.format with String.format - Refactor: Use Method Reference - Add Todo Item
2019-05-13Refactor RedisDeliveryRepositoryChristof Rabensteiner1-5/+5
- Use correct marshaller bean (mzsMarshaller). - Replace RuntimeException with MoaZSException. - Remove pointless cast.
2019-05-13Refactor: Make NullCoalesce Non-InstantiableChristof Rabensteiner1-1/+3
2019-05-13Refactor and Format Fixes in PipelineChristof Rabensteiner1-10/+9
- Fix: Replace MessageFormat.format with String.format - Refactor: Replace RuntimeException with MoaZSException - Refactor: Use Method Reference
2019-05-13Refactor: Remove Unused MembersChristof Rabensteiner1-12/+2
2019-05-13Refactor: Remove Unused ImportsChristof Rabensteiner1-5/+0
2019-05-13Refactor + Fix: Replace MessageFormat.format with String.formatChristof Rabensteiner1-4/+3
- Reason: Using MessageFormat.format and String.format via static imports (meaning: code only contains `format()`) is confusing. - Format String Fix: Switch from argument position (`{0}`) to argument type specifies (`%s`).
2019-05-13Refactor: Remove 'throws RuntimeException' From SignatureChristof Rabensteiner1-1/+1
- Why was it there to begin with?
2019-05-13Refactor: Autowire All Parameters Once Instead of IndividuallyChristof Rabensteiner1-2/+3
2019-05-10Refactor Exception Handling in App2MzsChristof Rabensteiner2-5/+23
- Define dedicated runtime exception - Put AppDeliveryId in exception message
2019-05-10Refactor: Eliminate Non-Compliant HashMap InitializationChristof Rabensteiner1-8/+8
2019-05-10Refactor: Rename DeliveryPreprocessor to AugmenterChristof Rabensteiner2-14/+9
- Reason: Preprocessor does not perform any validation anymore!
2019-05-10Remove TargetNamespace Declaration in App2MzsServiceChristof Rabensteiner1-4/+1
2019-05-10Fix Hardcoded WSDL locationsChristof Rabensteiner1-2/+7
2019-05-09Reactivate and Fix Unit TestsChristof Rabensteiner1-1/+1
- Relax Validation for now by only validating incoming requests.
2019-05-09Fix: Enable ApacheCXF's Automated Schema ValidationChristof Rabensteiner3-42/+14
Problem: Apache CXF does not validate incoming mzs:DeliveryRequests automatically. Per default, validation is off (performs better). However, (1) we need to validate incoming requests, and (2) automated CXF validation requires less maintenance and is expected to be more stable than manual validation. Solution: - Add @SchemaValidation annotation to @Service. - Endpoint Configuration: set WsdlLocation and ServiceName (needed to prevent parser errors; see [1]). Without those, CXF validates against generated classes and not against the WSDL spec, and generated classes do not contain format restrictions. Add a testcase with an invalid delivery request ("rejectBothProfile- AndCorporateBody") to ensure that the validator works. [1] https://stackoverflow.com/questions/2231779/cxf-and-validation-schema-restrictions-ignored
2019-05-08WIP delivery request validationChristof Rabensteiner2-11/+42
2019-05-08Refactor: Consolidate Schema-Related ComponentsChristof Rabensteiner6-8/+7
2019-05-08Fix Namespace Prefixes in Marshaled Messages (msg: instead of ns#:)Christof Rabensteiner3-10/+106
- Implement own NamespacePrefixMapper that maps prefixes depending on whether a msg or a mzs object is being marshaled. - Namespaces are not hardcoded but extracted from jaxb's generated sources (somewhat indirect, can be considered a hack, but there's no public API to extract namespaces)
2019-05-08Implement Pipeline Flow and mzs2msg ConversionChristof Rabensteiner4-11/+420
- Implement and test conversion from mzs:DeliveryRequest to msg:DeliveryRequest with the "convert-pojos-by-hand"-strategy. Reason: The chosen strategy benefits from JAXB's strong typing, which is useful in this scenario: Differences between msg and mzs are nuanced and easy to overlook. The chosen strategy is, unfortunately, verbose and could become expensive to maintain. - Update SameThreadDeliveryPipeline: Integrate tnvz query, conversion, and msg query. - Add MsgClient stub. tnvz: - Change TnvzClient stub interface. - Implement mimetype mismatch check from tnvz Response. - Put p:Identification from tnvz response into msg:DeliveryRequest. MZS Schema changes: - Replace DeliveryRequest/Sender/Person with CorporateBody (because thats the only sender that is allowed by zusemsg) and add a SenderProfile choice. - Add ID Attribute to DeliveryRequest/Sender because msg/DeliveryRequest/Sender/AbstractSenderPersonType also has an id attribute. - Remove PersonDataType because it's dead code.
2019-05-06WIP tnvz integrationChristof Rabensteiner2-2/+3
2019-05-06Change Package Namespaces of JAXB Generated SourcesChristof Rabensteiner9-30/+25
- Reason: Improves readability and makes import statetemens shorter and more consistent
2019-04-30Generate SoapFault instead of DRStatus/Error MessageChristof Rabensteiner1-22/+7
- App2MZS Server: Instead of generating a DeliveryRequestStatus/Error Message, we throw an exception. This will generate a SoapFault (including a 500 http status code), which is more appropriate. - Fix possible NPE of deliveryRequest.getMetadata().getAppDeliveryID() by moving appDeliveryID initialization into the TimeOutException catch block - pom.xml: Remove hamcrest dependency, as not needed for now.
2019-04-30Refactor: Reduce Vertical Space Bewteen Method Def. and Invoc.Christof Rabensteiner1-13/+13
2019-04-30Add Optional mzs:DeliveryRequest/Config & Validate / Augment ItChristof Rabensteiner5-35/+84
Add Optional "Config" to MZS Schema: - Add mzs:DeliveryRequest/Config Element with a "PerformQueryPersonRequest" node - The config element contains parameters that are interpreted by moa-zs and not forwarded to the ZD - The boolean PerformQueryPersonRequest tells moa-zs if moa-zs should perform a QueryPersonRequest towards the TNVZ. - If config is missing, moa-zs augments the delivery request with parameters from the app's configuartion or the default configuartion Other Changes: - Validate and augment incoming requests with the DeliveryPreprocessor. - Add stub for TlnvzClient. - Remove some leftover ObjectFactory imports (because of the builder they are not needed anymore) Fixes - Fixed incorrect API usage of Messageformat.format: format string needs an index. pom.xml - Add Hamcrest Dependency (for writing more expressive tests) - Add copy constructor to JAXB Builder Testing - Test validation of incoming request - Refactor testcases to improve readability
2019-04-29Make JAXB Objects Immutable and Add Builder UtilityChristof Rabensteiner1-19/+24
- Use Immutable-XJC from https://github.com/sabomichal/immutable-xjc - Update existing JAXB-object manipulations to use the Builder - Remove jaxbMarshallerTest (as it relies on mutable JAXB interfaces) Reason for making JAXB objects immutable: I put JAXB objects in the repository. Depending on the configuration, the repository can be a simple hashmap; in that case I might end up sharing JAXB objects between threads. Immutable shared object should make life a little simpler.
2019-04-29Document DeliveryPipeline InterfaceChristof Rabensteiner1-1/+6
2019-04-18Mock Pipeline in App2MzsServiceTestsChristof Rabensteiner1-12/+1
- Reason: App2MzsServiceTests only run through the app2mzs front end without doing any pipeline work.
2019-04-18Change App2mzs Interface and Init Delivery PipelineChristof Rabensteiner9-77/+198
- Change app2mzs interface: output message from app2mzs:DeliveryRequest was app2mzs:DeliveryResponse, now its msg:DeliveryRequestStatus. Reason: ZD returns msg:DeliveryRequestStatus which is signed. Moazs does not convert msg:DeliveryRequestStatus into app2mzs:DeliveryResponse because the conversion woudl break the signature. - App2MzsService: Make beans final and inject them with constructor; Refactor DeliveryRequestHandler into App2MZSService. - DeliveryPipeline: Add Interface and a "SameThreadImplementation" that executes the pipeline in the same threat and can be used in single mode. - DeliveryRepository: Augment interface for storing and retrieving request status objects; Add in-memory-implementation for status objects. - Utils: Add helper function for coalescing multiple values