├── .gitignore ├── .ort.yml ├── 3RD-PARTY-NOTICES.txt ├── CHANGELOG.md ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── MoU-Ansip-Katainen.md ├── README.md ├── adapter ├── Dockerfile ├── build.gradle.kts ├── config │ └── checkstyle │ │ ├── checkstyle-config.xml │ │ └── suppressions.xml ├── eclipse.importorder ├── gradle │ ├── libs.versions.toml │ └── wrapper │ │ ├── dists │ │ ├── CACHEDIR.TAG │ │ ├── gradle-8.10.2-bin │ │ │ └── a04bxjujx95o3nb99gddekhwo │ │ │ │ ├── gradle-8.10.2-bin.zip.lck │ │ │ │ ├── gradle-8.10.2-bin.zip.ok │ │ │ │ └── gradle-8.10.2 │ │ │ │ ├── LICENSE │ │ │ │ ├── NOTICE │ │ │ │ ├── README │ │ │ │ ├── bin │ │ │ │ ├── gradle │ │ │ │ └── gradle.bat │ │ │ │ └── init.d │ │ │ │ └── readme.txt │ │ └── gradle-8.13-bin │ │ │ └── 5xuhj0ry160q40clulazy9h7d │ │ │ ├── gradle-8.13-bin.zip.lck │ │ │ ├── gradle-8.13-bin.zip.ok │ │ │ └── gradle-8.13 │ │ │ ├── LICENSE │ │ │ ├── NOTICE │ │ │ ├── README │ │ │ ├── bin │ │ │ ├── gradle │ │ │ └── gradle.bat │ │ │ └── init.d │ │ │ └── readme.txt │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle.kts └── src │ ├── main │ ├── filters │ │ └── default.properties │ ├── java │ │ └── org │ │ │ └── niis │ │ │ └── xroad │ │ │ └── restadapterservice │ │ │ ├── Application.java │ │ │ ├── ConsumerGateway.java │ │ │ ├── IndexController.java │ │ │ ├── ProviderGateway.java │ │ │ ├── endpoint │ │ │ ├── AbstractEndpoint.java │ │ │ ├── ConsumerEndpoint.java │ │ │ └── ProviderEndpoint.java │ │ │ ├── filter │ │ │ └── ConsumerURIFilter.java │ │ │ └── util │ │ │ ├── Constants.java │ │ │ ├── ConsumerGatewayUtil.java │ │ │ ├── ProviderGatewayUtil.java │ │ │ └── RESTGatewayUtil.java │ ├── packages │ │ ├── config │ │ │ └── application.properties │ │ ├── docker │ │ │ └── Dockerfile │ │ └── systemd │ │ │ ├── preinstall │ │ │ ├── rest-adapter-service │ │ │ └── rest-adapter-service.service │ ├── profiles │ │ ├── encrypted │ │ │ ├── consumer-gateway.properties │ │ │ ├── consumers.properties │ │ │ ├── provider-gateway.properties │ │ │ └── providers.properties │ │ └── plaintext │ │ │ ├── consumer-gateway.properties │ │ │ ├── consumers.properties │ │ │ ├── provider-gateway.properties │ │ │ └── providers.properties │ ├── resources-bin │ │ ├── consumer.cer │ │ ├── consumerkeystore.jks │ │ ├── consumertruststore.jks │ │ ├── producertruststore.jks │ │ ├── provider.cer │ │ └── providerkeystore.jks │ ├── resources │ │ ├── application.properties │ │ ├── provider-gateway.wsdl │ │ └── templates │ │ │ └── index.html │ └── webapp │ │ └── META-INF │ │ └── context.xml │ └── test │ ├── filters │ └── integration-test.properties │ ├── java │ └── org │ │ └── niis │ │ └── xroad │ │ └── restadapterservice │ │ ├── ConsumerAndProviderTest.java │ │ ├── ConsumerGatewayIT.java │ │ ├── ConsumerGatewayWireMockTest.java │ │ └── util │ │ ├── ConsumerGatewayUtilTest.java │ │ ├── ProviderGatewayUtilTest.java │ │ └── RESTGatewayUtilTest.java │ └── resources │ ├── application-test-keys │ ├── README.md │ ├── consumer.cer │ ├── consumerkeystore.jks │ ├── consumertruststore.jks │ ├── provider.cer │ ├── providerkeystore.jks │ └── providertruststore.jks │ ├── application-test-properties │ ├── README.md │ ├── consumer-gateway.properties │ ├── consumers.properties │ ├── provider-gateway.properties │ └── providers.properties │ ├── consumer-IT-expected-response.json │ ├── consumer-IT-expected-response.xml │ ├── consumer-gw-test-request-expected.xml │ ├── consumer-gw-test-request.json │ ├── consumer-gw-test-response-expected.json │ ├── consumer-gw-test-response.xml │ └── rest-service-response.json ├── documentation ├── CRUD-API-Configuration.md ├── Configuring-Rest-Adapter-Service-provider.md ├── Encryption.md ├── Import-a-Certificate-as-a-Trusted-Certificate.md ├── Requirements.md ├── Rest-Adapter-Service-principles.md ├── Setting-up-Development-Environment.md └── Setting-up-SSL-on-Tomcat [deprecated].md ├── images ├── default_configuration-rest-gateway-0.0.4.png ├── message-sequence_rest-gateway-0.0.4.png ├── provider_call-rest-gateway-0.0.4.png └── restgw-use-cases.png └── templates └── cloudformation ├── README.md └── ec2-rest-adapter-service.yaml /.gitignore: -------------------------------------------------------------------------------- 1 | *.class 2 | 3 | # Netbeans 4 | nbactions.xml 5 | 6 | # Mobile Tools for Java (J2ME) 7 | .mtj.tmp/ 8 | 9 | # Package Files # 10 | *.jar 11 | *.war 12 | *.ear 13 | 14 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 15 | hs_err_pid* 16 | 17 | # ========================= 18 | # Operating System Files 19 | # ========================= 20 | 21 | # OSX 22 | # ========================= 23 | 24 | .DS_Store 25 | .AppleDouble 26 | .LSOverride 27 | 28 | # Icon must ends with two \r. 29 | Icon 30 | 31 | 32 | # Thumbnails 33 | ._* 34 | 35 | # Files that might appear on external disk 36 | .Spotlight-V100 37 | .Trashes 38 | 39 | # Windows 40 | # ========================= 41 | 42 | # Windows image file caches 43 | Thumbs.db 44 | ehthumbs.db 45 | 46 | # VS Code 47 | .vscode/ 48 | 49 | # Intellij IDEA 50 | **/*.idea 51 | **/*.iml 52 | 53 | # Folder config file 54 | Desktop.ini 55 | 56 | # Recycle Bin used on file shares 57 | $RECYCLE.BIN/ 58 | 59 | # Windows Installer files 60 | *.cab 61 | *.msi 62 | *.msm 63 | *.msp 64 | 65 | # build 66 | build/ 67 | adapter/bin 68 | 69 | #Gradle 70 | adapter/.gradle 71 | adapter/gradle/.tmp 72 | adapter/gradle/caches 73 | adapter/gradle/daemon 74 | adapter/gradle/native 75 | -------------------------------------------------------------------------------- /.ort.yml: -------------------------------------------------------------------------------- 1 | --- 2 | excludes: 3 | paths: 4 | - pattern: "3RD-PARTY-NOTICES.txt" 5 | reason: "OTHER" 6 | comment: "File including 3rd party license notices." 7 | 8 | - pattern: "images/**" 9 | reason: "DOCUMENTATION_OF" 10 | comment: "This directory contains images that are not distributed." 11 | 12 | - pattern: "documentation/**" 13 | reason: "DOCUMENTATION_OF" 14 | comment: "This directory contains documentation that's not distributed." 15 | 16 | scopes: 17 | - pattern: "checkstyle" 18 | reason: "BUILD_DEPENDENCY_OF" 19 | comment: "Packages for code styling checks (testing) only." 20 | 21 | - pattern: "devDependencies" 22 | reason: "DEV_DEPENDENCY_OF" 23 | comment: "Packages for development only." 24 | 25 | - pattern: "jacocoAgent" 26 | reason: "TEST_DEPENDENCY_OF" 27 | comment: "Packages for code coverage (testing) only." 28 | 29 | - pattern: "jacocoAnt" 30 | reason: "TEST_DEPENDENCY_OF" 31 | comment: "Packages for code coverage (testing) only." 32 | 33 | - pattern: "test.*" 34 | reason: "TEST_DEPENDENCY_OF" 35 | comment: "Packages for testing only." 36 | 37 | - pattern: "annotationProcessor" 38 | reason: "DEV_DEPENDENCY_OF" 39 | comment: "Packages for development only." 40 | 41 | - pattern: "compileClasspath" 42 | reason: "DEV_DEPENDENCY_OF" 43 | comment: "Packages for development only." 44 | 45 | - pattern: "compileOnly" 46 | reason: "DEV_DEPENDENCY_OF" 47 | comment: "Packages for development only." 48 | 49 | resolutions: 50 | rule_violations: 51 | - message: "commercial license LicenseRef-scancode-proprietary-license in Maven:org.aspectj:aspectjweaver:1.9.6." 52 | reason: "LICENSE_ACQUIRED_EXCEPTION" 53 | comment: "These files are used as per the license terms and therefore license is acquired, that is used within Python, compiled Python, or other languages (such as C) wherein the modified or derived code is exclusively imported into a Python module." 54 | 55 | - message: "proprietary-free license LicenseRef-scancode-efsl-1.0 in Maven:jakarta.annotation:jakarta.annotation-api:1.3.5." 56 | reason: "LICENSE_ACQUIRED_EXCEPTION" 57 | comment: "These specification files, to the extent used, are not modified and therefore used as per the license." 58 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## 1.1.0-SNAPSHOT 2021-09-17 4 | - Add 3rd party notices 5 | 6 | ## 1.1.0-SNAPSHOT 2020-09-14 7 | - XRDDEV-1347 Update dependencies, migrate from Spring Boot 1.x to 2.x, and from Tomcat 8 to 9 8 | 9 | ## 1.0.0 2018-07-07 10 | - XRDDEV-91 Fix checkstyle and sonar issues, update hoverfly simulation 11 | - XRDDEV-89 Change xrd4j from snapshot to release 12 | - XRDDEV-45 Change copyright owner from VRK to NIIS and artifact package names from `fi.vrk.xroad.restadapterservice` to `org.niis.xroad.restadapterservice`. 13 | - XRDDEV-38 Change xrd4j dependency from fi.vrk.xr4j to org.niis.xrd4j 14 | - XRDDEV-38 Change Maven download URL to one that does not stop working when new versions are released 15 | - XRDDEV-81 Change integration tests to be more tolerant against changes to external APIs. Add possibility to integration test against Hoverfly simulation. 16 | 17 | ## 0.0.13 2018-02-23 18 | - PVAYLADEV-1059 Add checkstyle and sonar checks and fix reported problems 19 | - Added new folder for templates and an example AWS CloudFormation template for testing REST Adapter Service. 20 | - PVAYLADEV-1001 Improved Rest Adapter Service documentation in relation to Docker. 21 | - PVAYLADEV-943 Added instructions for obtaining war package from a package repository. 22 | - PVAYLADEV-1013 Fixed a potential security problem, convertPost = true in combination with encrypted = true did leave converted message unencrypted in the message body. 23 | - PVAYLADEV-940 Changed into a Spring Boot application. Installation package no longer installs a standalone Tomcat server. Instead the Adapter is run as a self contained Java application, with an embedded web container. Added packaging for Debian with Systemd init system (= e.g. Ubuntu 16). 24 | 25 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## How to contribute to REST Adapter Service? 2 | 3 | We are glad you want to contribute to development of REST Adapter Service! 4 | 5 | Please read the following instructions for ease the work needed for the collaboration process. 6 | 7 | ## Submitting work 8 | 9 | Please send a GitHub Pull Request to REST Adapter Service with a clear list of what you've done. When you send a pull request, it is strongly recommended to make sure all of your commits are atomic (one feature per commit). 10 | 11 | Please write a clear log message for your commits. One-line messages are fine for small changes, but bigger changes should look like this: 12 | 13 | ``` 14 | $ git commit -m "A short summary of the commit 15 | > 16 | > A paragraph describing what changed and its impact." 17 | ``` 18 | 19 | 20 | The pull requests are reviewed by the REST Adapter core development team and possible other selected representatives related to development of REST Adapter Service. Additional reviewers can be added as necessary. The pull request is reviewed according to the acceptance criteria (see below sections). 21 | 22 | ##Accepting work and acceptance criteria 23 | 24 | ### 1. Feature analysis 25 | 26 | Are the features OK to be accepted to the core of REST Adapter Service? 27 | 28 | ### 2. Source code 29 | 30 | Is the source code for the software and its dependencies available? 31 | 32 | ### 3. CI build & tests 33 | 34 | No merge conflicts? 35 | Does the build and the test cases work? 36 | Does the packaging work (Ubuntu & RHEL)? 37 | Can the software be installed on a clean system (Ubuntu & RHEL)? 38 | Can the software version be upgraded from the previous REST Adapter Service version? 39 | 40 | ### 4. [SonarQube](https://www.sonarqube.org/) static analysis 41 | 42 | SonarQube shows no bugs or code smells of severity blocker or critical? The developer has a chance to comment the issues before accept/reject action. 43 | 44 | ### 5. [Checkstyle](http://checkstyle.sourceforge.net/) for coding rules 45 | 46 | Checkstyle is used for checking the coding rules and it help programmers to write Java code that adheres to a coding standard. 47 | 48 | Below coding style rules must be followed: 49 | 50 | * use spaces, no tabs 51 | * 4-space indents 52 | * but a 8-space continuation after a wrapped line (to make the next statement stand out, e.g. the body in long if conditions). 53 | * 120 characters line width (Java code tends to be wide, and so are screens nowadays) 54 | 55 | ### 6. [Jacoco](http://www.jacoco.org/jacoco/) static analysis Java code coverage 56 | 57 | Is there enough test coverage? The test coverage should be equal or higher than in the previous version. Creator of a pull request should have added proper set of unit tests before sending the pull request. 58 | 59 | ### 7. Changelogs 60 | 61 | Have the changelogs been updated and include the changes made? 62 | The changelog items contain reference to the backlog item where applicable? 63 | 64 | ### 8. Licensing 65 | 66 | Is the code licensing OK? 67 | All the code and possible external dependencies must follow MIT license. 68 | 69 | ### 9. Documentation 70 | 71 | Has the documentation been updated if new features added or the old ones updated? Are the sources of pictures provided? 72 | 73 | ## Reviewing and acceptance order 74 | Pull requests are generally reviewed and accepted on first-come, first-served (FCFS) basis. 75 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Base java:8 2 | FROM java:8 3 | 4 | # Add Rest Gateway war to container 5 | ADD src/target/rest-adapter-service-*.war rest-adapter-service.war 6 | 7 | # Entry with exec 8 | ENTRYPOINT exec java $JAVA_OPTS -jar /rest-adapter-service.war 9 | 10 | # Expose default port 11 | EXPOSE 8080 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | Copyright © 2018 Nordic Institute for Interoperability Solutions (NIIS) 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in 12 | all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /MoU-Ansip-Katainen.md: -------------------------------------------------------------------------------- 1 | 2 | **MEMORANDUM OF UNDERSTANDING 3 | BETWEEN THE PRIME MINISTER OF ESTONIA ACTING ON BEHALF OF THE 4 | GOVERNMENT OF THE REPUBLIC OF ESTONIA 5 | AND THE PRIME MINISTER OF FINLAND ACTING ON BEHALF OF THE GOVERN-MENT OF THE REPUBLIC OF FINLAND 6 | ON COOPERATION IN THE FIELD OF INFORMATION 7 | AND COMMUNICATIONS TECHNOLOGY** 8 | 9 | 10 | 11 | 12 | The Prime Minister of Estonia acting on behalf of the Government of the Republic of Estonia and the Prime Minister of Finland acting on behalf of the Government of the Republic of Finland (here-inafter referred to as the Participants) 13 | 14 | recognising the value that Estonia and Finland can give to each other if they join forces and under-take cooperative measures to develop digital society, economy and government together for mutual benefit, 15 | 16 | taking into account the 2008 bilateral report “Opportunities for Cooperation between Estonia and Finland” which envisioned ICT as one of the most promising collaboration areas between Finland and Estonia, 17 | 18 | taking into account the Estonian “Information Society Development Plan 2014-2020”, in which Government of the Republic of Estonia has highlighted development of cross-border digital service environment as one of strategic priorities, 19 | recognising the progress made in Estonia in ICT development, especially in regard to the creation of the e-governance infrastructure and digital services, 20 | 21 | taking into account the Finnish ICT2015 report, the implementation of which is being ensured by an ICT expert group established by the Prime Minister’s Office of Finland, 22 | 23 | noting that the Government of Finland has stated in its structural policy programme of 29 August 2013 that Finland will fully utilise the opportunities that are presented by cooperation with Estonia in ICT development, 24 | 25 | noting the high level correspondence between the Participants expressing mutual interest in advanc-ing Finnish-Estonian collaboration in ICT development, 26 | 27 | wishing to take another step towards a fruitful cooperation in this area, 28 | 29 | have reached the following understanding: 30 | 31 | 32 | ## Paragraph 1 33 | Purpose of the Memorandum of Understanding 34 | The purpose of this Memorandum is to strengthen bilateral cooperation between Finland and Esto-nia in ICT development and for the Participants to express the objectives and outlines of their coop-eration. 35 | 36 | ## Paragraph 2 37 | Objectives and areas of cooperation between the Participants 38 | Within the context of this Memorandum of Understanding, the Participants will have the possibility of sharing their resources, experience and expertise in ICT development. The Participants wish to promote cooperation as follows: 39 | 40 | 1) **Estonia’s X-Road’s source code will be implemented for practical use in Finland as a national data exchange layer.** 41 | Estonia will share the current X-Road source code with the Finnish Ministry of Finance. Es-tonia will also share updates to the source code as they become available. X-Road has proved its worth in Estonian national ICT infrastructure and it has the potential to provide a cost-effective way for improving Finnish ICT infrastructure. Finland will aspire to develop a national data exchange layer that has X-Road as its inspiration and basis. 42 | 43 | 2) **Finland and Estonia will cooperate in the development of future versions of the X-Road platform and the Finnish national data exchange layer.** 44 | The Participants will share with each other any developments that are made to the X-Road architecture in either country. The Participants will reciprocally share their experiences and insights regarding X-Road and the national data exchange layer and look into preparing a roadmap for developing future versions of these infrastructures jointly. 45 | 46 | 3) **Cross-border cooperation will be advanced in multiple fields of digital society, econ-omy and government.** 47 | The Participants are interested in developing cross-border cooperation e.g. by exchange of information or experts between authorities of both countries, by organizing joint initiatives and events, etc. as appropriate. The Participants will research and regularly discuss the pos-sibilities for cross-border cooperation in different fields of digital government and society, including joint cross-border services and infrastructure. 48 | 49 | 4) **The Participants will share with each other information that is relevant to achieving the aforementioned objectives** 50 | The Participants will share experiences, insights and ideas concerning functional organisa-tional models, recommended courses of action, regulatory matters and other matters relevant to designing, developing and implementing successful and practical ICT solutions within society, economy and government. 51 | 52 | ## Paragraph 3 53 | 54 | **Coordinating representatives of Participants** 55 | 56 | The Participants designate the following ministries as their coordinating representatives, responsible for the arrangement and implementation of co-operation: 57 | 58 | * Republic of Estonia: Ministry of Economic Affairs and Communications, 59 | * epublic of Finland: Ministry of Finance. 60 | 61 | These representatives will decide upon concrete plans for co-operation under this Memorandum. Other institutions are invited to participate and can be designated as responsible for implementation of particular activities. 62 | 63 | ## Paragraph 4 64 | 65 | **Nature of the Memorandum** 66 | 67 | This Memorandum represents the mutual interests and aspirations of the Participants regarding the improvement of ICT use in government, economy and society in both Estonia and Finland. This Memorandum does not modify or supersede any national or international laws or regulatory re-quirements in force in, or applying to, Estonia or Finland. It is a statement of intent of the Partici-pants and it will not create any binding legal obligations for either Participant. The provisions of this Memorandum may not give rise to any legal claim on behalf of either Participant or third party. The provisions of this Memorandum do not prejudge or assume any particular decisions or under-takings. 68 | 69 | This Memorandum of Understanding is not eligible for registration under Article 102 of the Charter of the United Nations. 70 | 71 | This Memorandum complements other present and future arrangements on cooperation between the Participants. Any differences between Participants in the interpretation or application of this Memo-randum will be settled amicably by mutual consultation. 72 | 73 | ## Paragraph 5 74 | 75 | **Amendments and termination** 76 | 77 | This Memorandum of Understanding may be amended at any time by the mutual written consent of the Participants. 78 | 79 | This Memorandum of Understanding may be terminated by either Participant giving six months written notice. The Participants will consult to determine how any outstanding matters should be dealt with. Termination will not affect the validity of any contract made under this Memorandum of Understanding 80 | 81 | ## Paragraph 6 82 | 83 | **Entry into effect** 84 | 85 | This Memorandum will come into effect on the date of signature thereof by the Participants. 86 | 87 | ### Signatures 88 | 89 | Signed electronically on 10 December 2013 in the English language 90 | (Digital signature) (Digital signature) 91 | 92 | PRIME MINISTER OF ESTONIA, ACT-ING ON BEHALF OF THE GOVERN-MENT OF THE REPUBLIC OF ESTONIA 93 | Name: Andrus Ansip 94 | 95 | PRIME MINISTER OF FINLAND, ACT-ING ON BEHALF OF THE GOVERN-MENT OF THE REPUBLIC OF FINLAND 96 | Name: Jyrki Katainen 97 | 98 | 99 | http://valtioneuvosto.fi/ajankohtaista/kolumnit/kolumni/sv.jsp?oid=401988 100 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # X-Road REST Adapter Service 2 | 3 | [![Go to X-Road Community Slack](https://img.shields.io/badge/Go%20to%20Community%20Slack-grey.svg)](https://jointxroad.slack.com/) 4 | [![Get invited](https://img.shields.io/badge/No%20Slack-Get%20invited-green.svg)](https://x-road.global/community) 5 | 6 | REST Adapter Service provides REST support to [X-Road](https://github.com/nordic-institute/X-Road) data exchange layer solution. REST Adapter Service sits between [X-Road](https://github.com/nordic-institute/X-Road) Security Server and a REST client or service ([diagram](https://github.com/nordic-institute/REST-adapter-service/raw/master/images/message-sequence_rest-gateway-0.0.4.png)). The component implements X-Road v4.0 [SOAP profile](https://github.com/nordic-institute/X-Road/blob/develop/doc/Protocols/pr-mess_x-road_message_protocol.md) and it's compatible with X-Road v6.4 and above. 7 | 8 | REST Adapter Service has two parts: _Consumer Gateway_ and _Provider Gateway._ It is possible to use either only Consumer Gateway, only Provider Gateway, or both. 9 | 10 | ![different adapter usage scenarios](images/restgw-use-cases.png "Different adapter usage scenarios") 11 | 12 | * (A) using both Consumer and Provider Gateways 13 | * when both the client and the server are REST/JSON, but the messages need to go through X-Road 14 | * when end to end encryption is needed 15 | * (B) using only Consumer Gateway 16 | * when the service is SOAP/XML, but a client needs to access it through REST/JSON 17 | * (C) using only Provider Gateway 18 | * when a REST/JSON service needs to be published in X-Road for SOAP/XML clients 19 | 20 | More information about available features can be found [here](documentation/Rest-Adapter-Service-principles.md). 21 | 22 | ## Try It Out 23 | 24 | The fastest and easiest way to try out the application is by using the Spring Boot Gradle plugin. 25 | To do this, you need to have a working installation of [Gradle](https://gradle.org/). 26 | 27 | 28 | ``` 29 | cd adapter 30 | ./gradlew bootRun 31 | ``` 32 | After that you can access `http://localhost:8080/rest-adapter-service/` to see the Rest Adapter landing page. 33 | 34 | If customized location for ```ConsumerGateway``` and ```ProviderGateway``` properties are used, use the following 35 | syntax to define 36 | ``` 37 | ./gradlew bootRun --PpropertiesDirectory=/my/conf 38 | ``` 39 | 40 | When using default properties file location (classpath) you can pass ```-Pencrypted``` to use the encrypted-profiles 41 | properties file. If that property is not provided, plaintext-profile will be used. 42 | ``` 43 | ./gradlew bootRun --Pencryped 44 | ``` 45 | 46 | ## Configuration files location 47 | 48 | Rest Adapter Service tries to load configuration files from the following locations, 49 | in the following order. 50 | 51 | If a matching directory exists, all the configuration files 52 | need to exist in that directory, otherwise an error occurs. Configuration 53 | directory scanning stops once the first matching directory is located. 54 | 55 | Scanned directories: 56 | 1. The directory specified by the system property ```propertiesDirectory``` 57 | ``` 58 | java -jar -DpropertiesDirectory=/my/custom/path rest-adapter-service-x.x.x.jar 59 | ``` 60 | 2. As a fallback, the default configuration shipped with the WAR (classpath) 61 | 62 | 63 | More detailed usage examples are available in [documentation](documentation/Rest-Adapter-Service-principles.md#usage). 64 | 65 | # Installing Rest Adapter Service 66 | 67 | Build or download the jar file. You need to have Java 21 installed. Run 68 | ```shell 69 | java -jar rest-adapter-service-x.x.x.jar 70 | ``` 71 | 72 | ### Changing the port 73 | To change the port, modify configuration file `/etc/rest-adapter-service/application.properties` 74 | ```shell 75 | # change this to customize port 76 | server.port=8080 77 | ``` 78 | 79 | # Building and packaging 80 | 81 | ## Source code license headers 82 | 83 | The build uses [license-gradle-plugin](https://github.com/hierynomus/license-gradle-plugin) to generate proper license headers for the source code files. 84 | 85 | `./gradlew licenseMain` generates the license headers where they are missing. More details can be found from the plugin documentation. 86 | 87 | ## Building docker container 88 | From ```/adapter``` run 89 | ```shell 90 | # in the directory where the Dockerfile is located 91 | docker build -t rest-adapter-service . 92 | ``` 93 | Optionally you can pass ```--build-arg PROPS_DIR=./customProperties``` to use custom properties directory including the configuration for Provider and Consumer Gateways. 94 | ```shell 95 | docker build -t rest-adapter-service --build-arg PROPS_DIR=./customProperties . 96 | ``` 97 | Then the container can be run with the command below. The port can be changed by passing the `-p` option. 98 | ```shell 99 | docker run -d -p 8080:8080 rest-adapter-service 100 | ``` 101 | 102 | ## Encryption of Message Content 103 | 104 | Starting from version 0.0.10 Rest Adapter Service supports encryption/decryption of message content. More information and instructions for configuration can be found in the [documentation](documentation/Encryption.md). 105 | 106 | By default plaintext configuration is enabled. The software can be built with encryption configuration enabled using the command below. 107 | This setting only affects the default configuration bundled inside the war file, and the integration tests. 108 | External configuration, in `/etc/rest-adapter-service` 109 | or elsewhere, is not affected. 110 | 111 | ```./gradlew clean build -Pencrypted``` 112 | 113 | Running integration tests with plaintext configuration enabled: 114 | 115 | ```./gradlew clean intTest``` 116 | 117 | Running integration tests with encryption configuration enabled: 118 | 119 | ```./gradlew clean intTest -Pencrypted``` 120 | 121 | Integration tests are run on port `9898` 122 | 123 | ## Mocking external API's for integration tests 124 | 125 | Integration tests execute requests against several external API's, such as `http://www.hel.fi/palvelukarttaws/rest/v4/organization/`. 126 | These external API's may for example suffer from temporary downtime, or have their data changed so that integration tests no longer pass. 127 | 128 | ### Additional documentation 129 | 130 | * [Requirements](documentation/Requirements.md) 131 | * [Setting up development environment](documentation/Setting-up-Development-Environment.md) 132 | * [Setting up SSL on Tomcat](documentation/Setting-up-SSL-on-Tomcat.md) 133 | * [Import a certificate as a trusted certificate](documentation/Import-a-Certificate-as-a-Trusted-Certificate.md) 134 | * [Encryption](documentation/Encryption.md) 135 | * [Rest Adapter Service principles](documentation/Rest-Adapter-Service-principles.md) 136 | * [Obtaining WAR file from package repository](documentation/Downloading-WAR-from-repository.md) 137 | * Examples 138 | * [Configuring Rest Adapter Service provider](documentation/Configuring-Rest-Adapter-Service-provider.md) 139 | * [CRUD API configuration](documentation/CRUD-API-Configuration.md) 140 | 141 | ### Links to material 142 | 143 | * [Data exchange layer X-Road](https://github.com/nordic-institute/X-Road) 144 | * [X-Road community](https://x-road.global/) 145 | * [Nordic Institute for Interoperability Solutions (NIIS)](https://www.niis.org/) 146 | * [XRd4J - Java library for X-Road v6](https://github.com/nordic-institute/xrd4j) 147 | 148 | ## Want to contribute? 149 | 150 | For more information look at the [contribution instructions](CONTRIBUTING.md). 151 | 152 | ## Credits 153 | 154 | The development of REST Adapter Service started as a joint effort between Finland and Estonia in December 2014. Since then the component has been developed by different people and organizations. 155 | 156 | * REST Gateway was originally developed by the people listed below (https://github.com/educloudalliance/xroad-rest-gateway) during 2014-2017. 157 | * The name of the component was changed to REST Adapter Service (https://github.com/vrk-kpa/REST-adapter-service) and it was maintained and further developed by the Finnish Population Register Centre (VRK) during 06/2017-05/2018. 158 | * In June 2018 it was agreed that Nordic Institute for Interoperability Solutions (NIIS) takes maintenance responsibility. 159 | 160 | Below is a list of people who initiated the co-operation in a Skype meeting which was held on 18th December 2014: 161 | 162 | * Andres Kütt (Estonian Information System Authority, RIA, Estonia) 163 | * Alar Jõeste (Cybernetica, Estonia) 164 | * Margus Freudenthal (Cybernetica, Estonia) 165 | * Petteri Kivimäki (Population Register Centre, Finland) 166 | * Jarkko Moilanen (Ministry of Education and Culture, Finland) 167 | -------------------------------------------------------------------------------- /adapter/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM eclipse-temurin:21-jdk-alpine AS build 2 | WORKDIR /app 3 | ARG PROPS_DIR 4 | 5 | COPY ./build.gradle.kts ./settings.gradle.kts ./gradlew ./ 6 | COPY ./gradle/wrapper/ ./gradle/wrapper/ 7 | COPY ./gradle/libs.versions.toml ./gradle/ 8 | COPY src ./src 9 | 10 | RUN chmod +x ./gradlew 11 | ENTRYPOINT [ "sh" ] 12 | 13 | RUN if [$PROPS_DIR == ""]; then \ 14 | echo "custom properties directory NOT set"; \ 15 | ./gradlew clean build -x test -x checkstyleMain -x checkstyleTest -x licenseMain -x licenseTest; \ 16 | else \ 17 | echo "custom properties directory set"; \ 18 | cp ${PROPS_DIR}/* ./config/; \ 19 | ./gradlew clean build -PpropertiesDirectory=./config -x test -x checkstyleMain -x checkstyleTest -x licenseMain -x licenseTest; \ 20 | fi 21 | 22 | 23 | FROM eclipse-temurin:21-jre-alpine 24 | WORKDIR /app 25 | 26 | # Copy the built JAR from the previous stage 27 | COPY --from=build /app/build/libs/*.jar app.jar 28 | 29 | # Set the entry point 30 | ENTRYPOINT ["java", "-jar", "app.jar"] -------------------------------------------------------------------------------- /adapter/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.apache.tools.ant.filters.ReplaceTokens 2 | import java.util.* 3 | 4 | plugins { 5 | java 6 | checkstyle 7 | alias(libs.plugins.springBoot) 8 | alias(libs.plugins.dependencyManagement) 9 | alias(libs.plugins.licenseGradlePlugin) 10 | jacoco 11 | } 12 | 13 | group = "org.niis" 14 | version = "1.1.0-SNAPSHOT" 15 | description = "REST Adapter Service" 16 | java.sourceCompatibility = JavaVersion.VERSION_21 17 | 18 | checkstyle { 19 | toolVersion = "10.23.1" 20 | group = "verification" 21 | configFile = file("${project.projectDir}/config/checkstyle/checkstyle-config.xml") 22 | } 23 | 24 | repositories { 25 | mavenLocal() 26 | maven { 27 | url = uri("https://artifactory.niis.org/xroad-maven-releases") 28 | mavenContent { 29 | releasesOnly() 30 | } 31 | } 32 | maven { 33 | url = uri("https://artifactory.niis.org/xroad-maven-snapshots") 34 | mavenContent { 35 | snapshotsOnly() 36 | } 37 | } 38 | maven { 39 | url = uri("https://repo.maven.apache.org/maven2/") 40 | } 41 | mavenCentral() 42 | } 43 | 44 | ext { 45 | set("java.version", "21") 46 | set("jdk.version", "21") 47 | set("project.build.sourceEncoding", "UTF-8") 48 | set("project.build.resourceEncoding", "UTF-8") 49 | set("project.reporting.outputEncoding", "UTF-8") 50 | set("app.home", "/var/lib/tomcat/webapps") 51 | set("server.port", "9898") 52 | } 53 | 54 | dependencies { 55 | // SpringBoot 56 | implementation(libs.org.springframework.boot.spring.boot.starter.web) 57 | implementation(libs.org.springframework.boot.spring.boot.starter.aop) 58 | implementation(libs.org.springframework.boot.spring.boot.starter.tomcat) 59 | implementation(libs.org.springframework.boot.spring.boot.starter.thymeleaf) 60 | testImplementation(libs.org.springframework.boot.spring.boot.starter.test) { 61 | exclude(group = "com.vaadin.external.google", module = "android-json") 62 | } 63 | 64 | // xrd4j 65 | implementation(libs.org.niis.xrd4j.common) 66 | implementation(libs.org.niis.xrd4j.client) 67 | implementation(libs.org.niis.xrd4j.server) 68 | implementation(libs.org.niis.xrd4j.rest) 69 | 70 | // Lombok 71 | compileOnly(libs.org.projectlombok.lombok) 72 | annotationProcessor(libs.org.projectlombok.lombok) 73 | testImplementation(libs.org.projectlombok.lombok) 74 | testAnnotationProcessor(libs.org.projectlombok.lombok) 75 | 76 | // other 77 | implementation(libs.org.apache.tomcat.embed.tomcat.embed.jasper) 78 | checkstyle(libs.com.puppycrawl.tools.checkstyle) 79 | 80 | //Test Implementation 81 | testImplementation(libs.com.github.stefanbirkner.system.rules) 82 | testImplementation(libs.com.jayway.jsonpath.json.path) 83 | testImplementation(libs.com.jayway.jsonpath.json.path.assert) 84 | testImplementation(libs.org.xmlunit.xmlunit.assertj) 85 | testImplementation(libs.commons.io.commons.io) 86 | testImplementation(libs.org.xmlunit.xmlunit.core) 87 | testImplementation(libs.org.xmlunit.xmlunit.matchers) 88 | testImplementation(libs.org.wiremock.integrations.wiremock.spring.boot) 89 | testAnnotationProcessor(libs.org.wiremock.integrations.wiremock.spring.boot) 90 | } 91 | 92 | license { 93 | header = file("../LICENSE") 94 | mapping("java", "SLASHSTAR_STYLE") 95 | include("**/*.java") 96 | } 97 | 98 | // Profile 99 | val isEncrypted = project.hasProperty("encrypted") 100 | val adapterProfileDir = if (isEncrypted) "encrypted" else "plaintext" 101 | 102 | // Filtering 103 | val baseReplacements = mutableMapOf( 104 | "projectDir" to project.projectDir.toString() 105 | ) 106 | 107 | val defaultFilterFile = file("src/main/filters/default.properties") 108 | val defaultProps = Properties().apply { 109 | load(defaultFilterFile.reader()) 110 | } 111 | 112 | tasks.named("bootRun"){ 113 | logger.info("Used profile: " + adapterProfileDir) 114 | } 115 | 116 | tasks.named("processResources") { 117 | logger.info(if (isEncrypted) "Running with encrypted profile" else "Running with plaintext profile"); 118 | 119 | var replacements = baseReplacements + defaultProps.entries.associate { it.key.toString() to it.value.toString() } 120 | from("src/main/profiles/$adapterProfileDir/") { 121 | filesMatching("**/*.properties") { 122 | filter("tokens" to replacements) 123 | } 124 | } 125 | 126 | if (isEncrypted) { 127 | copy { 128 | from("src/main/resources-bin/") { 129 | include("**/*.jks") 130 | } 131 | into("build/resources/main/resources-bin") 132 | } 133 | } 134 | } 135 | 136 | tasks.named("processTestResources") { 137 | group = "verification" 138 | 139 | var replacements = baseReplacements + defaultProps.entries.associate { it.key.toString() to it.value.toString() } 140 | filesMatching("**/*.properties") { 141 | filter("tokens" to replacements) 142 | } 143 | } 144 | 145 | tasks.test { 146 | group = "verification" 147 | 148 | useJUnitPlatform() 149 | exclude("org/niis/xroad/restadapterservice/ConsumerGatewayIT.class") 150 | finalizedBy(tasks.jacocoTestReport) 151 | } 152 | 153 | 154 | tasks.register("processIntTestResources") { 155 | description = "Processes integration test resources" 156 | group = "verification" 157 | 158 | val intTestFilterFile = file("src/test/filters/integration-test.properties") 159 | val props = Properties().apply { 160 | load(intTestFilterFile.reader()) 161 | } 162 | var replacements = baseReplacements + props.entries.associate { it.key.toString() to it.value.toString() } 163 | 164 | doLast { 165 | copy { 166 | from("src/main/profiles/$adapterProfileDir/") { 167 | filesMatching("**/*.properties") { 168 | filter("tokens" to replacements) 169 | } 170 | } 171 | into("${project.projectDir}/build/resources/integration-test-profile") 172 | } 173 | 174 | } 175 | } 176 | 177 | tasks.register("intTest") { 178 | description = "Runs integration tests" 179 | group = "verification" 180 | 181 | dependsOn("processIntTestResources") 182 | useJUnitPlatform() 183 | testClassesDirs = sourceSets["test"].output.classesDirs 184 | classpath = sourceSets["test"].runtimeClasspath 185 | 186 | include("org/niis/xroad/restadapterservice/ConsumerGatewayIT.class") 187 | 188 | systemProperty("consumerPath", project.projectDir.resolve("libs").resolve("${project.name}-${project.version}.jar")) 189 | systemProperty("server.port", "9898") 190 | systemProperty("propertiesDirectory", "${project.projectDir}/build/resources/integration-test-profile") 191 | } 192 | 193 | // disable the default jar task of the Java plugin so only springboot's jar is created 194 | tasks.jar { 195 | isEnabled = false 196 | } 197 | 198 | 199 | -------------------------------------------------------------------------------- /adapter/config/checkstyle/checkstyle-config.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /adapter/config/checkstyle/suppressions.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | -------------------------------------------------------------------------------- /adapter/eclipse.importorder: -------------------------------------------------------------------------------- 1 | #Organize Import Order 2 | #Wed Sep 20 08:07:26 EEST 2017 3 | 4=\# 4 | 3=java 5 | 2=javax 6 | 1= 7 | 0=fi.vrk 8 | -------------------------------------------------------------------------------- /adapter/gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | # This file was generated by the Gradle 'init' task. 2 | # https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format 3 | 4 | [versions] 5 | springBoot = "3.4.4" 6 | dependencyManagement = "1.0.11.RELEASE" 7 | licenseGradlePlugin = "0.16.1" 8 | 9 | # NIIS 10 | org-niis-xrd4j = "0.8.0" 11 | 12 | #Other 13 | org-apache-tomcat-embed-tomcat-embed-jasper = "10.1.39" 14 | org-projectlombok-lombok = "1.18.30" 15 | com-puppycrawl-tools-checkstyle = "10.23.1" 16 | 17 | #Testing 18 | com-github-stefanbirkner-system-rules = "1.16.0" 19 | com-jayway-jsonpath-json = "2.2.0" 20 | commons-io-commons-io = "2.6" 21 | org-springframework-boot-spring-boot = "3.4.4" 22 | org-xmlunit-xmlunit = "2.7.0" 23 | org-wiremock-integrations-wiremock-spring-boot = "3.6.0" 24 | 25 | [libraries] 26 | # Springboot 27 | org-springframework-boot-spring-boot-starter-aop = { module = "org.springframework.boot:spring-boot-starter-aop", version.ref = "org-springframework-boot-spring-boot" } 28 | org-springframework-boot-spring-boot-starter-test = { module = "org.springframework.boot:spring-boot-starter-test", version.ref = "org-springframework-boot-spring-boot" } 29 | org-springframework-boot-spring-boot-starter-tomcat = { module = "org.springframework.boot:spring-boot-starter-tomcat", version.ref = "org-springframework-boot-spring-boot" } 30 | org-springframework-boot-spring-boot-starter-web = { module = "org.springframework.boot:spring-boot-starter-web", version.ref = "org-springframework-boot-spring-boot" } 31 | org-springframework-boot-spring-boot-starter-thymeleaf = { module = "org.springframework.boot:spring-boot-starter-thymeleaf", version.ref = "springBoot" } 32 | 33 | # Xrd4j 34 | org-niis-xrd4j-client = { module = "org.niis.xrd4j:client", version.ref = "org-niis-xrd4j" } 35 | org-niis-xrd4j-common = { module = "org.niis.xrd4j:common", version.ref = "org-niis-xrd4j" } 36 | org-niis-xrd4j-server = { module = "org.niis.xrd4j:server", version.ref = "org-niis-xrd4j" } 37 | org-niis-xrd4j-rest = { module = "org.niis.xrd4j:rest", version.ref = "org-niis-xrd4j" } 38 | 39 | # Other 40 | org-apache-tomcat-embed-tomcat-embed-jasper = { module = "org.apache.tomcat.embed:tomcat-embed-jasper", version.ref = "org-apache-tomcat-embed-tomcat-embed-jasper" } 41 | org-projectlombok-lombok = { module = "org.projectlombok:lombok", version.ref = "org-projectlombok-lombok" } 42 | com-puppycrawl-tools-checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "com-puppycrawl-tools-checkstyle" } 43 | 44 | 45 | # For Testing 46 | com-github-stefanbirkner-system-rules = { module = "com.github.stefanbirkner:system-rules", version.ref = "com-github-stefanbirkner-system-rules" } 47 | com-jayway-jsonpath-json-path = { module = "com.jayway.jsonpath:json-path", version.ref = "com-jayway-jsonpath-json" } 48 | com-jayway-jsonpath-json-path-assert = { module = "com.jayway.jsonpath:json-path-assert", version.ref = "com-jayway-jsonpath-json" } 49 | commons-io-commons-io = { module = "commons-io:commons-io", version.ref = "commons-io-commons-io" } 50 | org-xmlunit-xmlunit-assertj = { module = "org.xmlunit:xmlunit-assertj", version.ref = "org-xmlunit-xmlunit" } 51 | org-xmlunit-xmlunit-core = { module = "org.xmlunit:xmlunit-core", version.ref = "org-xmlunit-xmlunit" } 52 | org-xmlunit-xmlunit-matchers = { module = "org.xmlunit:xmlunit-matchers", version.ref = "org-xmlunit-xmlunit" } 53 | org-wiremock-integrations-wiremock-spring-boot = { module = "org.wiremock.integrations:wiremock-spring-boot", version.ref = "org-wiremock-integrations-wiremock-spring-boot" } 54 | 55 | 56 | [plugins] 57 | dependencyManagement = { id = "io.spring.dependency-management", version.ref = "dependencyManagement" } 58 | licenseGradlePlugin = { id = "com.github.hierynomus.license", version.ref = "licenseGradlePlugin" } 59 | springBoot = { id = "org.springframework.boot", version.ref = "springBoot" } 60 | -------------------------------------------------------------------------------- /adapter/gradle/wrapper/dists/CACHEDIR.TAG: -------------------------------------------------------------------------------- 1 | Signature: 8a477f597d28d172789f06886806bc55 2 | # This file is a cache directory tag created by Gradle. 3 | # For information about cache directory tags, see: 4 | # https://bford.info/cachedir/ -------------------------------------------------------------------------------- /adapter/gradle/wrapper/dists/gradle-8.10.2-bin/a04bxjujx95o3nb99gddekhwo/gradle-8.10.2-bin.zip.lck: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nordic-institute/REST-adapter-service/0b6bf9a50f972c921c056ab706d13d2a7e785c31/adapter/gradle/wrapper/dists/gradle-8.10.2-bin/a04bxjujx95o3nb99gddekhwo/gradle-8.10.2-bin.zip.lck -------------------------------------------------------------------------------- /adapter/gradle/wrapper/dists/gradle-8.10.2-bin/a04bxjujx95o3nb99gddekhwo/gradle-8.10.2-bin.zip.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nordic-institute/REST-adapter-service/0b6bf9a50f972c921c056ab706d13d2a7e785c31/adapter/gradle/wrapper/dists/gradle-8.10.2-bin/a04bxjujx95o3nb99gddekhwo/gradle-8.10.2-bin.zip.ok -------------------------------------------------------------------------------- /adapter/gradle/wrapper/dists/gradle-8.10.2-bin/a04bxjujx95o3nb99gddekhwo/gradle-8.10.2/NOTICE: -------------------------------------------------------------------------------- 1 | ========================================================================= 2 | == NOTICE file corresponding to the section 4 d of == 3 | == the Apache License, Version 2.0, == 4 | == in this case for the Gradle distribution. == 5 | ========================================================================= 6 | 7 | This product includes software developed by 8 | The Apache Software Foundation (http://www.apache.org/). 9 | 10 | It includes the following other software: 11 | 12 | Groovy (http://groovy-lang.org) 13 | SLF4J (http://www.slf4j.org) 14 | JUnit (http://www.junit.org) 15 | JCIFS (http://jcifs.samba.org) 16 | HttpClient (https://hc.apache.org/httpcomponents-client-4.5.x/) 17 | 18 | For licenses, see the LICENSE file. 19 | 20 | If any software distributed with Gradle does not have an Apache 2 License, its license is explicitly listed in the 21 | LICENSE file. 22 | -------------------------------------------------------------------------------- /adapter/gradle/wrapper/dists/gradle-8.10.2-bin/a04bxjujx95o3nb99gddekhwo/gradle-8.10.2/README: -------------------------------------------------------------------------------- 1 | Gradle is a build tool with a focus on build automation and support for multi-language development. If you are building, testing, publishing, and deploying software on any platform, Gradle offers a flexible model that can support the entire development lifecycle from compiling and packaging code to publishing web sites. Gradle has been designed to support build automation across multiple languages and platforms including Java, Scala, Android, C/C++, and Groovy, and is closely integrated with development tools and continuous integration servers including Eclipse, IntelliJ, and Jenkins. 2 | 3 | For more information about Gradle, please visit: https://gradle.org 4 | 5 | If you are using the "all" distribution, the User Manual is included in your distribution. 6 | 7 | If you are using the "bin" distribution, a copy of the User Manual is available on https://docs.gradle.org. 8 | 9 | Typing `gradle help` prints the command line help. 10 | 11 | Typing `gradle tasks` shows all the tasks of a Gradle build. 12 | -------------------------------------------------------------------------------- /adapter/gradle/wrapper/dists/gradle-8.10.2-bin/a04bxjujx95o3nb99gddekhwo/gradle-8.10.2/bin/gradle: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # SPDX-License-Identifier: Apache-2.0 19 | # 20 | 21 | ############################################################################## 22 | # 23 | # Gradle start up script for POSIX generated by Gradle. 24 | # 25 | # Important for running: 26 | # 27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 28 | # noncompliant, but you have some other compliant shell such as ksh or 29 | # bash, then to run this script, type that shell name before the whole 30 | # command line, like: 31 | # 32 | # ksh Gradle 33 | # 34 | # Busybox and similar reduced shells will NOT work, because this script 35 | # requires all of these POSIX shell features: 36 | # * functions; 37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 39 | # * compound commands having a testable exit status, especially «case»; 40 | # * various built-in commands including «command», «set», and «ulimit». 41 | # 42 | # Important for patching: 43 | # 44 | # (2) This script targets any POSIX shell, so it avoids extensions provided 45 | # by Bash, Ksh, etc; in particular arrays are avoided. 46 | # 47 | # The "traditional" practice of packing multiple parameters into a 48 | # space-separated string is a well documented source of bugs and security 49 | # problems, so this is (mostly) avoided, by progressively accumulating 50 | # options in "$@", and eventually passing that to Java. 51 | # 52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 54 | # see the in-line comments for details. 55 | # 56 | # There are tweaks for specific operating systems such as AIX, CygWin, 57 | # Darwin, MinGW, and NonStop. 58 | # 59 | # (3) This script is generated from the Groovy template 60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 61 | # within the Gradle project. 62 | # 63 | # You can find Gradle at https://github.com/gradle/gradle/. 64 | # 65 | ############################################################################## 66 | 67 | # Attempt to set APP_HOME 68 | 69 | # Resolve links: $0 may be a link 70 | app_path=$0 71 | 72 | # Need this for daisy-chained symlinks. 73 | while 74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 75 | [ -h "$app_path" ] 76 | do 77 | ls=$( ls -ld "$app_path" ) 78 | link=${ls#*' -> '} 79 | case $link in #( 80 | /*) app_path=$link ;; #( 81 | *) app_path=$APP_HOME$link ;; 82 | esac 83 | done 84 | 85 | # This is normally unused 86 | # shellcheck disable=SC2034 87 | APP_BASE_NAME=${0##*/} 88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 89 | APP_HOME=$( cd -P "${APP_HOME:-./}.." > /dev/null && printf '%s 90 | ' "$PWD" ) || exit 91 | 92 | # Use the maximum available, or set MAX_FD != -1 to use that value. 93 | MAX_FD=maximum 94 | 95 | warn () { 96 | echo "$*" 97 | } >&2 98 | 99 | die () { 100 | echo 101 | echo "$*" 102 | echo 103 | exit 1 104 | } >&2 105 | 106 | # OS specific support (must be 'true' or 'false'). 107 | cygwin=false 108 | msys=false 109 | darwin=false 110 | nonstop=false 111 | case "$( uname )" in #( 112 | CYGWIN* ) cygwin=true ;; #( 113 | Darwin* ) darwin=true ;; #( 114 | MSYS* | MINGW* ) msys=true ;; #( 115 | NONSTOP* ) nonstop=true ;; 116 | esac 117 | 118 | CLASSPATH=$APP_HOME/lib/gradle-gradle-cli-main-8.10.2.jar 119 | 120 | 121 | # Determine the Java command to use to start the JVM. 122 | if [ -n "$JAVA_HOME" ] ; then 123 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 124 | # IBM's JDK on AIX uses strange locations for the executables 125 | JAVACMD=$JAVA_HOME/jre/sh/java 126 | else 127 | JAVACMD=$JAVA_HOME/bin/java 128 | fi 129 | if [ ! -x "$JAVACMD" ] ; then 130 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 131 | 132 | Please set the JAVA_HOME variable in your environment to match the 133 | location of your Java installation." 134 | fi 135 | else 136 | JAVACMD=java 137 | if ! command -v java >/dev/null 2>&1 138 | then 139 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 140 | 141 | Please set the JAVA_HOME variable in your environment to match the 142 | location of your Java installation." 143 | fi 144 | fi 145 | 146 | # Increase the maximum file descriptors if we can. 147 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 148 | case $MAX_FD in #( 149 | max*) 150 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 151 | # shellcheck disable=SC2039,SC3045 152 | MAX_FD=$( ulimit -H -n ) || 153 | warn "Could not query maximum file descriptor limit" 154 | esac 155 | case $MAX_FD in #( 156 | '' | soft) :;; #( 157 | *) 158 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 159 | # shellcheck disable=SC2039,SC3045 160 | ulimit -n "$MAX_FD" || 161 | warn "Could not set maximum file descriptor limit to $MAX_FD" 162 | esac 163 | fi 164 | 165 | # Collect all arguments for the java command, stacking in reverse order: 166 | # * args from the command line 167 | # * the main class name 168 | # * -classpath 169 | # * -D...appname settings 170 | # * --module-path (only if needed) 171 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 172 | 173 | # For Cygwin or MSYS, switch paths to Windows format before running java 174 | if "$cygwin" || "$msys" ; then 175 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 176 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 177 | 178 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 179 | 180 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 181 | for arg do 182 | if 183 | case $arg in #( 184 | -*) false ;; # don't mess with options #( 185 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 186 | [ -e "$t" ] ;; #( 187 | *) false ;; 188 | esac 189 | then 190 | arg=$( cygpath --path --ignore --mixed "$arg" ) 191 | fi 192 | # Roll the args list around exactly as many times as the number of 193 | # args, so each arg winds up back in the position where it started, but 194 | # possibly modified. 195 | # 196 | # NB: a `for` loop captures its iteration list before it begins, so 197 | # changing the positional parameters here affects neither the number of 198 | # iterations, nor the values presented in `arg`. 199 | shift # remove old arg 200 | set -- "$@" "$arg" # push replacement arg 201 | done 202 | fi 203 | 204 | 205 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 206 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'" \"-javaagent:$APP_HOME/lib/agents/gradle-instrumentation-agent-8.10.2.jar\"" 207 | 208 | # Collect all arguments for the java command: 209 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 210 | # and any embedded shellness will be escaped. 211 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 212 | # treated as '${Hostname}' itself on the command line. 213 | 214 | set -- \ 215 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 216 | -classpath "$CLASSPATH" \ 217 | org.gradle.launcher.GradleMain \ 218 | "$@" 219 | 220 | # Stop when "xargs" is not available. 221 | if ! command -v xargs >/dev/null 2>&1 222 | then 223 | die "xargs is not available" 224 | fi 225 | 226 | # Use "xargs" to parse quoted args. 227 | # 228 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 229 | # 230 | # In Bash we could simply go: 231 | # 232 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 233 | # set -- "${ARGS[@]}" "$@" 234 | # 235 | # but POSIX shell has neither arrays nor command substitution, so instead we 236 | # post-process each arg (as a line of input to sed) to backslash-escape any 237 | # character that might be a shell metacharacter, then use eval to reverse 238 | # that process (while maintaining the separation between arguments), and wrap 239 | # the whole thing up as a single "set" statement. 240 | # 241 | # This will of course break if any of these variables contains a newline or 242 | # an unmatched quote. 243 | # 244 | 245 | eval "set -- $( 246 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 247 | xargs -n1 | 248 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 249 | tr '\n' ' ' 250 | )" '"$@"' 251 | 252 | exec "$JAVACMD" "$@" 253 | -------------------------------------------------------------------------------- /adapter/gradle/wrapper/dists/gradle-8.10.2-bin/a04bxjujx95o3nb99gddekhwo/gradle-8.10.2/bin/gradle.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME%.. 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" "-javaagent:%APP_HOME%/lib/agents/gradle-instrumentation-agent-8.10.2.jar" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH=%APP_HOME%\lib\gradle-gradle-cli-main-8.10.2.jar 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.launcher.GradleMain %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /adapter/gradle/wrapper/dists/gradle-8.10.2-bin/a04bxjujx95o3nb99gddekhwo/gradle-8.10.2/init.d/readme.txt: -------------------------------------------------------------------------------- 1 | You can add .gradle (e.g. test.gradle) init scripts to this directory. Each one is executed at the start of the build. 2 | -------------------------------------------------------------------------------- /adapter/gradle/wrapper/dists/gradle-8.13-bin/5xuhj0ry160q40clulazy9h7d/gradle-8.13-bin.zip.lck: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nordic-institute/REST-adapter-service/0b6bf9a50f972c921c056ab706d13d2a7e785c31/adapter/gradle/wrapper/dists/gradle-8.13-bin/5xuhj0ry160q40clulazy9h7d/gradle-8.13-bin.zip.lck -------------------------------------------------------------------------------- /adapter/gradle/wrapper/dists/gradle-8.13-bin/5xuhj0ry160q40clulazy9h7d/gradle-8.13-bin.zip.ok: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nordic-institute/REST-adapter-service/0b6bf9a50f972c921c056ab706d13d2a7e785c31/adapter/gradle/wrapper/dists/gradle-8.13-bin/5xuhj0ry160q40clulazy9h7d/gradle-8.13-bin.zip.ok -------------------------------------------------------------------------------- /adapter/gradle/wrapper/dists/gradle-8.13-bin/5xuhj0ry160q40clulazy9h7d/gradle-8.13/NOTICE: -------------------------------------------------------------------------------- 1 | ========================================================================= 2 | == NOTICE file corresponding to the section 4 d of == 3 | == the Apache License, Version 2.0, == 4 | == in this case for the Gradle distribution. == 5 | ========================================================================= 6 | 7 | This product includes software developed by 8 | The Apache Software Foundation (http://www.apache.org/). 9 | 10 | It includes the following other software: 11 | 12 | Groovy (http://groovy-lang.org) 13 | SLF4J (http://www.slf4j.org) 14 | JUnit (http://www.junit.org) 15 | JCIFS (http://jcifs.samba.org) 16 | HttpClient (https://hc.apache.org/httpcomponents-client-4.5.x/) 17 | 18 | For licenses, see the LICENSE file. 19 | 20 | If any software distributed with Gradle does not have an Apache 2 License, its license is explicitly listed in the 21 | LICENSE file. 22 | -------------------------------------------------------------------------------- /adapter/gradle/wrapper/dists/gradle-8.13-bin/5xuhj0ry160q40clulazy9h7d/gradle-8.13/README: -------------------------------------------------------------------------------- 1 | Gradle is a build tool with a focus on build automation and support for multi-language development. If you are building, testing, publishing, and deploying software on any platform, Gradle offers a flexible model that can support the entire development lifecycle from compiling and packaging code to publishing web sites. Gradle has been designed to support build automation across multiple languages and platforms including Java, Scala, Android, C/C++, and Groovy, and is closely integrated with development tools and continuous integration servers including Eclipse, IntelliJ, and Jenkins. 2 | 3 | For more information about Gradle, please visit: https://gradle.org 4 | 5 | If you are using the "all" distribution, the User Manual is included in your distribution. 6 | 7 | If you are using the "bin" distribution, a copy of the User Manual is available on https://docs.gradle.org. 8 | 9 | Typing `gradle help` prints the command line help. 10 | 11 | Typing `gradle tasks` shows all the tasks of a Gradle build. 12 | -------------------------------------------------------------------------------- /adapter/gradle/wrapper/dists/gradle-8.13-bin/5xuhj0ry160q40clulazy9h7d/gradle-8.13/bin/gradle: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # SPDX-License-Identifier: Apache-2.0 19 | # 20 | 21 | ############################################################################## 22 | # 23 | # Gradle start up script for POSIX generated by Gradle. 24 | # 25 | # Important for running: 26 | # 27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 28 | # noncompliant, but you have some other compliant shell such as ksh or 29 | # bash, then to run this script, type that shell name before the whole 30 | # command line, like: 31 | # 32 | # ksh Gradle 33 | # 34 | # Busybox and similar reduced shells will NOT work, because this script 35 | # requires all of these POSIX shell features: 36 | # * functions; 37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 39 | # * compound commands having a testable exit status, especially «case»; 40 | # * various built-in commands including «command», «set», and «ulimit». 41 | # 42 | # Important for patching: 43 | # 44 | # (2) This script targets any POSIX shell, so it avoids extensions provided 45 | # by Bash, Ksh, etc; in particular arrays are avoided. 46 | # 47 | # The "traditional" practice of packing multiple parameters into a 48 | # space-separated string is a well documented source of bugs and security 49 | # problems, so this is (mostly) avoided, by progressively accumulating 50 | # options in "$@", and eventually passing that to Java. 51 | # 52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 54 | # see the in-line comments for details. 55 | # 56 | # There are tweaks for specific operating systems such as AIX, CygWin, 57 | # Darwin, MinGW, and NonStop. 58 | # 59 | # (3) This script is generated from the Groovy template 60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 61 | # within the Gradle project. 62 | # 63 | # You can find Gradle at https://github.com/gradle/gradle/. 64 | # 65 | ############################################################################## 66 | 67 | # Attempt to set APP_HOME 68 | 69 | # Resolve links: $0 may be a link 70 | app_path=$0 71 | 72 | # Need this for daisy-chained symlinks. 73 | while 74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 75 | [ -h "$app_path" ] 76 | do 77 | ls=$( ls -ld "$app_path" ) 78 | link=${ls#*' -> '} 79 | case $link in #( 80 | /*) app_path=$link ;; #( 81 | *) app_path=$APP_HOME$link ;; 82 | esac 83 | done 84 | 85 | # This is normally unused 86 | # shellcheck disable=SC2034 87 | APP_BASE_NAME=${0##*/} 88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 89 | APP_HOME=$( cd -P "${APP_HOME:-./}.." > /dev/null && printf '%s\n' "$PWD" ) || exit 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/lib/gradle-gradle-cli-main-8.13.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | if ! command -v java >/dev/null 2>&1 137 | then 138 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 139 | 140 | Please set the JAVA_HOME variable in your environment to match the 141 | location of your Java installation." 142 | fi 143 | fi 144 | 145 | # Increase the maximum file descriptors if we can. 146 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 147 | case $MAX_FD in #( 148 | max*) 149 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 150 | # shellcheck disable=SC2039,SC3045 151 | MAX_FD=$( ulimit -H -n ) || 152 | warn "Could not query maximum file descriptor limit" 153 | esac 154 | case $MAX_FD in #( 155 | '' | soft) :;; #( 156 | *) 157 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 158 | # shellcheck disable=SC2039,SC3045 159 | ulimit -n "$MAX_FD" || 160 | warn "Could not set maximum file descriptor limit to $MAX_FD" 161 | esac 162 | fi 163 | 164 | # Collect all arguments for the java command, stacking in reverse order: 165 | # * args from the command line 166 | # * the main class name 167 | # * -classpath 168 | # * -D...appname settings 169 | # * --module-path (only if needed) 170 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 171 | 172 | # For Cygwin or MSYS, switch paths to Windows format before running java 173 | if "$cygwin" || "$msys" ; then 174 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 175 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 176 | 177 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 178 | 179 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 180 | for arg do 181 | if 182 | case $arg in #( 183 | -*) false ;; # don't mess with options #( 184 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 185 | [ -e "$t" ] ;; #( 186 | *) false ;; 187 | esac 188 | then 189 | arg=$( cygpath --path --ignore --mixed "$arg" ) 190 | fi 191 | # Roll the args list around exactly as many times as the number of 192 | # args, so each arg winds up back in the position where it started, but 193 | # possibly modified. 194 | # 195 | # NB: a `for` loop captures its iteration list before it begins, so 196 | # changing the positional parameters here affects neither the number of 197 | # iterations, nor the values presented in `arg`. 198 | shift # remove old arg 199 | set -- "$@" "$arg" # push replacement arg 200 | done 201 | fi 202 | 203 | 204 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 205 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'" \"-javaagent:$APP_HOME/lib/agents/gradle-instrumentation-agent-8.13.jar\"" 206 | 207 | # Collect all arguments for the java command: 208 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 209 | # and any embedded shellness will be escaped. 210 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 211 | # treated as '${Hostname}' itself on the command line. 212 | 213 | set -- \ 214 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 215 | -classpath "$CLASSPATH" \ 216 | org.gradle.launcher.GradleMain \ 217 | "$@" 218 | 219 | # Stop when "xargs" is not available. 220 | if ! command -v xargs >/dev/null 2>&1 221 | then 222 | die "xargs is not available" 223 | fi 224 | 225 | # Use "xargs" to parse quoted args. 226 | # 227 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 228 | # 229 | # In Bash we could simply go: 230 | # 231 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 232 | # set -- "${ARGS[@]}" "$@" 233 | # 234 | # but POSIX shell has neither arrays nor command substitution, so instead we 235 | # post-process each arg (as a line of input to sed) to backslash-escape any 236 | # character that might be a shell metacharacter, then use eval to reverse 237 | # that process (while maintaining the separation between arguments), and wrap 238 | # the whole thing up as a single "set" statement. 239 | # 240 | # This will of course break if any of these variables contains a newline or 241 | # an unmatched quote. 242 | # 243 | 244 | eval "set -- $( 245 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 246 | xargs -n1 | 247 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 248 | tr '\n' ' ' 249 | )" '"$@"' 250 | 251 | exec "$JAVACMD" "$@" 252 | -------------------------------------------------------------------------------- /adapter/gradle/wrapper/dists/gradle-8.13-bin/5xuhj0ry160q40clulazy9h7d/gradle-8.13/bin/gradle.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME%.. 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" "-javaagent:%APP_HOME%/lib/agents/gradle-instrumentation-agent-8.13.jar" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH=%APP_HOME%\lib\gradle-gradle-cli-main-8.13.jar 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.launcher.GradleMain %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /adapter/gradle/wrapper/dists/gradle-8.13-bin/5xuhj0ry160q40clulazy9h7d/gradle-8.13/init.d/readme.txt: -------------------------------------------------------------------------------- 1 | You can add .gradle (e.g. test.gradle) init scripts to this directory. Each one is executed at the start of the build. 2 | -------------------------------------------------------------------------------- /adapter/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /adapter/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # SPDX-License-Identifier: Apache-2.0 19 | # 20 | 21 | ############################################################################## 22 | # 23 | # Gradle start up script for POSIX generated by Gradle. 24 | # 25 | # Important for running: 26 | # 27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 28 | # noncompliant, but you have some other compliant shell such as ksh or 29 | # bash, then to run this script, type that shell name before the whole 30 | # command line, like: 31 | # 32 | # ksh Gradle 33 | # 34 | # Busybox and similar reduced shells will NOT work, because this script 35 | # requires all of these POSIX shell features: 36 | # * functions; 37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 39 | # * compound commands having a testable exit status, especially «case»; 40 | # * various built-in commands including «command», «set», and «ulimit». 41 | # 42 | # Important for patching: 43 | # 44 | # (2) This script targets any POSIX shell, so it avoids extensions provided 45 | # by Bash, Ksh, etc; in particular arrays are avoided. 46 | # 47 | # The "traditional" practice of packing multiple parameters into a 48 | # space-separated string is a well documented source of bugs and security 49 | # problems, so this is (mostly) avoided, by progressively accumulating 50 | # options in "$@", and eventually passing that to Java. 51 | # 52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 54 | # see the in-line comments for details. 55 | # 56 | # There are tweaks for specific operating systems such as AIX, CygWin, 57 | # Darwin, MinGW, and NonStop. 58 | # 59 | # (3) This script is generated from the Groovy template 60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 61 | # within the Gradle project. 62 | # 63 | # You can find Gradle at https://github.com/gradle/gradle/. 64 | # 65 | ############################################################################## 66 | 67 | # Attempt to set APP_HOME 68 | 69 | # Resolve links: $0 may be a link 70 | app_path=$0 71 | 72 | # Need this for daisy-chained symlinks. 73 | while 74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 75 | [ -h "$app_path" ] 76 | do 77 | ls=$( ls -ld "$app_path" ) 78 | link=${ls#*' -> '} 79 | case $link in #( 80 | /*) app_path=$link ;; #( 81 | *) app_path=$APP_HOME$link ;; 82 | esac 83 | done 84 | 85 | # This is normally unused 86 | # shellcheck disable=SC2034 87 | APP_BASE_NAME=${0##*/} 88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | if ! command -v java >/dev/null 2>&1 137 | then 138 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 139 | 140 | Please set the JAVA_HOME variable in your environment to match the 141 | location of your Java installation." 142 | fi 143 | fi 144 | 145 | # Increase the maximum file descriptors if we can. 146 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 147 | case $MAX_FD in #( 148 | max*) 149 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 150 | # shellcheck disable=SC2039,SC3045 151 | MAX_FD=$( ulimit -H -n ) || 152 | warn "Could not query maximum file descriptor limit" 153 | esac 154 | case $MAX_FD in #( 155 | '' | soft) :;; #( 156 | *) 157 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 158 | # shellcheck disable=SC2039,SC3045 159 | ulimit -n "$MAX_FD" || 160 | warn "Could not set maximum file descriptor limit to $MAX_FD" 161 | esac 162 | fi 163 | 164 | # Collect all arguments for the java command, stacking in reverse order: 165 | # * args from the command line 166 | # * the main class name 167 | # * -classpath 168 | # * -D...appname settings 169 | # * --module-path (only if needed) 170 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 171 | 172 | # For Cygwin or MSYS, switch paths to Windows format before running java 173 | if "$cygwin" || "$msys" ; then 174 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 175 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 176 | 177 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 178 | 179 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 180 | for arg do 181 | if 182 | case $arg in #( 183 | -*) false ;; # don't mess with options #( 184 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 185 | [ -e "$t" ] ;; #( 186 | *) false ;; 187 | esac 188 | then 189 | arg=$( cygpath --path --ignore --mixed "$arg" ) 190 | fi 191 | # Roll the args list around exactly as many times as the number of 192 | # args, so each arg winds up back in the position where it started, but 193 | # possibly modified. 194 | # 195 | # NB: a `for` loop captures its iteration list before it begins, so 196 | # changing the positional parameters here affects neither the number of 197 | # iterations, nor the values presented in `arg`. 198 | shift # remove old arg 199 | set -- "$@" "$arg" # push replacement arg 200 | done 201 | fi 202 | 203 | 204 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 205 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 206 | 207 | # Collect all arguments for the java command: 208 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 209 | # and any embedded shellness will be escaped. 210 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 211 | # treated as '${Hostname}' itself on the command line. 212 | 213 | set -- \ 214 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 215 | -classpath "$CLASSPATH" \ 216 | org.gradle.wrapper.GradleWrapperMain \ 217 | "$@" 218 | 219 | # Stop when "xargs" is not available. 220 | if ! command -v xargs >/dev/null 2>&1 221 | then 222 | die "xargs is not available" 223 | fi 224 | 225 | # Use "xargs" to parse quoted args. 226 | # 227 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 228 | # 229 | # In Bash we could simply go: 230 | # 231 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 232 | # set -- "${ARGS[@]}" "$@" 233 | # 234 | # but POSIX shell has neither arrays nor command substitution, so instead we 235 | # post-process each arg (as a line of input to sed) to backslash-escape any 236 | # character that might be a shell metacharacter, then use eval to reverse 237 | # that process (while maintaining the separation between arguments), and wrap 238 | # the whole thing up as a single "set" statement. 239 | # 240 | # This will of course break if any of these variables contains a newline or 241 | # an unmatched quote. 242 | # 243 | 244 | eval "set -- $( 245 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 246 | xargs -n1 | 247 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 248 | tr '\n' ' ' 249 | )" '"$@"' 250 | 251 | exec "$JAVACMD" "$@" 252 | -------------------------------------------------------------------------------- /adapter/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /adapter/settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "rest-adapter-service" 2 | -------------------------------------------------------------------------------- /adapter/src/main/filters/default.properties: -------------------------------------------------------------------------------- 1 | rest.adapter.profile.port=8080 2 | -------------------------------------------------------------------------------- /adapter/src/main/java/org/niis/xroad/restadapterservice/Application.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * Copyright © 2018 Nordic Institute for Interoperability Solutions (NIIS) 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | */ 23 | package org.niis.xroad.restadapterservice; 24 | 25 | import org.niis.xroad.restadapterservice.filter.ConsumerURIFilter; 26 | 27 | import org.springframework.boot.SpringApplication; 28 | import org.springframework.boot.autoconfigure.SpringBootApplication; 29 | import org.springframework.boot.web.servlet.FilterRegistrationBean; 30 | import org.springframework.boot.web.servlet.ServletRegistrationBean; 31 | import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; 32 | import org.springframework.context.annotation.Bean; 33 | import org.springframework.context.annotation.Configuration; 34 | 35 | import jakarta.servlet.DispatcherType; 36 | 37 | import java.util.Arrays; 38 | import java.util.EnumSet; 39 | 40 | /** 41 | * Rest adapter service application entry point 42 | */ 43 | @Configuration 44 | @SpringBootApplication 45 | public class Application extends SpringBootServletInitializer { 46 | 47 | public static void main(String[] args) { 48 | SpringApplication.run(Application.class, args); 49 | } 50 | 51 | @Bean 52 | public ServletRegistrationBean consumerGatewayBean() { 53 | ServletRegistrationBean bean = new ServletRegistrationBean(new ConsumerGateway(), "/Consumer/*"); 54 | bean.setLoadOnStartup(1); 55 | return bean; 56 | } 57 | 58 | @Bean 59 | public ServletRegistrationBean providerGatewayBean() { 60 | ServletRegistrationBean bean = new ServletRegistrationBean(new ProviderGateway(), "/Provider"); 61 | bean.setLoadOnStartup(1); 62 | return bean; 63 | } 64 | 65 | @Bean 66 | public FilterRegistrationBean consumerURIFilterBean() { 67 | FilterRegistrationBean bean = new FilterRegistrationBean(); 68 | bean.setFilter(new ConsumerURIFilter()); 69 | bean.setDispatcherTypes(EnumSet.of(DispatcherType.REQUEST)); 70 | bean.setUrlPatterns(Arrays.asList("/Consumer/*")); 71 | return bean; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /adapter/src/main/java/org/niis/xroad/restadapterservice/IndexController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * Copyright © 2018 Nordic Institute for Interoperability Solutions (NIIS) 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | */ 23 | package org.niis.xroad.restadapterservice; 24 | 25 | import org.springframework.stereotype.Controller; 26 | import org.springframework.web.bind.annotation.GetMapping; 27 | import org.springframework.web.bind.annotation.RequestMapping; 28 | 29 | import jakarta.servlet.http.HttpServletRequest; 30 | 31 | import java.util.Map; 32 | 33 | /** 34 | * Index controller 35 | */ 36 | @Controller 37 | @RequestMapping("/") 38 | public class IndexController { 39 | 40 | /** 41 | * return the index page 42 | */ 43 | @GetMapping 44 | public String indexPage(Map model, HttpServletRequest request) { 45 | model.put("requestURL", request.getRequestURL()); 46 | return "index"; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /adapter/src/main/java/org/niis/xroad/restadapterservice/endpoint/AbstractEndpoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * Copyright © 2018 Nordic Institute for Interoperability Solutions (NIIS) 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | */ 23 | package org.niis.xroad.restadapterservice.endpoint; 24 | 25 | /** 26 | * This abstract class is a base class for ProviderEndpoint and ConsumerEndpoint 27 | * classes. 28 | * 29 | * @author Petteri Kivimäki 30 | */ 31 | public abstract class AbstractEndpoint { 32 | 33 | private String serviceId; 34 | private String httpVerb; 35 | private String namespaceSerialize; 36 | private String namespaceDeserialize; 37 | private String prefix; 38 | private Boolean processingWrappers; 39 | private boolean requestEncrypted; 40 | private boolean responseEncrypted; 41 | 42 | /** 43 | * Constructs and initializes a new AbstractEndpoint object. 44 | * 45 | * @param serviceId unique ID of the service 46 | */ 47 | public AbstractEndpoint(String serviceId) { 48 | this.serviceId = serviceId; 49 | } 50 | 51 | /** 52 | * Returns the unique ID of the service. 53 | * 54 | * @return unique ID of the service 55 | */ 56 | public String getServiceId() { 57 | return serviceId; 58 | } 59 | 60 | /** 61 | * Sets the unique ID of the service. 62 | * 63 | * @param serviceId new value 64 | */ 65 | public void setServiceId(String serviceId) { 66 | this.serviceId = serviceId; 67 | } 68 | 69 | /** 70 | * Returns the HTTP verb that is used in the request. 71 | * 72 | * @return HTTP verb that is used in the request 73 | */ 74 | public String getHttpVerb() { 75 | return httpVerb; 76 | } 77 | 78 | /** 79 | * Sets the HTTP verb that is used in the request. 80 | * 81 | * @param httpVerb new value 82 | */ 83 | public void setHttpVerb(String httpVerb) { 84 | this.httpVerb = httpVerb; 85 | } 86 | 87 | /** 88 | * Returns the request namespace of this Endpoint. 89 | * 90 | * @return request namespace of this Endpoint 91 | */ 92 | public String getNamespaceDeserialize() { 93 | return namespaceDeserialize; 94 | } 95 | 96 | /** 97 | * Sets the request namespace of this Endpoint. 98 | * 99 | * @param namespaceDeserialize new value 100 | */ 101 | public void setNamespaceDeserialize(String namespaceDeserialize) { 102 | this.namespaceDeserialize = namespaceDeserialize; 103 | } 104 | 105 | /** 106 | * Returns the response namespace of this Endpoint. 107 | * 108 | * @return response namespace of this Endpoint 109 | */ 110 | public String getNamespaceSerialize() { 111 | return namespaceSerialize; 112 | } 113 | 114 | /** 115 | * Sets the response namespace of this Endpoint. 116 | * 117 | * @param namespaceSerialize new value 118 | */ 119 | public void setNamespaceSerialize(String namespaceSerialize) { 120 | this.namespaceSerialize = namespaceSerialize; 121 | } 122 | 123 | /** 124 | * Returns the response namespace prefix of this Endpoint. 125 | * 126 | * @return response namespace prefix of this Endpoint 127 | */ 128 | public String getPrefix() { 129 | return prefix; 130 | } 131 | 132 | /** 133 | * Sets the response namespace prefix of this Endpoint. 134 | * 135 | * @param prefix new value 136 | */ 137 | public void setPrefix(String prefix) { 138 | this.prefix = prefix; 139 | } 140 | 141 | /** 142 | * @return True/False indicating whether and tags are 143 | * expected in incoming and outgoing SOAP message bodies, or a null value 144 | * indicating no setting. 145 | */ 146 | public Boolean isProcessingWrappers() { 147 | return this.processingWrappers; 148 | } 149 | 150 | /** 151 | * set whether and tags are expected in incoming and 152 | * outgoing SOAP message bodies. 153 | * 154 | * @param processingWrappers 155 | */ 156 | public void setProcessingWrappers(Boolean processingWrappers) { 157 | this.processingWrappers = processingWrappers; 158 | } 159 | 160 | /** 161 | * Returns true if and only if the request data is encrypted. 162 | * 163 | * @return true if and only if the request data is encrypted 164 | */ 165 | public boolean isRequestEncrypted() { 166 | return requestEncrypted; 167 | } 168 | 169 | /** 170 | * Sets the value that tells is the request data is encrypted. 171 | * 172 | * @param requestEncrypted new value 173 | */ 174 | public void setRequestEncrypted(boolean requestEncrypted) { 175 | this.requestEncrypted = requestEncrypted; 176 | } 177 | 178 | /** 179 | * Returns true if and only if the response data is encrypted. 180 | * 181 | * @return true if and only if the response data is encrypted 182 | */ 183 | public boolean isResponseEncrypted() { 184 | return responseEncrypted; 185 | } 186 | 187 | /** 188 | * Sets the value that tells is the response data is encrypted. 189 | * 190 | * @param responseEncrypted new value 191 | */ 192 | public void setResponseEncrypted(boolean responseEncrypted) { 193 | this.responseEncrypted = responseEncrypted; 194 | } 195 | 196 | } 197 | -------------------------------------------------------------------------------- /adapter/src/main/java/org/niis/xroad/restadapterservice/endpoint/ConsumerEndpoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * Copyright © 2018 Nordic Institute for Interoperability Solutions (NIIS) 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | */ 23 | package org.niis.xroad.restadapterservice.endpoint; 24 | 25 | import org.niis.xrd4j.common.member.ConsumerMember; 26 | import org.niis.xrd4j.common.member.ProducerMember; 27 | 28 | import lombok.extern.slf4j.Slf4j; 29 | 30 | /** 31 | * This class represents consumer endpoint and holds all the information that 32 | * is needed for publishing it. Consumer endpoint is identified by the 33 | * combination of HTTP verb and resource path, which is the part after 34 | * the base URL. E.g. http://base.com/resource-path. Resource path may contain 35 | * one or more resource id's that are marked as {resourceId}. E.g. 36 | * http://base.com/resource-path/{resourceId}/str/{resourceId}. The value 37 | * of the resource id variable is the rest of the URL starting from the first 38 | * curly bracket "{". E.g. "{resourceId}/str/{resourceId}". 39 | * 40 | * Client id is X-Road client id that must be defined on subsystem level: 41 | * instance.memberClass.memberCode.subsystem. Service id is X-Road service id 42 | * that must defined on service level: 43 | * instance.memberClass.memberCode.subsystem.service.version 44 | * 45 | * @author Petteri Kivimäki 46 | */ 47 | @Slf4j 48 | public class ConsumerEndpoint extends AbstractEndpoint { 49 | 50 | /** 51 | * X-Road service id that is called. 52 | */ 53 | private String clientId; 54 | /** 55 | * Resource path is the part after the base URL that identiefies this 56 | * ConsumerEndpoint. 57 | */ 58 | private String resourcePath; 59 | /** 60 | * Resource id is part of resource path and it identifies a single resource, 61 | * and therefore it's not fixed. The value of the resource id may vary 62 | * between requests even if the requests are targeted to the same endpoint 63 | * and resource path. 64 | */ 65 | private String resourceId; 66 | /** 67 | * X-Road consumer member, the client. 68 | */ 69 | private ConsumerMember consumer; 70 | /** 71 | * X-Road producer member, the service. 72 | */ 73 | private ProducerMember producer; 74 | /** 75 | * Boolean value that indicates if URLs in the response body should 76 | * be modified to point the Consumer Endpoint instance. 77 | */ 78 | private boolean modifyUrl; 79 | 80 | /** 81 | * Boolean value that indicates if request body (if any) should 82 | * be converted from JSON to XML. 83 | */ 84 | private boolean convertPost; 85 | 86 | /** 87 | * Constructs and initializes a new ProviderEndpoint object. 88 | * 89 | * @param serviceId unique ID of the service to be called 90 | * @param clientId client id of this ConsumerEndpoint 91 | * @param resourcePath resource path of the Adapter Service 92 | */ 93 | public ConsumerEndpoint(String serviceId, String clientId, String resourcePath) { 94 | super(serviceId); 95 | this.clientId = clientId; 96 | this.resourcePath = resourcePath; 97 | this.modifyUrl = false; 98 | } 99 | 100 | /** 101 | * Returns the resource path of this ConsumerEndpoint. 102 | * 103 | * @return resource path of this ConsumerEndpoint 104 | */ 105 | public String getResourcePath() { 106 | return resourcePath; 107 | } 108 | 109 | /** 110 | * Sets the resource path of this ConsumerEndpoint. 111 | * 112 | * @param resourcePath new value 113 | */ 114 | public void setResourcePath(String resourcePath) { 115 | this.resourcePath = resourcePath; 116 | } 117 | 118 | /** 119 | * Returns the client id of this ConsumerEndpoint. 120 | * 121 | * @return client id of this ConsumerEndpoint 122 | */ 123 | public String getClientId() { 124 | return clientId; 125 | } 126 | 127 | /** 128 | * Sets the client id of this ConsumerEndpoint. 129 | * 130 | * @param clientId new value 131 | */ 132 | public void setClientId(String clientId) { 133 | this.clientId = clientId; 134 | } 135 | 136 | /** 137 | * Returns the resource id value. 138 | * 139 | * @return resource id value 140 | */ 141 | public String getResourceId() { 142 | return resourceId; 143 | } 144 | 145 | /** 146 | * Sets the resource id value. 147 | * 148 | * @param resourceId new value 149 | */ 150 | public void setResourceId(String resourceId) { 151 | this.resourceId = resourceId; 152 | } 153 | 154 | /** 155 | * Returns the X-Road consumer member. 156 | * 157 | * @return X-Road consumer member 158 | */ 159 | public ConsumerMember getConsumer() { 160 | return consumer; 161 | } 162 | 163 | /** 164 | * Sets the X-Road consumer member. 165 | * 166 | * @param consumer X-Road consumer member 167 | */ 168 | public void setConsumer(ConsumerMember consumer) { 169 | this.consumer = consumer; 170 | } 171 | 172 | /** 173 | * Returns the X-Road producer member. 174 | * 175 | * @return X-Road producer member 176 | */ 177 | public ProducerMember getProducer() { 178 | return producer; 179 | } 180 | 181 | /** 182 | * Sets the X-Road producer member. 183 | * 184 | * @param producer X-Road producer member 185 | */ 186 | public void setProducer(ProducerMember producer) { 187 | this.producer = producer; 188 | } 189 | 190 | /** 191 | * Returns a boolean value that indicates if URLs in the response body 192 | * should be modified to point the Consumer Endpoint instance. 193 | * 194 | * @return true if and only if the URLs should be modified; otherwise false 195 | */ 196 | public boolean isModifyUrl() { 197 | return modifyUrl; 198 | } 199 | 200 | /** 201 | * Sets a boolean value that indicates if URLs in the response body 202 | * should be modified to point the Consumer Endpoint instance. 203 | * 204 | * @param modifyUrl 205 | */ 206 | public void setModifyUrl(boolean modifyUrl) { 207 | this.modifyUrl = modifyUrl; 208 | } 209 | 210 | public boolean isConvertPost() { 211 | return convertPost; 212 | } 213 | 214 | public void setConvertPost(boolean convertPost) { 215 | this.convertPost = convertPost; 216 | } 217 | } 218 | -------------------------------------------------------------------------------- /adapter/src/main/java/org/niis/xroad/restadapterservice/endpoint/ProviderEndpoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * Copyright © 2018 Nordic Institute for Interoperability Solutions (NIIS) 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | */ 23 | package org.niis.xroad.restadapterservice.endpoint; 24 | 25 | /** 26 | * This class represents provider endpoint and holds all the information that is 27 | * needed for connecting to it. 28 | * 29 | * @author Petteri Kivimäki 30 | */ 31 | public class ProviderEndpoint extends AbstractEndpoint { 32 | 33 | private String url; 34 | private String accept; 35 | private String contentType; 36 | private boolean attachment; 37 | private boolean sendXrdHeaders; 38 | private String reqParamNameFilterCondition; 39 | private String reqParamNameFilterOperation; 40 | private String reqParamValueFilterCondition; 41 | private String reqParamValueFilterOperation; 42 | 43 | /** 44 | * Constructs and initializes a new ProviderEndpoint object. 45 | * 46 | * @param serviceId unique ID of the service 47 | * @param url URL of the Adapter Service 48 | */ 49 | public ProviderEndpoint(String serviceId, String url) { 50 | super(serviceId); 51 | this.url = url; 52 | this.sendXrdHeaders = true; 53 | this.attachment = false; 54 | } 55 | 56 | /** 57 | * Returns the URL of the Adapter Service. 58 | * 59 | * @return URL of the Adapter Service 60 | */ 61 | public String getUrl() { 62 | return url; 63 | } 64 | 65 | /** 66 | * Sets the URL of the Adapter Service. 67 | * 68 | * @param url new value 69 | */ 70 | public void setUrl(String url) { 71 | this.url = url; 72 | } 73 | 74 | /** 75 | * Returns the value of the accept header that's used in the request. 76 | * 77 | * @return value of the accept header that's used in the request 78 | */ 79 | public String getAccept() { 80 | return accept; 81 | } 82 | 83 | /** 84 | * Sets the value of the accept header that's used in the request. 85 | * 86 | * @param accept new value 87 | */ 88 | public void setAccept(String accept) { 89 | this.accept = accept; 90 | } 91 | 92 | /** 93 | * Returns the value of the content type header that's used in the request. 94 | * 95 | * @return value of the content type header that's used in the request 96 | */ 97 | public String getContentType() { 98 | return contentType; 99 | } 100 | 101 | /** 102 | * Sets the value of the content type header that's used in the request. 103 | * 104 | * @param contentType new value 105 | */ 106 | public void setContentType(String contentType) { 107 | this.contentType = contentType; 108 | } 109 | 110 | /** 111 | * Returns a boolean value that tells if X-Road specific HTTP headers should 112 | * be sent with the request. 113 | * 114 | * @return true if and only if headers must be sent; otherwise false 115 | */ 116 | public boolean isSendXrdHeaders() { 117 | return sendXrdHeaders; 118 | } 119 | 120 | /** 121 | * Sets the boolean value that tells if X-Road specific HTTP headers should 122 | * be sent with the request. 123 | * 124 | * @param sendXrdHeaders new value 125 | */ 126 | public void setSendXrdHeaders(boolean sendXrdHeaders) { 127 | this.sendXrdHeaders = sendXrdHeaders; 128 | } 129 | 130 | /** 131 | * Returns true if and only if the response data is passed as SOAP 132 | * attachment. Otherwise false. 133 | * 134 | * @return true if and only if the response data is passed as SOAP 135 | * attachment; otherwise false 136 | */ 137 | public boolean isAttachment() { 138 | return attachment; 139 | } 140 | 141 | /** 142 | * Sets the boolean value that defines if the response data is passed as 143 | * SOAP attachment 144 | * 145 | * @param attachment new value 146 | */ 147 | public void setAttachment(boolean attachment) { 148 | this.attachment = attachment; 149 | } 150 | 151 | /** 152 | * Returns the value of the request parameter name filter condition that's 153 | * used for modifying request parameter names. Filtering is done using 154 | * regex. 155 | * 156 | * @return value of the request parameter name filter condition 157 | */ 158 | public String getReqParamNameFilterCondition() { 159 | return this.reqParamNameFilterCondition; 160 | } 161 | 162 | /** 163 | * Sets the value of the request parameter name filter condition that's used 164 | * for modifying request parameter names. Filtering is done using regex. 165 | * 166 | * @param reqParamNameFilterCondition new value 167 | */ 168 | public void setReqParamNameFilterCondition(String reqParamNameFilterCondition) { 169 | this.reqParamNameFilterCondition = reqParamNameFilterCondition; 170 | } 171 | 172 | /** 173 | * Returns the value of the request parameter name filter operation that's 174 | * used for modifying request parameter names. Filtering is done using 175 | * regex. Operation is executed if and only if request parameter name 176 | * matches the condition. 177 | * 178 | * @return value of the request parameter name filter operation 179 | */ 180 | public String getReqParamNameFilterOperation() { 181 | return this.reqParamNameFilterOperation; 182 | } 183 | 184 | /** 185 | * Sets the value of the request parameter name filter operation that's used 186 | * for modifying request parameter names. Filtering is done using regex. 187 | * Operation is executed if and only if request parameter name matches the 188 | * condition. 189 | * 190 | * @param reqParamNameFilterOperation new value 191 | */ 192 | public void setReqParamNameFilterOperation(String reqParamNameFilterOperation) { 193 | this.reqParamNameFilterOperation = reqParamNameFilterOperation; 194 | } 195 | 196 | /** 197 | * Returns the value of the request parameter value filter condition that's 198 | * used for modifying request parameter values. Filtering is done using 199 | * regex. 200 | * 201 | * @return value of the request parameter value filter condition 202 | */ 203 | public String getReqParamValueFilterCondition() { 204 | return reqParamValueFilterCondition; 205 | } 206 | 207 | /** 208 | * Sets the value of the request parameter value filter condition that's 209 | * used for modifying request parameter values. Filtering is done using 210 | * regex. 211 | * 212 | * @param reqParamValueFilterCondition new value 213 | */ 214 | public void setReqParamValueFilterCondition(String reqParamValueFilterCondition) { 215 | this.reqParamValueFilterCondition = reqParamValueFilterCondition; 216 | } 217 | 218 | /** 219 | * Returns the value of the request parameter value filter operation that's 220 | * used for modifying request parameter values. Filtering is done using 221 | * regex. Operation is executed if and only if request parameter value 222 | * matches the condition. 223 | * 224 | * @return value of the request parameter value filter operation 225 | */ 226 | public String getReqParamValueFilterOperation() { 227 | return this.reqParamValueFilterOperation; 228 | } 229 | 230 | /** 231 | * Sets the value of the request parameter value filter operation that's 232 | * used for modifying request parameter values. Filtering is done using 233 | * regex. Operation is executed if and only if request parameter value 234 | * matches the condition. 235 | * 236 | * @param reqParamValueFilterOperation new value 237 | */ 238 | public void setReqParamValueFilterOperation(String reqParamValueFilterOperation) { 239 | this.reqParamValueFilterOperation = reqParamValueFilterOperation; 240 | } 241 | } 242 | -------------------------------------------------------------------------------- /adapter/src/main/java/org/niis/xroad/restadapterservice/filter/ConsumerURIFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * Copyright © 2018 Nordic Institute for Interoperability Solutions (NIIS) 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | */ 23 | package org.niis.xroad.restadapterservice.filter; 24 | 25 | 26 | import lombok.extern.slf4j.Slf4j; 27 | 28 | import jakarta.servlet.Filter; 29 | import jakarta.servlet.FilterChain; 30 | import jakarta.servlet.FilterConfig; 31 | import jakarta.servlet.ServletException; 32 | import jakarta.servlet.ServletRequest; 33 | import jakarta.servlet.ServletResponse; 34 | import jakarta.servlet.http.HttpServletRequest; 35 | 36 | import java.io.IOException; 37 | 38 | /** 39 | * This filter is responsible of filtering each request to "Consumer/*" URI. The 40 | * part after "Consumer/" is removed and stored in an attribute. The request is 41 | * then redirected to ConsumerEndpoint servlet that takes cares of processing 42 | * it. 43 | * 44 | * @author Petteri Kivimäki 45 | */ 46 | @Slf4j 47 | public class ConsumerURIFilter implements Filter { 48 | 49 | 50 | @Override 51 | public void init(FilterConfig fc) throws ServletException { 52 | log.info("Consumer URI filter initialized."); 53 | } 54 | 55 | @Override 56 | public void doFilter(ServletRequest req, ServletResponse res, FilterChain fc) throws IOException, ServletException { 57 | HttpServletRequest request = (HttpServletRequest) req; 58 | String servletName = "Consumer"; 59 | String oldURI = request.getRequestURI().substring(request.getContextPath().length() + 1); 60 | log.debug("Incoming request : \"{}\"", oldURI); 61 | 62 | if (oldURI.length() > servletName.length()) { 63 | String resourcePath = oldURI.substring(oldURI.indexOf('/')); 64 | if (!"/".equals(resourcePath)) { 65 | // Path must end with "/" 66 | if (!resourcePath.endsWith("/")) { 67 | resourcePath += "/"; 68 | } 69 | log.debug("Resource path : \"{}\"", resourcePath); 70 | request.setAttribute("resourcePath", resourcePath); 71 | } else { 72 | log.trace("Found resource path \"{}\" is not valid.", resourcePath); 73 | } 74 | } else { 75 | log.trace("No resource path found."); 76 | } 77 | req.getRequestDispatcher("Consumer").forward(req, res); 78 | } 79 | 80 | @Override 81 | public void destroy() { 82 | // Nothing to do here. 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /adapter/src/main/java/org/niis/xroad/restadapterservice/util/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * Copyright © 2018 Nordic Institute for Interoperability Solutions (NIIS) 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | */ 23 | package org.niis.xroad.restadapterservice.util; 24 | 25 | /** 26 | * REST Gateway constants. 27 | * 28 | * @author Petteri Kivimäki 29 | */ 30 | public final class Constants { 31 | 32 | /** 33 | * Properties files 34 | */ 35 | public static final String PROPERTIES_FILE_PROVIDER_GATEWAY = "/provider-gateway.properties"; 36 | public static final String PROPERTIES_FILE_CONSUMER_GATEWAY = "/consumer-gateway.properties"; 37 | public static final String PROPERTIES_FILE_PROVIDERS = "/providers.properties"; 38 | public static final String PROPERTIES_FILE_CONSUMERS = "/consumers.properties"; 39 | /** 40 | * Endpoint properties - used by both provider and consumer endpoints 41 | */ 42 | public static final String ENDPOINT_PROPS_ID = "id"; 43 | public static final String ENDPOINT_PROPS_VERB = "verb"; 44 | public static final String ENDPOINT_PROPS_SERVICE_NAMESPACE_DESERIALIZE = "namespace.deserialize"; 45 | public static final String ENDPOINT_PROPS_SERVICE_NAMESPACE_SERIALIZE = "namespace.serialize"; 46 | public static final String ENDPOINT_PROPS_SERVICE_NAMESPACE_PREFIX_SERIALIZE = "namespace.prefix.serialize"; 47 | public static final String ENDPOINT_PROPS_WRAPPERS = "wrappers"; 48 | public static final String ENDPOINT_PROPS_REQUEST_ENCRYPTED = "request.encrypted"; 49 | public static final String ENDPOINT_PROPS_RESPONSE_ENCRYPTED = "response.encrypted"; 50 | /** 51 | * Provider properties 52 | */ 53 | public static final String PROVIDER_PROPS_URL = "url"; 54 | public static final String PROVIDER_PROPS_CONTENT_TYPE = "contenttype"; 55 | public static final String PROVIDER_PROPS_ACCEPT = "accept"; 56 | public static final String PROVIDER_PROPS_ATTACHMENT = "response.attachment"; 57 | public static final String PROVIDER_PROPS_SEND_XRD_HEADERS = "request.xrdheaders"; 58 | public static final String PROVIDER_PROPS_REQUEST_PARAM_NAME_FILTER_CONDITION = "reqParamNameFilterCondition"; 59 | public static final String PROVIDER_PROPS_REQUEST_PARAM_NAME_FILTER_OPERATION = "reqParamNameFilterOperation"; 60 | public static final String PROVIDER_PROPS_REQUEST_PARAM_VALUE_FILTER_CONDITION = "reqParamValueFilterCondition"; 61 | public static final String PROVIDER_PROPS_REQUEST_PARAM_VALUE_FILTER_OPERATION = "reqParamValueFilterOperation"; 62 | /** 63 | * Consumer properties 64 | */ 65 | public static final String CONSUMER_PROPS_PATH = "path"; 66 | public static final String CONSUMER_PROPS_ID_CLIENT = "id.client"; 67 | public static final String CONSUMER_PROPS_SECURITY_SERVER_URL = "ss.url"; 68 | public static final String CONSUMER_PROPS_MOD_URL = "response.modurl"; 69 | public static final String CONSUMER_PROPS_SVC_CALLS_BY_XRD_SVC_ID_ENABLED = "serviceCallsByXRdServiceId.enabled"; 70 | public static final String CONSUMER_PROPS_CONVERT_POST = "convertPost"; 71 | /** 72 | * Encryption properties 73 | */ 74 | public static final String ENCRYPTION_PROPS_KEY_LENGTH = "keyLength"; 75 | public static final String ENCRYPTION_PROPS_PUBLIC_KEY_FILE = "publicKeyFile"; 76 | public static final String ENCRYPTION_PROPS_PUBLIC_KEY_FILE_PASSWORD = "publicKeyFilePassword"; 77 | public static final String ENCRYPTION_PROPS_PRIVATE_KEY_FILE = "privateKeyFile"; 78 | public static final String ENCRYPTION_PROPS_PRIVATE_KEY_FILE_PASSWORD = "privateKeyFilePassword"; 79 | public static final String ENCRYPTION_PROPS_PRIVATE_KEY_ALIAS = "privateKeyAlias"; 80 | public static final String ENCRYPTION_PROPS_PRIVATE_KEY_PASSWORD = "privateKeyPassword"; 81 | /** 82 | * Standard HTTP headers 83 | */ 84 | public static final String HTTP_HEADER_ACCEPT = "Accept"; 85 | public static final String HTTP_HEADER_CONTENT_TYPE = "Content-Type"; 86 | /** 87 | * X-Road specific custom HTTP headers 88 | */ 89 | public static final String XRD_HEADER_CLIENT = "X-XRd-Client"; 90 | public static final String XRD_HEADER_SERVICE = "X-XRd-Service"; 91 | public static final String XRD_HEADER_USER_ID = "X-XRd-UserId"; 92 | public static final String XRD_HEADER_MESSAGE_ID = "X-XRd-MessageId"; 93 | public static final String XRD_HEADER_NAMESPACE_SERIALIZE = "X-XRd-NamespaceSerialize"; 94 | public static final String XRD_HEADER_NAMESPACE_PREFIX_SERIALIZE = "X-XRd-NamespacePrefixSerialize"; 95 | /** 96 | * Other constants. 97 | */ 98 | public static final String PARAM_REQUEST_BODY = "RESTGatewayRequestBody"; 99 | public static final String PARAM_RESOURCE_ID = "resourceId"; 100 | public static final String PARAM_ENCRYPTION_WRAPPER = "encryptionWrapper"; 101 | public static final String PARAM_ENCRYPTED = "encrypted"; 102 | public static final String PARAM_IV = "iv"; 103 | public static final String PARAM_KEY = "key"; 104 | /** 105 | * Parameter names 106 | */ 107 | public static final String PROPERTIES_DIR_PARAM_NAME = "propertiesDirectory"; 108 | /** 109 | * Properties default directory name 110 | */ 111 | public static final String PROPERTIES_DIR_NAME = "rest-adapter-service"; 112 | 113 | /** 114 | * HTTP status codes 115 | */ 116 | public static final int HTTP_OK = 200; 117 | public static final int HTTP_INTERNAL_ERROR = 500; 118 | public static final int HTTP_NOT_FOUND = 404; 119 | 120 | /** 121 | * HTTP error messages 122 | */ 123 | public static final String ERROR_404 = "404 Not Found"; 124 | public static final String ERROR_422 = "422 Unprocessable Entity. Missing request data."; 125 | public static final String ERROR_500 = "500 Internal Server Error"; 126 | // HTTP Headers 127 | /** 128 | * Content-Type: text/xml 129 | */ 130 | public static final String TEXT_XML = "text/xml"; 131 | /** 132 | * Content-Type: application/xml 133 | */ 134 | public static final String APPLICATION_XML = "application/xml"; 135 | /** 136 | * Content-Type: application/json 137 | */ 138 | public static final String APPLICATION_JSON = "application/json"; 139 | /** 140 | * Character set UTF-8 141 | */ 142 | public static final String CHARSET_UTF8 = "charset=utf-8"; 143 | /** 144 | * Constants for logging. 145 | */ 146 | public static final String LOG_STRING_FOR_SETTINGS = "\"{}\" setting found. Value : \"{}\"."; 147 | public static final String LOG_STRING_FOR_HEADERS = "{} : {}"; 148 | 149 | /** 150 | * Constructs and initializes a new Constants object. Should never be used. 151 | */ 152 | private Constants() { 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /adapter/src/main/packages/config/application.properties: -------------------------------------------------------------------------------- 1 | # change this to customize port 2 | server.port=8080 3 | -------------------------------------------------------------------------------- /adapter/src/main/packages/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:7 2 | MAINTAINER "Janne Mattila" 3 | 4 | ENV LANG en_US.UTF-8 5 | ENV LC_ALL en_US.UTF-8 6 | ENV JAVA_HOME /etc/alternatives/java_sdk_1.8.0_openjdk 7 | 8 | RUN yum install -y sudo rpm-build wget java-1.8.0-openjdk-devel 9 | 10 | RUN cd /usr/local && wget -q https://archive.apache.org/dist/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz && tar xzf apache-maven-3.5.2-bin.tar.gz && ln -s apache-maven-3.5.2 maven 11 | 12 | RUN yum clean all 13 | RUN sed -i 's/requiretty/!requiretty/' /etc/sudoers 14 | 15 | USER root 16 | CMD /usr/local/maven/bin/mvn -f workspace/pom.xml clean install -P package-rpm -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn 17 | -------------------------------------------------------------------------------- /adapter/src/main/packages/systemd/preinstall: -------------------------------------------------------------------------------- 1 | if ! id rest-adapter-service > /dev/null 2>&1 ; then 2 | adduser --system --no-create-home --shell /bin/false rest-adapter-service 3 | fi 4 | -------------------------------------------------------------------------------- /adapter/src/main/packages/systemd/rest-adapter-service: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -x 3 | exec java -DpropertiesDirectory=/etc/rest-adapter-service -jar /usr/lib/rest-adapter-service/rest-adapter-service.war --spring.config.location=/etc/rest-adapter-service/ 4 | 5 | -------------------------------------------------------------------------------- /adapter/src/main/packages/systemd/rest-adapter-service.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=REST Adapter Service 3 | After=network.target 4 | 5 | [Service] 6 | PermissionsStartOnly=true 7 | User=rest-adapter-service 8 | Group=rest-adapter-service 9 | ExecStart=/usr/bin/rest-adapter-service 10 | Restart=on-failure 11 | SuccessExitStatus=143 12 | 13 | [Install] 14 | WantedBy=multi-user.target 15 | 16 | -------------------------------------------------------------------------------- /adapter/src/main/profiles/encrypted/consumer-gateway.properties: -------------------------------------------------------------------------------- 1 | id.client=FI_PILOT.GOV.0245437-2.ConsumerService 2 | ss.url=http://localhost:@rest.adapter.profile.port@/rest-adapter-service/Provider 3 | # Namespace for ServiceRequest 4 | namespace.serialize=http://x-road.global/producer 5 | namespace.prefix.serialize=ts1 6 | # Namespace for incoming ServiceResponse 7 | namespace.deserialize=http://x-road.global/producer 8 | # Allow service calls by X-Road service id 9 | serviceCallsByXRdServiceId.enabled=true 10 | # Optional - Expect / -tags in SOAP body. default : true 11 | # N.B. Individual consumers may override this setting in consumers.properties 12 | wrappers=false 13 | # Key length (in bits) of symmetric key. Default is 128 bits. 14 | # NB! Longer key requires installing unlimited key file: 15 | # http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html 16 | keyLength=128 17 | # Absolute path of the trust store file where public keys are stored 18 | publicKeyFile=@projectDir@/build/resources/main/resources-bin/consumertruststore.jks 19 | # Password of the trust store file 20 | publicKeyFilePassword=consumerts 21 | # Absolute path of the key store file where the private key is stored 22 | privateKeyFile=@projectDir@/build/resources/main/resources-bin/consumerkeystore.jks 23 | # Password of the key store file 24 | privateKeyFilePassword=consumerks 25 | # Alias of the private key 26 | privateKeyAlias=consumerpri 27 | # Password of the private key 28 | # N.B. if storetype is PKCS12, key password must be the same as the keystore password 29 | privateKeyPassword=consumer 30 | -------------------------------------------------------------------------------- /adapter/src/main/profiles/encrypted/consumers.properties: -------------------------------------------------------------------------------- 1 | # Required (X-Road service id) 2 | # x.id= 3 | # Optional (X-Road client id) 4 | # x.id.client= 5 | # Required 6 | # x.path= 7 | # Required (get, put, post, delete) 8 | # x.verb= 9 | # Required - Namespace for incoming ServiceResponses 10 | # If not defined, default value from rest-gateway.properties is used 11 | # x.namespace.deserialize= 12 | # Required - namespace for ServiceRequests that are sent 13 | # If not defined, default value from rest-gateway.properties is used 14 | # x.namespace.serialize= 15 | # Required - namespace prefix for ServiceRequest 16 | # If not defined, default value from rest-gateway.properties is used 17 | # x.namespace.prefix.serialize= 18 | # Optional - default : false 19 | # x.response.modurl= 20 | # Optional - Expect / -tags in SOAP message bodies. default : true 21 | # If defined, also overrides setting from consumer-gateway.properties 22 | # x.wrappers= 23 | # Optional - If set to true, request is encrypted. Default : false 24 | # If value is true, all the settings related to encryption must be defined 25 | # in consumer-gateway.properties file. 26 | # x.request.encrypted= 27 | # Optional - If set to true, expects response to be encrypted. Default : false 28 | # If value is true, all the settings related to encryption must be defined 29 | # in consumer-gateway.properties file. 30 | # x.response.encrypted= 31 | 0.id=FI_PILOT.GOV.1019125-0.Demo2Service.getOrganizationList.v1 32 | 0.id.client=FI_PILOT.GOV.0245437-2.ConsumerTest 33 | 0.path=/www.hel.fi/palvelukarttaws/rest/v4/organization/ 34 | 0.verb=get 35 | 0.request.encrypted=true 36 | 0.response.encrypted=true 37 | 1.id=FI_PILOT.GOV.1019125-0.Demo2Service.getDepartment.v1 38 | 1.path=/www.hel.fi/palvelukarttaws/rest/v4/department/{resourceId} 39 | 1.verb=get 40 | 1.request.encrypted=true 41 | 1.response.encrypted=true 42 | 2.id=FI_PILOT.GOV.1019125-0.Demo2Service.getLibrary.v1 43 | 2.path=/api.kirjastot.fi/v3/organisation/ 44 | 2.verb=get 45 | 2.request.encrypted=true 46 | 2.response.encrypted=true 47 | 3.id=FI_PILOT.GOV.1019125-0.Demo2Service.searchCompany.v1 48 | 3.path=/avoindata.prh.fi/opendata/bis/v1/ 49 | 3.verb=get 50 | 3.response.modurl=true 51 | 3.request.encrypted=true 52 | 3.response.encrypted=true 53 | 4.id=FI_PILOT.GOV.1019125-0.Demo2Service.getRandomRecipes.v1 54 | 4.path=/represent.opennorth.ca/representative-sets/ontario-legislature/ 55 | 4.response.modurl=true 56 | 4.request.encrypted=true 57 | 4.response.encrypted=true 58 | 5.id=FI_PILOT.GOV.1019125-0.Demo2Service.fintoService.v1 59 | 5.path=/api.finto.fi/rest/v1/search/ 60 | 5.verb=get 61 | 5.request.encrypted=true 62 | 5.response.encrypted=true 63 | 6.id=FI_PILOT.GOV.1019125-0.Demo2Service.getFinnaRecord.v1 64 | 6.path=/api.finna.fi/v1/record/ 65 | 6.verb=get 66 | 6.request.encrypted=true 67 | 6.response.encrypted=true 68 | 69 | ## Tests with Custom API 70 | ## GET 71 | #7.id=FI_PILOT.GOV.1019125-0.Demo2Service.getUsers.v1 72 | #7.path=/localhost:8081/users 73 | #7.verb=get 74 | #8.id=FI_PILOT.GOV.1019125-0.Demo2Service.getUsers.v1 75 | #8.path=/localhost:8081/users 76 | #8.verb=get 77 | ## POST 78 | #9.id=FI_PILOT.GOV.1019125-0.Demo2Service.postUser.v1 79 | #9.path=/localhost:8081/user 80 | #9.verb=post 81 | ##9.convertPost=true 82 | ## DELETE 83 | #10.id=FI_PILOT.GOV.1019125-0.Demo2Service.deleteUser.v1 84 | #10.path=/localhost:8081/user/{resourceId} 85 | #10.verb=delete 86 | ## GET 1 87 | #11.id=FI_PILOT.GOV.1019125-0.Demo2Service.getUser.v1 88 | #11.path=/localhost:8081/user/{resourceId} 89 | #11.verb=get 90 | -------------------------------------------------------------------------------- /adapter/src/main/profiles/encrypted/provider-gateway.properties: -------------------------------------------------------------------------------- 1 | wsdl.path=provider-gateway.wsdl 2 | # Namespace for ServiceResponse 3 | namespace.serialize=http://x-road.global/producer 4 | namespace.prefix.serialize=ts1 5 | # Namespace for incoming ServiceRequest 6 | # namespace.deserialize=* 7 | namespace.deserialize=http://x-road.global/producer 8 | # Optional - Expect / -tags in SOAP body. default : true 9 | # N.B. Individual providers may override this setting in providers.properties 10 | wrappers=false 11 | # Key length (in bits) of symmetric key. Default is 128 bits. 12 | # NB! Longer key requires installing unlimited key file: 13 | # http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html 14 | keyLength=128 15 | # Absolute path of the trust store file where public keys are stored 16 | publicKeyFile=@projectDir@/build/resources/main/resources-bin/producertruststore.jks 17 | # Password of the trust store file 18 | publicKeyFilePassword=providerts 19 | # Absolute path of the key store file where the private key is stored 20 | privateKeyFile=@projectDir@/build/resources/main/resources-bin/providerkeystore.jks 21 | # Password of the key store file 22 | privateKeyFilePassword=providerks 23 | # Alias of the private key 24 | privateKeyAlias=providerpri 25 | # Password of the private key 26 | # N.B. if storetype is PKCS12, key password must be the same as the keystore password 27 | privateKeyPassword=provider -------------------------------------------------------------------------------- /adapter/src/main/profiles/encrypted/providers.properties: -------------------------------------------------------------------------------- 1 | # Required (X-Road service id) 2 | # x.id= 3 | # Required 4 | # x.url= 5 | # Optional - default : GET 6 | # x.verb= 7 | # Optional - default : - (not used) 8 | # x.contenttype= 9 | # Optional - default : - (not used) 10 | # x.accept= 11 | # Optional - defaul : false 12 | # x.response.attachment= 13 | # Optional - default : true 14 | # x.request.xrdheaders= 15 | # Optional - Namespace for incoming ServiceRequest 16 | # If not defined, default value from rest-gateway.properties is used 17 | # x.namespace.deserialize= 18 | # Optional - namespace for ServiceResponse 19 | # If not defined, default value from rest-gateway.properties is used 20 | # x.namespace.serialize= 21 | # Optional - namespace prefix for ServiceResponse 22 | # If not defined, default value from rest-gateway.properties is used 23 | # x.namespace.prefix.serialize= 24 | # Optional - Expect / -tags in SOAP message bodies. default : true 25 | # If defined, also overrides setting from provider-gateway.properties 26 | # x.wrappers= 27 | # Optional - Request parameter name filter condition that's used for modifying 28 | # request parameter names. Filtering is done using regex. 29 | # x.reqParamNameFilterCondition= 30 | # Optional - Request parameter name filter operation that's used for modifying 31 | # request parameter names. Operation is executed if and only if request 32 | # parameter name matches the condition. 33 | # x.reqParamNameFilterOperation= 34 | # Optional - Request parameter value filter condition that's used for modifying 35 | # request parameter values. Filtering is done using regex. 36 | # x.reqParamValueFilterCondition= 37 | # Optional - Request parameter value filter operation that's used for modifying 38 | # request parameter values. Operation is executed if and only if request 39 | # parameter value matches the condition. 40 | # x.reqParamValueFilterOperation= 41 | # Optional - If set to true, expects request to be encrypted. Default : false 42 | # If value is true, all the settings related to encryption must be defined 43 | # in provider-gateway.properties file. 44 | # x.request.encrypted= 45 | # Optional - If set to true, response is encrypted. Default : false 46 | # If value is true, all the settings related to encryption must be defined 47 | # in provider-gateway.properties file. 48 | # x.response.encrypted= 49 | 0.id=FI_PILOT.GOV.1019125-0.Demo2Service.getOrganizationList.v1 50 | 0.url=https://www.hel.fi/palvelukarttaws/rest/v4/organization/ 51 | # Optional - If set to true, expects request to be encrypted. Default : false 52 | # If value is true, all the settings related to encryption must be defined 53 | # in provider-gateway.properties file. 54 | 0.request.encrypted=true 55 | # Optional - If set to true, expects request to be encrypted. Default : false 56 | # If value is true, all the settings related to encryption must be defined 57 | # in provider-gateway.properties file. 58 | 0.response.encrypted=true 59 | 1.id=FI_PILOT.GOV.1019125-0.Demo2Service.getDepartment.v1 60 | 1.url=https://www.hel.fi/palvelukarttaws/rest/v4/department/ 61 | 1.request.encrypted=true 62 | 1.response.encrypted=true 63 | 2.id=FI_PILOT.GOV.1019125-0.Demo2Service.getLibrary.v1 64 | 2.url=https://api.kirjastot.fi/v3/organisation?format=xml 65 | 2.request.xrdheaders=false 66 | 2.request.encrypted=true 67 | 2.response.encrypted=true 68 | 3.id=FI_PILOT.GOV.1019125-0.Demo2Service.searchCompany.v1 69 | 3.url=https://avoindata.prh.fi/opendata-ytj-api/v3/companies 70 | 3.request.encrypted=true 71 | 3.response.encrypted=true 72 | 4.id=FI_PILOT.GOV.1019125-0.Demo2Service.getRandomRecipes.v1 73 | 4.url=https://represent.opennorth.ca/representative-sets/ontario-legislature/ 74 | 4.request.encrypted=true 75 | 4.response.encrypted=true 76 | 5.id=FI_PILOT.GOV.1019125-0.Demo2Service.fintoService.v1 77 | 5.url=http://api.finto.fi/rest/v1/search 78 | 5.request.encrypted=true 79 | 5.response.encrypted=true 80 | 6.id=FI_PILOT.GOV.1019125-0.Demo2Service.getPerustiedot.v1 81 | 6.url=http://xml.nls.fi//XML/Schema/sovellus/ktjkir/asiakasdokumentaatio/esimerkit/kp_perustiedot/haku.xml 82 | 6.request.encrypted=true 83 | 6.response.encrypted=true 84 | 7.id=FI_PILOT.GOV.1019125-0.Demo2Service.getOmistukset.v1 85 | 7.url=http://xml.nls.fi//XML/Schema/sovellus/ktjkir/asiakasdokumentaatio/esimerkit/kp_omistustiedot/haku.xml 86 | 8.id=FI_PILOT.GOV.1019125-0.Demo2Service.getLainhuutotiedot.v1 87 | 8.url=http://xml.nls.fi//XML/Schema/sovellus/ktjkir/asiakasdokumentaatio/esimerkit/kp_lainhuutotiedot/haku.xml 88 | 9.id=FI_PILOT.GOV.1019125-0.Demo2Service.getRasitukset.v1 89 | 9.url=http://xml.nls.fi//XML/Schema/sovellus/ktjkir/asiakasdokumentaatio/esimerkit/kp_rasitustiedot/haku.xml 90 | 10.id=FI_PILOT.GOV.1019125-0.getOrganizationList 91 | 10.url=http://www.hel.fi/palvelukarttaws/rest/v2/organization/ 92 | 11.id=FI_PILOT.GOV.1019125-0.Demo2Service.getPTVOrganizationList.v1 93 | 11.url=https://api.palvelutietovaranto.suomi.fi/api/Organization 94 | 12.id=FI_PILOT.GOV.1019125-0.Demo2Service.getPTVOrganization.v1 95 | 12.url=https://api.palvelutietovaranto.suomi.fi/api/Organization 96 | 13.id=FI_PILOT.GOV.1019125-0.Demo2Service.getFinnaRecord.v1 97 | 13.url=https://api.finna.fi/v1/record 98 | 13.reqParamNameFilterCondition=(id) 99 | 13.reqParamNameFilterOperation=$1[] 100 | 13.request.encrypted=true 101 | 13.response.encrypted=true 102 | 103 | ## Tests with Custom API 104 | ## GET 105 | #16.id=FI_PILOT.GOV.1019125-0.Demo2Service.getUsers.v1 106 | #16.url=http://localhost:8081/users 107 | ## POST 108 | #17.id=FI_PILOT.GOV.1019125-0.Demo2Service.postUser.v1 109 | #17.url=http://localhost:8081/user 110 | #17.verb=post 111 | #17.contenttype=application/json 112 | ## DELETE 113 | #18.id=FI_PILOT.GOV.1019125-0.Demo2Service.deleteUser.v1 114 | #18.url=http://localhost:8081/user 115 | #18.verb=delete 116 | ## GET 117 | #19.id=FI_PILOT.GOV.1019125-0.Demo2Service.getUser.v1 118 | #19.url=http://localhost:8081/user 119 | 120 | 121 | -------------------------------------------------------------------------------- /adapter/src/main/profiles/plaintext/consumer-gateway.properties: -------------------------------------------------------------------------------- 1 | id.client=FI_PILOT.GOV.0245437-2.ConsumerService 2 | ss.url=http://localhost:@rest.adapter.profile.port@/rest-adapter-service/Provider 3 | # Namespace for ServiceRequest 4 | namespace.serialize=http://x-road.global/producer 5 | namespace.prefix.serialize=ts1 6 | # Namespace for incoming ServiceResponse 7 | namespace.deserialize=http://x-road.global/producer 8 | # Allow service calls by X-Road service id 9 | serviceCallsByXRdServiceId.enabled=true 10 | # Optional - Expect / -tags in SOAP body. default : true 11 | # N.B. Individual consumers may override this setting in consumers.properties 12 | wrappers=false 13 | # Key length (in bits) of symmetric key. Default is 128 bits. 14 | # NB! Longer key requires installing unlimited key file: 15 | # http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html 16 | # keyLength=128 17 | # Absolute path of the trust store file where public keys are stored 18 | # publicKeyFile=/my/path/consumertruststore.jks 19 | # Password of the trust store file 20 | # publicKeyFilePassword=consumerts 21 | # Absolute path of the key store file where the private key is stored 22 | # privateKeyFile=/my/path/consumerkeystore.jks 23 | # Password of the key store file 24 | # privateKeyFilePassword=consumerks 25 | # Alias of the private key 26 | # privateKeyAlias=consumerpri 27 | # Password of the private key 28 | # N.B. if storetype is PKCS12, key password must be the same as the keystore password 29 | # privateKeyPassword=consumer 30 | -------------------------------------------------------------------------------- /adapter/src/main/profiles/plaintext/consumers.properties: -------------------------------------------------------------------------------- 1 | # Required (X-Road service id) 2 | # x.id= 3 | # Optional (X-Road client id) 4 | # x.id.client= 5 | # Required 6 | # x.path= 7 | # Required (get, put, post, delete) 8 | # x.verb= 9 | # Required - Namespace for incoming ServiceResponses 10 | # If not defined, default value from rest-gateway.properties is used 11 | # x.namespace.deserialize= 12 | # Required - namespace for ServiceRequests that are sent 13 | # If not defined, default value from rest-gateway.properties is used 14 | # x.namespace.serialize= 15 | # Required - namespace prefix for ServiceRequest 16 | # If not defined, default value from rest-gateway.properties is used 17 | # x.namespace.prefix.serialize= 18 | # Optional - default : false 19 | # x.response.modurl= 20 | # Optional - Expect / -tags in SOAP message bodies. default : true 21 | # If defined, also overrides setting from consumer-gateway.properties 22 | # x.wrappers= 23 | # Optional - If set to true, request is encrypted. Default : false 24 | # If value is true, all the settings related to encryption must be defined 25 | # in consumer-gateway.properties file. 26 | # x.request.encrypted= 27 | # Optional - If set to true, expects response to be encrypted. Default : false 28 | # If value is true, all the settings related to encryption must be defined 29 | # in consumer-gateway.properties file. 30 | # x.response.encrypted= 31 | 0.id=FI_PILOT.GOV.1019125-0.Demo2Service.getOrganizationList.v1 32 | 0.id.client=FI_PILOT.GOV.0245437-2.ConsumerTest 33 | 0.path=/www.hel.fi/palvelukarttaws/rest/v4/organization/ 34 | 0.verb=get 35 | 1.id=FI_PILOT.GOV.1019125-0.Demo2Service.getDepartment.v1 36 | 1.path=/www.hel.fi/palvelukarttaws/rest/v4/department/{resourceId} 37 | 1.verb=get 38 | 2.id=FI_PILOT.GOV.1019125-0.Demo2Service.getLibrary.v1 39 | 2.path=/api.kirjastot.fi/v3/organisation/ 40 | 2.verb=get 41 | 3.id=FI_PILOT.GOV.1019125-0.Demo2Service.searchCompany.v1 42 | 3.path=/avoindata.prh.fi/opendata-ytj-api/v3/companies 43 | 3.verb=get 44 | 3.response.modurl=true 45 | 4.id=FI_PILOT.GOV.1019125-0.Demo2Service.getRandomRecipes.v1 46 | 4.path=/represent.opennorth.ca/representative-sets/ontario-legislature/ 47 | 5.id=FI_PILOT.GOV.1019125-0.Demo2Service.fintoService.v1 48 | 5.path=/api.finto.fi/rest/v1/search/ 49 | 5.verb=get 50 | 6.id=FI_PILOT.GOV.1019125-0.Demo2Service.getFinnaRecord.v1 51 | 6.path=/api.finna.fi/v1/record/ 52 | 6.verb=get 53 | 54 | ## Tests with Custom API 55 | ## GET 56 | #7.id=FI_PILOT.GOV.1019125-0.Demo2Service.getUsers.v1 57 | #7.path=/localhost:8081/users 58 | #7.verb=get 59 | #8.id=FI_PILOT.GOV.1019125-0.Demo2Service.getUsers.v1 60 | #8.path=/localhost:8081/users 61 | #8.verb=get 62 | ## POST 63 | #9.id=FI_PILOT.GOV.1019125-0.Demo2Service.postUser.v1 64 | #9.path=/localhost:8081/user 65 | #9.verb=post 66 | ##9.convertPost=true 67 | ## DELETE 68 | #10.id=FI_PILOT.GOV.1019125-0.Demo2Service.deleteUser.v1 69 | #10.path=/localhost:8081/user/{resourceId} 70 | #10.verb=delete 71 | ## GET 1 72 | #11.id=FI_PILOT.GOV.1019125-0.Demo2Service.getUser.v1 73 | #11.path=/localhost:8081/user/{resourceId} 74 | #11.verb=get 75 | -------------------------------------------------------------------------------- /adapter/src/main/profiles/plaintext/provider-gateway.properties: -------------------------------------------------------------------------------- 1 | wsdl.path=provider-gateway.wsdl 2 | # Namespace for ServiceResponse 3 | namespace.serialize=http://x-road.global/producer 4 | namespace.prefix.serialize=ts1 5 | # Namespace for incoming ServiceRequest 6 | # namespace.deserialize=* 7 | namespace.deserialize=http://x-road.global/producer 8 | # Optional - Expect / -tags in SOAP body. default : true 9 | # N.B. Individual providers may override this setting in providers.properties 10 | wrappers=false 11 | # Key length (in bits) of symmetric key. Default is 128 bits. 12 | # NB! Longer key requires installing unlimited key file: 13 | # http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html 14 | # keyLength=128 15 | # Absolute path of the trust store file where public keys are stored 16 | # publicKeyFile=/my/path/producertruststore.jks 17 | # Password of the trust store file 18 | # publicKeyFilePassword=providerts 19 | # Absolute path of the key store file where the private key is stored 20 | # privateKeyFile=/my/path/providerkeystore.jks 21 | # Password of the key store file 22 | # privateKeyFilePassword=providerks 23 | # Alias of the private key 24 | # privateKeyAlias=providerpri 25 | # Password of the private key 26 | # N.B. if storetype is PKCS12, key password must be the same as the keystore password 27 | # privateKeyPassword=provider 28 | -------------------------------------------------------------------------------- /adapter/src/main/profiles/plaintext/providers.properties: -------------------------------------------------------------------------------- 1 | # Required (X-Road service id) 2 | # x.id= 3 | # Required 4 | # x.url= 5 | # Optional - default : GET 6 | # x.verb= 7 | # Optional - default : - (not used) 8 | # x.contenttype= 9 | # Optional - default : - (not used) 10 | # x.accept= 11 | # Optional - defaul : false 12 | # x.response.attachment= 13 | # Optional - default : true 14 | # x.request.xrdheaders= 15 | # Optional - Namespace for incoming ServiceRequest 16 | # If not defined, default value from rest-gateway.properties is used 17 | # x.namespace.deserialize= 18 | # Optional - namespace for ServiceResponse 19 | # If not defined, default value from rest-gateway.properties is used 20 | # x.namespace.serialize= 21 | # Optional - namespace prefix for ServiceResponse 22 | # If not defined, default value from rest-gateway.properties is used 23 | # x.namespace.prefix.serialize= 24 | # Optional - Expect / -tags in SOAP message bodies. default : true 25 | # If defined, also overrides setting from provider-gateway.properties 26 | # x.wrappers= 27 | # Optional - Request parameter name filter condition that's used for modifying 28 | # request parameter names. Filtering is done using regex. 29 | # x.reqParamNameFilterCondition= 30 | # Optional - Request parameter name filter operation that's used for modifying 31 | # request parameter names. Operation is executed if and only if request 32 | # parameter name matches the condition. 33 | # x.reqParamNameFilterOperation= 34 | # Optional - Request parameter value filter condition that's used for modifying 35 | # request parameter values. Filtering is done using regex. 36 | # x.reqParamValueFilterCondition= 37 | # Optional - Request parameter value filter operation that's used for modifying 38 | # request parameter values. Operation is executed if and only if request 39 | # parameter value matches the condition. 40 | # x.reqParamValueFilterOperation= 41 | # Optional - If set to true, expects request to be encrypted. Default : false 42 | # If value is true, all the settings related to encryption must be defined 43 | # in provider-gateway.properties file. 44 | # x.request.encrypted= 45 | # Optional - If set to true, response is encrypted. Default : false 46 | # If value is true, all the settings related to encryption must be defined 47 | # in provider-gateway.properties file. 48 | # x.response.encrypted= 49 | 0.id=FI_PILOT.GOV.1019125-0.Demo2Service.getOrganizationList.v1 50 | 0.url=https://www.hel.fi/palvelukarttaws/rest/v4/organization/ 51 | 1.id=FI_PILOT.GOV.1019125-0.Demo2Service.getDepartment.v1 52 | 1.url=https://www.hel.fi/palvelukarttaws/rest/v4/department/ 53 | 2.id=FI_PILOT.GOV.1019125-0.Demo2Service.getLibrary.v1 54 | 2.url=https://api.kirjastot.fi/v3/organisation?format=xml 55 | 2.request.xrdheaders=false 56 | 3.id=FI_PILOT.GOV.1019125-0.Demo2Service.searchCompany.v1 57 | 3.url=https://avoindata.prh.fi/opendata-ytj-api/v3/companies 58 | 4.id=FI_PILOT.GOV.1019125-0.Demo2Service.getRandomRecipes.v1 59 | 4.url=https://represent.opennorth.ca/representative-sets/ontario-legislature/ 60 | 5.id=FI_PILOT.GOV.1019125-0.Demo2Service.fintoService.v1 61 | 5.url=http://api.finto.fi/rest/v1/search 62 | 6.id=FI_PILOT.GOV.1019125-0.Demo2Service.getPerustiedot.v1 63 | 6.url=http://xml.nls.fi//XML/Schema/sovellus/ktjkir/asiakasdokumentaatio/esimerkit/kp_perustiedot/haku.xml 64 | 7.id=FI_PILOT.GOV.1019125-0.Demo2Service.getOmistukset.v1 65 | 7.url=http://xml.nls.fi//XML/Schema/sovellus/ktjkir/asiakasdokumentaatio/esimerkit/kp_omistustiedot/haku.xml 66 | 8.id=FI_PILOT.GOV.1019125-0.Demo2Service.getLainhuutotiedot.v1 67 | 8.url=http://xml.nls.fi//XML/Schema/sovellus/ktjkir/asiakasdokumentaatio/esimerkit/kp_lainhuutotiedot/haku.xml 68 | 9.id=FI_PILOT.GOV.1019125-0.Demo2Service.getRasitukset.v1 69 | 9.url=http://xml.nls.fi//XML/Schema/sovellus/ktjkir/asiakasdokumentaatio/esimerkit/kp_rasitustiedot/haku.xml 70 | 10.id=FI_PILOT.GOV.1019125-0.getOrganizationList 71 | 10.url=http://www.hel.fi/palvelukarttaws/rest/v2/organization/ 72 | 11.id=FI_PILOT.GOV.1019125-0.Demo2Service.getPTVOrganizationList.v1 73 | 11.url=https://api.palvelutietovaranto.suomi.fi/api/Organization 74 | 12.id=FI_PILOT.GOV.1019125-0.Demo2Service.getPTVOrganization.v1 75 | 12.url=https://api.palvelutietovaranto.suomi.fi/api/Organization 76 | 13.id=FI_PILOT.GOV.1019125-0.Demo2Service.getFinnaRecord.v1 77 | 13.url=https://api.finna.fi/v1/record 78 | 13.reqParamNameFilterCondition=(id) 79 | 13.reqParamNameFilterOperation=$1[] 80 | 81 | ## Tests with Custom API 82 | ## GET 83 | #14.id=FI_PILOT.GOV.1019125-0.Demo2Service.getUsers.v1 84 | #14.url=http://localhost:8081/users 85 | ## POST 86 | #15.id=FI_PILOT.GOV.1019125-0.Demo2Service.postUser.v1 87 | #15.url=http://localhost:8081/user 88 | #15.verb=post 89 | #15.contenttype=application/json 90 | ## DELETE 91 | #16.id=FI_PILOT.GOV.1019125-0.Demo2Service.deleteUser.v1 92 | #16.url=http://localhost:8081/user 93 | #16.verb=delete 94 | ## GET 95 | #17.id=FI_PILOT.GOV.1019125-0.Demo2Service.getUser.v1 96 | #17.url=http://localhost:8081/user 97 | 98 | 99 | -------------------------------------------------------------------------------- /adapter/src/main/resources-bin/consumer.cer: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDdzCCAl+gAwIBAgIEDpTDXjANBgkqhkiG9w0BAQsFADBsMRAwDgYDVQQGEwdV 3 | bmtub3duMRAwDgYDVQQIEwdVbmtub3duMRAwDgYDVQQHEwdVbmtub3duMRAwDgYD 4 | VQQKEwdVbmtub3duMRAwDgYDVQQLEwdVbmtub3duMRAwDgYDVQQDEwdVbmtub3du 5 | MB4XDTE3MDEwMjEwMTg1MloXDTE3MTIyODEwMTg1MlowbDEQMA4GA1UEBhMHVW5r 6 | bm93bjEQMA4GA1UECBMHVW5rbm93bjEQMA4GA1UEBxMHVW5rbm93bjEQMA4GA1UE 7 | ChMHVW5rbm93bjEQMA4GA1UECxMHVW5rbm93bjEQMA4GA1UEAxMHVW5rbm93bjCC 8 | ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ3qCcOCH/KmkTpfaV88AW+m 9 | lPH942th4K5iDPsUhulZupWCir+Sh67sjkKWGev7c3bC+Z4EstW+pMqNV9mAF30N 10 | y/TXx2Lrjs8agVNvdm2z7k4FNE13SPwhxksDl1BmKDxwfMknAlyCHosCeBk38kGe 11 | XYwIvwpvgH6gj5ft5xMe027A+uKEMCzxs5mKNBC8sW59anQuZ6SQIvYNWaHEzVdM 12 | SVEZVW4eKT+FP+5KeRDE7+hb1PiSiM9ABICrZ5vQ8cnSbburIa1YqyCjyS/LFZtC 13 | zp2vnd8uXb4o+GsZZQl5N5Q0Y1O1WhyKQsNPdag75P+ol/59xmcM637RxQWK3fcC 14 | AwEAAaMhMB8wHQYDVR0OBBYEFILqMoTrrjoRGfh27Jy08g8haOKtMA0GCSqGSIb3 15 | DQEBCwUAA4IBAQBJ/pJyexSOZ6mjamMZTTeq8Oc18GSa3TXCOg5Wiy4S1tutzCDn 16 | lC0WepJAT5s9EV6ONwaauhcLOvUUe5e9q8mB73iv6MwdypsErgG10Ty09DAbvZM/ 17 | eJBam4vQkwYz/fBEIaWwBNpnhXqdoXMD7Dqu8H3jrF7lGc8ywtT7c0Mb5KFWwC6Z 18 | iejR1rSb3CTT8GjyS23uXrjsaluZWbBqjndFk4dDbuGil4lSBnXGrD7TMd8KZY5L 19 | TrhO7wVnIKrglu4YUPT2vbY24Kmiw/h35cMOjvc8JMHfSF9YIQUwY4Ymhy1Xe6by 20 | orxQUXMai1GgZEL/39WBHoeBK8nONe+slbBW 21 | -----END CERTIFICATE----- 22 | -------------------------------------------------------------------------------- /adapter/src/main/resources-bin/consumerkeystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nordic-institute/REST-adapter-service/0b6bf9a50f972c921c056ab706d13d2a7e785c31/adapter/src/main/resources-bin/consumerkeystore.jks -------------------------------------------------------------------------------- /adapter/src/main/resources-bin/consumertruststore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nordic-institute/REST-adapter-service/0b6bf9a50f972c921c056ab706d13d2a7e785c31/adapter/src/main/resources-bin/consumertruststore.jks -------------------------------------------------------------------------------- /adapter/src/main/resources-bin/producertruststore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nordic-institute/REST-adapter-service/0b6bf9a50f972c921c056ab706d13d2a7e785c31/adapter/src/main/resources-bin/producertruststore.jks -------------------------------------------------------------------------------- /adapter/src/main/resources-bin/provider.cer: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDdzCCAl+gAwIBAgIEFmd+yTANBgkqhkiG9w0BAQsFADBsMRAwDgYDVQQGEwdV 3 | bmtub3duMRAwDgYDVQQIEwdVbmtub3duMRAwDgYDVQQHEwdVbmtub3duMRAwDgYD 4 | VQQKEwdVbmtub3duMRAwDgYDVQQLEwdVbmtub3duMRAwDgYDVQQDEwdVbmtub3du 5 | MB4XDTE3MDEwMjEwMjAzNloXDTE3MTIyODEwMjAzNlowbDEQMA4GA1UEBhMHVW5r 6 | bm93bjEQMA4GA1UECBMHVW5rbm93bjEQMA4GA1UEBxMHVW5rbm93bjEQMA4GA1UE 7 | ChMHVW5rbm93bjEQMA4GA1UECxMHVW5rbm93bjEQMA4GA1UEAxMHVW5rbm93bjCC 8 | ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKFgqrAPDyJrLz0nWEm5/YwD 9 | 2DdwqlWhrbKu7C3Vczs2gPRDYFtaojai2KHwPx8+2/sztsiilCuGiIWC5hSdXf/c 10 | +bRoTJbeNbiTSvKPvrA6H0EtqbPMfEHYuftYpLO4ZZ8XyUEcm+TO84ULCgNo4id2 11 | NcgMMXXds0/1ecIbWvCyGuxqTYciF/AC4r0GUtl7toy70f9FSoeBcPdbePnefG9f 12 | UJut+PSWu21Oidae+aniXfkK6ZPXXiiCEPCZFrvlqheTlbfrIaKPf4Cqj3iWojCo 13 | HFCgpgCN1KBRUrT0jJfpO0vmLNTNEHkcLJei52e+G9QnTSd5ayz8VnXvnS55KrMC 14 | AwEAAaMhMB8wHQYDVR0OBBYEFNRGgr75GdnSH5sgaXdaPEZL4hVZMA0GCSqGSIb3 15 | DQEBCwUAA4IBAQAHhiD4ZsYmE2A1/egj9sDIc3JosCFTTknHJQfDyhsjne+szWUf 16 | nz79gIsviU+24X8V4TmNkPfrf220I0Hu7PLNMNk5W06BtAjGnGmGiAMk22M8L33R 17 | yHJXWUhBOZ/EYdw7G1/bmGRu3hLpbMaOBL+H36Ek9tDmuoZrCFp5EqunUtCLfsYa 18 | Hu0qelCdZhDKaBhuMthSAKh79oufYSTY1HpHa8uGs8XbDYUWl0KoYZIMDK1EG30E 19 | 3iNper7RoWDu7ueDX4FDASniVS0tyjNsfFbdN7VBPA643o+/r4YFvUGLXe+dzMFl 20 | 5iqXS3zIMKyvsoBdBJv6yX+kffmayNt+WMKE 21 | -----END CERTIFICATE----- 22 | -------------------------------------------------------------------------------- /adapter/src/main/resources-bin/providerkeystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nordic-institute/REST-adapter-service/0b6bf9a50f972c921c056ab706d13d2a7e785c31/adapter/src/main/resources-bin/providerkeystore.jks -------------------------------------------------------------------------------- /adapter/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.servlet.context-path=/rest-adapter-service 2 | server.port=8080 3 | wiremock.server.port=7777 4 | spring.mvc.view.prefix=WEB-INF/jsp/ 5 | spring.mvc.view.suffix=.jsp 6 | spring.main.allow-bean-definition-overriding=true 7 | logging.level.org.niis.xroad.restadapterservice=TRACE 8 | 9 | -------------------------------------------------------------------------------- /adapter/src/main/resources/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |

REST Adapter Service

9 |

REST Adapter Service on GitHub.

10 |

Consumer

11 |

Consumer endpoint:

12 |
13 | Properties: 14 |
    15 |
  • WEB-INF/classes/consumer-gateway.properties
  • 16 |
  • WEB-INF/classes/consumers.properties
  • 17 |
18 |
19 |

Provider

20 | 21 |

Provider endpoint:

22 | 23 |

Provider WSDL:

24 |

WSDL path: WEB-INF/classes/provider-gateway.wsdl

25 |
26 | Properties: 27 |
    28 |
  • WEB-INF/classes/provider-gateway.properties
  • 29 |
  • WEB-INF/classes/providers.properties
  • 30 |
31 |
32 | 33 | -------------------------------------------------------------------------------- /adapter/src/main/webapp/META-INF/context.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /adapter/src/test/filters/integration-test.properties: -------------------------------------------------------------------------------- 1 | rest.adapter.profile.port=9898 -------------------------------------------------------------------------------- /adapter/src/test/java/org/niis/xroad/restadapterservice/util/RESTGatewayUtilTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * The MIT License 3 | * Copyright © 2018 Nordic Institute for Interoperability Solutions (NIIS) 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in 13 | * all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | * THE SOFTWARE. 22 | */ 23 | package org.niis.xroad.restadapterservice.util; 24 | 25 | import lombok.extern.slf4j.Slf4j; 26 | import org.junit.jupiter.api.Test; 27 | import org.springframework.boot.test.context.SpringBootTest; 28 | 29 | import static org.junit.jupiter.api.Assertions.assertEquals; 30 | 31 | /** 32 | * Test cases for RESTGatewayUtil class. 33 | * 34 | * @author Petteri Kivimäki 35 | */ 36 | @SpringBootTest 37 | @Slf4j 38 | public class RESTGatewayUtilTest { 39 | 40 | /** 41 | * Test for null value. 42 | */ 43 | @Test 44 | public void testIsXml1() { 45 | assertEquals(false, RESTGatewayUtil.isXml(null)); 46 | } 47 | 48 | /** 49 | * Test for an empty string. 50 | */ 51 | @Test 52 | public void testIsXml2() { 53 | assertEquals(false, RESTGatewayUtil.isXml("")); 54 | } 55 | 56 | /** 57 | * Test for "string/xml". 58 | */ 59 | @Test 60 | public void testIsXml3() { 61 | assertEquals(true, RESTGatewayUtil.isXml("text/xml")); 62 | } 63 | 64 | /** 65 | * Test for "application/json". 66 | */ 67 | @Test 68 | public void testIsXml4() { 69 | assertEquals(false, RESTGatewayUtil.isXml("application/json")); 70 | } 71 | 72 | /** 73 | * Test for "application/XML". Wrong case. 74 | */ 75 | @Test 76 | public void testIsXml5() { 77 | assertEquals(false, RESTGatewayUtil.isXml("application/XML")); 78 | } 79 | 80 | /** 81 | * Test for "text/html". 82 | */ 83 | @Test 84 | public void testIsXml6() { 85 | assertEquals(false, RESTGatewayUtil.isXml("text/html")); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /adapter/src/test/resources/application-test-keys/README.md: -------------------------------------------------------------------------------- 1 | keystores, truststores, and certificates for testing encrypted 2 | messages between REST adapter consumer and provider endpoints -------------------------------------------------------------------------------- /adapter/src/test/resources/application-test-keys/consumer.cer: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDdzCCAl+gAwIBAgIEDpTDXjANBgkqhkiG9w0BAQsFADBsMRAwDgYDVQQGEwdV 3 | bmtub3duMRAwDgYDVQQIEwdVbmtub3duMRAwDgYDVQQHEwdVbmtub3duMRAwDgYD 4 | VQQKEwdVbmtub3duMRAwDgYDVQQLEwdVbmtub3duMRAwDgYDVQQDEwdVbmtub3du 5 | MB4XDTE3MDEwMjEwMTg1MloXDTE3MTIyODEwMTg1MlowbDEQMA4GA1UEBhMHVW5r 6 | bm93bjEQMA4GA1UECBMHVW5rbm93bjEQMA4GA1UEBxMHVW5rbm93bjEQMA4GA1UE 7 | ChMHVW5rbm93bjEQMA4GA1UECxMHVW5rbm93bjEQMA4GA1UEAxMHVW5rbm93bjCC 8 | ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJ3qCcOCH/KmkTpfaV88AW+m 9 | lPH942th4K5iDPsUhulZupWCir+Sh67sjkKWGev7c3bC+Z4EstW+pMqNV9mAF30N 10 | y/TXx2Lrjs8agVNvdm2z7k4FNE13SPwhxksDl1BmKDxwfMknAlyCHosCeBk38kGe 11 | XYwIvwpvgH6gj5ft5xMe027A+uKEMCzxs5mKNBC8sW59anQuZ6SQIvYNWaHEzVdM 12 | SVEZVW4eKT+FP+5KeRDE7+hb1PiSiM9ABICrZ5vQ8cnSbburIa1YqyCjyS/LFZtC 13 | zp2vnd8uXb4o+GsZZQl5N5Q0Y1O1WhyKQsNPdag75P+ol/59xmcM637RxQWK3fcC 14 | AwEAAaMhMB8wHQYDVR0OBBYEFILqMoTrrjoRGfh27Jy08g8haOKtMA0GCSqGSIb3 15 | DQEBCwUAA4IBAQBJ/pJyexSOZ6mjamMZTTeq8Oc18GSa3TXCOg5Wiy4S1tutzCDn 16 | lC0WepJAT5s9EV6ONwaauhcLOvUUe5e9q8mB73iv6MwdypsErgG10Ty09DAbvZM/ 17 | eJBam4vQkwYz/fBEIaWwBNpnhXqdoXMD7Dqu8H3jrF7lGc8ywtT7c0Mb5KFWwC6Z 18 | iejR1rSb3CTT8GjyS23uXrjsaluZWbBqjndFk4dDbuGil4lSBnXGrD7TMd8KZY5L 19 | TrhO7wVnIKrglu4YUPT2vbY24Kmiw/h35cMOjvc8JMHfSF9YIQUwY4Ymhy1Xe6by 20 | orxQUXMai1GgZEL/39WBHoeBK8nONe+slbBW 21 | -----END CERTIFICATE----- 22 | -------------------------------------------------------------------------------- /adapter/src/test/resources/application-test-keys/consumerkeystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nordic-institute/REST-adapter-service/0b6bf9a50f972c921c056ab706d13d2a7e785c31/adapter/src/test/resources/application-test-keys/consumerkeystore.jks -------------------------------------------------------------------------------- /adapter/src/test/resources/application-test-keys/consumertruststore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nordic-institute/REST-adapter-service/0b6bf9a50f972c921c056ab706d13d2a7e785c31/adapter/src/test/resources/application-test-keys/consumertruststore.jks -------------------------------------------------------------------------------- /adapter/src/test/resources/application-test-keys/provider.cer: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDdzCCAl+gAwIBAgIEFmd+yTANBgkqhkiG9w0BAQsFADBsMRAwDgYDVQQGEwdV 3 | bmtub3duMRAwDgYDVQQIEwdVbmtub3duMRAwDgYDVQQHEwdVbmtub3duMRAwDgYD 4 | VQQKEwdVbmtub3duMRAwDgYDVQQLEwdVbmtub3duMRAwDgYDVQQDEwdVbmtub3du 5 | MB4XDTE3MDEwMjEwMjAzNloXDTE3MTIyODEwMjAzNlowbDEQMA4GA1UEBhMHVW5r 6 | bm93bjEQMA4GA1UECBMHVW5rbm93bjEQMA4GA1UEBxMHVW5rbm93bjEQMA4GA1UE 7 | ChMHVW5rbm93bjEQMA4GA1UECxMHVW5rbm93bjEQMA4GA1UEAxMHVW5rbm93bjCC 8 | ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKFgqrAPDyJrLz0nWEm5/YwD 9 | 2DdwqlWhrbKu7C3Vczs2gPRDYFtaojai2KHwPx8+2/sztsiilCuGiIWC5hSdXf/c 10 | +bRoTJbeNbiTSvKPvrA6H0EtqbPMfEHYuftYpLO4ZZ8XyUEcm+TO84ULCgNo4id2 11 | NcgMMXXds0/1ecIbWvCyGuxqTYciF/AC4r0GUtl7toy70f9FSoeBcPdbePnefG9f 12 | UJut+PSWu21Oidae+aniXfkK6ZPXXiiCEPCZFrvlqheTlbfrIaKPf4Cqj3iWojCo 13 | HFCgpgCN1KBRUrT0jJfpO0vmLNTNEHkcLJei52e+G9QnTSd5ayz8VnXvnS55KrMC 14 | AwEAAaMhMB8wHQYDVR0OBBYEFNRGgr75GdnSH5sgaXdaPEZL4hVZMA0GCSqGSIb3 15 | DQEBCwUAA4IBAQAHhiD4ZsYmE2A1/egj9sDIc3JosCFTTknHJQfDyhsjne+szWUf 16 | nz79gIsviU+24X8V4TmNkPfrf220I0Hu7PLNMNk5W06BtAjGnGmGiAMk22M8L33R 17 | yHJXWUhBOZ/EYdw7G1/bmGRu3hLpbMaOBL+H36Ek9tDmuoZrCFp5EqunUtCLfsYa 18 | Hu0qelCdZhDKaBhuMthSAKh79oufYSTY1HpHa8uGs8XbDYUWl0KoYZIMDK1EG30E 19 | 3iNper7RoWDu7ueDX4FDASniVS0tyjNsfFbdN7VBPA643o+/r4YFvUGLXe+dzMFl 20 | 5iqXS3zIMKyvsoBdBJv6yX+kffmayNt+WMKE 21 | -----END CERTIFICATE----- 22 | -------------------------------------------------------------------------------- /adapter/src/test/resources/application-test-keys/providerkeystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nordic-institute/REST-adapter-service/0b6bf9a50f972c921c056ab706d13d2a7e785c31/adapter/src/test/resources/application-test-keys/providerkeystore.jks -------------------------------------------------------------------------------- /adapter/src/test/resources/application-test-keys/providertruststore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nordic-institute/REST-adapter-service/0b6bf9a50f972c921c056ab706d13d2a7e785c31/adapter/src/test/resources/application-test-keys/providertruststore.jks -------------------------------------------------------------------------------- /adapter/src/test/resources/application-test-properties/README.md: -------------------------------------------------------------------------------- 1 | configuration for REST-adapter which is offers both consumer and 2 | provider endpoints, and consumer calls provider endpoint without 3 | a security server in between. 4 | 5 | client (rest) <- rest -> consumer endpoint <- XROAD SOAP -> provider endpoint <- rest -> wiremock rest api 6 | 7 | communication between consumer and provider endpoint is encrypted, and 8 | clients JSON message is converted with convertPost = true setting -------------------------------------------------------------------------------- /adapter/src/test/resources/application-test-properties/consumer-gateway.properties: -------------------------------------------------------------------------------- 1 | id.client=FI.GOV.1234.TEST 2 | ss.url=http://localhost:7778/rest-adapter-service/Provider 3 | serviceCallsByXRdServiceId.enabled=true 4 | wrappers=false 5 | convertPost=false 6 | keyLength=128 7 | publicKeyFile=@projectDir@/build/resources/test/application-test-keys/consumertruststore.jks 8 | publicKeyFilePassword=consumerts 9 | privateKeyFile=@projectDir@/build/resources/test/application-test-keys/consumerkeystore.jks 10 | privateKeyFilePassword=consumerks 11 | privateKeyAlias=consumerpri 12 | privateKeyPassword=consumer 13 | -------------------------------------------------------------------------------- /adapter/src/test/resources/application-test-properties/consumers.properties: -------------------------------------------------------------------------------- 1 | 0.id=FI.GOV.1234.TEST.HaeToimijaPTT.v1 2 | 0.path=/haetoimija-post-convert-true-encrypt-true/ 3 | 0.verb=post 4 | 0.wrappers=false 5 | 0.namespace.serialize=http://x-road.global/example/toimija 6 | 0.namespace.prefix.serialize=toimija 7 | 0.namespace.deserialize=http://x-road.global/example/toimija 8 | 0.convertPost=true 9 | 0.request.encrypted=true 10 | 0.response.encrypted=true 11 | -------------------------------------------------------------------------------- /adapter/src/test/resources/application-test-properties/provider-gateway.properties: -------------------------------------------------------------------------------- 1 | wsdl.path=provider-gateway.wsdl 2 | namespace.serialize=http://test.x-road.fi/producer 3 | namespace.prefix.serialize=ts1 4 | namespace.deserialize=http://test.x-road.fi/producer 5 | wrappers=false 6 | keyLength=128 7 | publicKeyFile=@projectDir@/build/resources/test/application-test-keys/providertruststore.jks 8 | publicKeyFilePassword=providerts 9 | privateKeyFile=@projectDir@/build/resources/test/application-test-keys/providerkeystore.jks 10 | privateKeyFilePassword=providerks 11 | privateKeyAlias=providerpri 12 | privateKeyPassword=provider 13 | -------------------------------------------------------------------------------- /adapter/src/test/resources/application-test-properties/providers.properties: -------------------------------------------------------------------------------- 1 | 0.id=FI.GOV.1234.TEST.HaeToimijaPTT.v1 2 | # TODO: dynamic wiremock port 3 | 0.url=http://localhost:7777/wiremock/rest-service/ 4 | 0.request.encrypted=true 5 | 0.response.encrypted=true 6 | 0.wrappers=false 7 | 0.verb=post 8 | 0.namespace.serialize=http://x-road.global/example/toimija 9 | 0.namespace.prefix.serialize=toimija 10 | 0.namespace.deserialize=http://x-road.global/example/toimija 11 | -------------------------------------------------------------------------------- /adapter/src/test/resources/consumer-IT-expected-response.json: -------------------------------------------------------------------------------- 1 | {"abbr_fi":"Kasko","www_en":"https://www.hel.fi/en/decision-making/city-organization/divisions/education-division","municipality_code":91,"oid":"","name_fi":"Kasvatuksen ja koulutuksen toimiala","name_sv":"Fostrans- och utbildningssektorn","phone":"+358 9 310 8600","parent_id":"83e74666-0836-4c1d-948a-4b34a8b90301","org_id":"83e74666-0836-4c1d-948a-4b34a8b90301","organization_type":"MUNICIPALITY","id":"cc70d1d8-3ca7-416a-9ea7-27e6b7ce58a8","business_id":"0201256-6","email":"neuvonta.opetusvirasto@hel.fi","www_fi":"https://www.hel.fi/fi/paatoksenteko-ja-hallinto/kaupungin-organisaatio/toimialat/kasvatuksen-ja-koulutuksen-toimiala","www_sv":"https://www.hel.fi/sv/beslutsfattande-och-forvaltning/stadens-organisation/sektorer/fostrans-och-utbildningssektorn","hierarchy_level":1,"name_en":"Education Division"} -------------------------------------------------------------------------------- /adapter/src/test/resources/consumer-IT-expected-response.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Kasko 4 | https://www.hel.fi/en/decision-making/city-organization/divisions/education-division 5 | 91 6 | 7 | Kasvatuksen ja koulutuksen toimiala 8 | Fostrans- och utbildningssektorn 9 | +358 9 310 8600 10 | 83e74666-0836-4c1d-948a-4b34a8b90301 11 | 83e74666-0836-4c1d-948a-4b34a8b90301 12 | MUNICIPALITY 13 | cc70d1d8-3ca7-416a-9ea7-27e6b7ce58a8 14 | 0201256-6 15 | neuvonta.opetusvirasto@hel.fi 16 | https://www.hel.fi/fi/paatoksenteko-ja-hallinto/kaupungin-organisaatio/toimialat/kasvatuksen-ja-koulutuksen-toimiala 17 | https://www.hel.fi/sv/beslutsfattande-och-forvaltning/stadens-organisation/sektorer/fostrans-och-utbildningssektorn 18 | 1 19 | Education Division 20 | -------------------------------------------------------------------------------- /adapter/src/test/resources/consumer-gw-test-request-expected.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 4.0 7 | predefined-message-id 8 | anonymous 9 | 10 | FI 11 | GOV 12 | 1002 13 | SS1 14 | sendMessage 15 | v1 16 | 17 | 18 | FI 19 | GOV 20 | 1945065-0 21 | REST-GW-CONSUMERS 22 | 23 | 24 | 25 | 26 | Some Name 27 | 28 | 12345678 29 | some text 30 | more text 31 | 32 | 100 33 | attachment-1 34 | application/pdf 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /adapter/src/test/resources/consumer-gw-test-request.json: -------------------------------------------------------------------------------- 1 | { 2 | "sender": "Some Name", 3 | "message": { 4 | "messageId": "12345678", 5 | "subject": "some text", 6 | "text": "more text", 7 | "attachments": [ 8 | { 9 | "attachmentId": "100", 10 | "name": "attachment-1", 11 | "mediaType": "application/pdf" 12 | } 13 | ] 14 | } 15 | } -------------------------------------------------------------------------------- /adapter/src/test/resources/consumer-gw-test-response-expected.json: -------------------------------------------------------------------------------- 1 | { 2 | "sender": "Some Name", 3 | "result": { 4 | "code": "OK", 5 | "child": { 6 | "someText": "some text" 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /adapter/src/test/resources/consumer-gw-test-response.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | ? 7 | 1 8 | 1 9 | 10 | 1 11 | 1 12 | 1 13 | 1 14 | sendMessage 15 | 1 16 | 17 | 18 | 1 19 | 1 20 | 1 21 | 1 22 | 23 | 24 | 25 | 26 | Some Name 27 | 28 | OK 29 | 30 | some text 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /adapter/src/test/resources/rest-service-response.json: -------------------------------------------------------------------------------- 1 | { 2 | "PaluuKoodi": "OK", 3 | "Teksti": "from-wiremock-tekstiä ÄÖÅÄ \n bar tekstiä", 4 | "TekstiLisatiedot": "Foo Lisätiedot ÄÖÅÄ \n bar tekstiä", 5 | "Tarkenne": "Foo tarkenne" 6 | } 7 | -------------------------------------------------------------------------------- /documentation/CRUD-API-Configuration.md: -------------------------------------------------------------------------------- 1 | This example explains how to configure Rest Adapter Service for a CRUD API. 2 | 3 | ### CRUD API 4 | 5 | In this example a simple imaginary CRUD API is used for demonstrating the configuration of Rest Adapter Service. The CRUD API has five operations that accept and return JSON: 6 | 7 | * list bands 8 | * ``` [GET] http://www.api.com/bands``` 9 | * get band 10 | * ``` [GET] http://www.api.com/bands/{bandId}``` 11 | * add band 12 | * ``` [POST] http://www.api.com/bands``` 13 | * update band 14 | * ``` [PUT] http://www.api.com/bands/{bandId}``` 15 | * delete band 16 | * ``` [DELETE] http://www.api.com/bands/{bandId}``` 17 | 18 | A band object has only two properties: ```id``` and ```name```. 19 | 20 | ``` 21 | {"id":1,"name":"Guns N' Roses"} 22 | ``` 23 | 24 | ### Provider Gateway 25 | 26 | All the five CRUP API operations must be added to ```providers.properties``` file. 27 | 28 | ``` 29 | 0.id=FI_PILOT.GOV.1019125-0.Demo2Service.getBands.v1 30 | 0.url=http://www.api.com/bands/ 31 | 0.verb=get 32 | 1.id=FI_PILOT.GOV.1019125-0.Demo2Service.getBand.v1 33 | 1.url=http://www.api.com/bands/ 34 | 1.verb=get 35 | 2.id=FI_PILOT.GOV.1019125-0.Demo2Service.createBand.v1 36 | 2.url=http://www.api.com/bands/ 37 | 2.verb=post 38 | 2.contenttype=application/json 39 | 3.id=FI_PILOT.GOV.1019125-0.Demo2Service.updateBand.v1 40 | 3.url=http://www.api.com/bands/ 41 | 3.verb=put 42 | 3.contenttype=application/json 43 | 4.id=FI_PILOT.GOV.1019125-0.Demo2Service.deleteBand.v1 44 | 4.url=http://www.api.com/bands/ 45 | 4.verb=delete 46 | ``` 47 | 48 | ```provider-gateway.properties``` file should look like this: 49 | 50 | ``` 51 | wsdl.path=provider-gateway.wsdl 52 | # Namespace for ServiceResponse 53 | namespace.serialize=http://test.x-road.fi/producer 54 | namespace.prefix.serialize=ts1 55 | # Namespace for incoming ServiceRequest 56 | namespace.deserialize=http://test.x-road.fi/producer 57 | ``` 58 | 59 | **N.B.** As long as Provider Gateway is not accessed through X-Road security server there's no need to pay attention to the WSDL file (```provider-gateway.wsdl```). The WSDL file is only for the security server and it's not needed by the Consumer Gateway. 60 | ### Consumer Gateway 61 | 62 | All the five CRUP API operations must be added to ```consumers.properties``` file as well. 63 | 64 | ``` 65 | 6.id=FI_PILOT.GOV.1019125-0.Demo2Service.getBands.v1 66 | 6.path=/bands/ 67 | 6.verb=get 68 | 7.id=FI_PILOT.GOV.1019125-0.Demo2Service.getBand.v1 69 | 7.path=/bands/{resourceId} 70 | 7.verb=get 71 | 8.id=FI_PILOT.GOV.1019125-0.Demo2Service.createBand.v1 72 | 8.path=/bands/ 73 | 8.verb=post 74 | 9.id=FI_PILOT.GOV.1019125-0.Demo2Service.updateBand.v1 75 | 9.path=/bands/{resourceId} 76 | 9.verb=put 77 | 10.id=FI_PILOT.GOV.1019125-0.Demo2Service.deleteBand.v1 78 | 10.path=/bands/{resourceId} 79 | 10.verb=delete 80 | ``` 81 | 82 | ```consumer-gateway.properties``` file should look like this: 83 | 84 | ``` 85 | id.client=FI_PILOT.GOV.0245437-2.TestSystem 86 | ss.url=http://localhost:8080/rest-adapter-service/Provider 87 | # Namespace for ServiceRequest 88 | namespace.serialize=http://test.x-road.fi/producer 89 | namespace.prefix.serialize=ts1 90 | # Namespace for incoming ServiceResponse 91 | namespace.deserialize=http://test.x-road.fi/producer 92 | ``` 93 | **N.B.** ```ss.url``` property must contain the correct URL of the Provider Gateway. 94 | 95 | **N.B.** It's very important that ```namespace.serialize``` property matches with ```namespace.deserialize``` property of Provider Gateway, and that ```namespace.deserialize``` property matches with ```namespace.serialize``` property of Provider Gateway. 96 | 97 | ### Using the services 98 | 99 | Let's assume that Consumer Gateway is accessed at: 100 | 101 | ``` 102 | http://localhost:8080/rest-adapter-service/Consumer 103 | ``` 104 | 105 | And Provider Gateway is accessed at: 106 | 107 | ``` 108 | http://localhost:8080/rest-adapter-service/Provider 109 | ``` 110 | 111 | Using the services through Consumer Gateway: 112 | 113 | * list bands 114 | * ``` [GET] http://localhost:8080/rest-adapter-service/Consumer/bands``` 115 | * get band 116 | * ``` [GET] http://localhost:8080/rest-adapter-service/Consumer/bands/{bandId}``` 117 | * add band 118 | * ``` [POST] http://localhost:8080/rest-adapter-service/Consumer/bands``` 119 | * Request body: ```{"name":"Guns N' Roses"}``` 120 | * update band 121 | * ``` [PUT] http://localhost:8080/rest-adapter-service/Consumer/bands/1``` 122 | * Request body: ```{"id":1,"name":"Guns N' Roses"}``` 123 | * delete band 124 | * ``` [DELETE] http://localhost:8080/rest-adapter-service/Consumer/bands/1``` 125 | -------------------------------------------------------------------------------- /documentation/Configuring-Rest-Adapter-Service-provider.md: -------------------------------------------------------------------------------- 1 | ### Prerequisites 2 | 3 | Before configuring Rest Adapter Service Provider for X-Road the following conditions must be met: 4 | 5 | * organization must be registered as X-Road member 6 | * Security Server installation must be completed 7 | * subsystem that's used for publishing REST services must be registered 8 | * WSDL description of the REST services to be published must be available 9 | 10 | ### Configuration 11 | 12 | General settings are configured through ```provider-gateway.properties``` configuration file. All the general properties are mandatory. 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 |
PropertyRequiredDefaultDescription
wsdl.path*-File reading is first attempted from WEB-INF/classes directory 27 | (either inside packaged war, or in exploded war directory), 28 | and then from filesystem using the provided filename or path.
namespace.deserialize*-Namespace that's used for deserializing incoming SOAP requests. Can be overridden for each service. **N.B.** Must match the namespace used in the WSDL description.
namespace.serialize*-Namespace that's used for serializing outgoing SOAP responses. Can be overridden for each service. **N.B.** Must match the namespace used in the WSDL description.
namespace.prefix.serialize*-Namespace prefix that's used for serializing outgoing SOAP responses. Can be overridden for each service.
50 | 51 | REST services to be published are configured through ```providers.properties``` configuration file. Each service has 10 properties of which 2 are mandatory. Each property must be prefixed with the number of the service, e.g. ```0.id```, ```0.url```. The numbering starts from zero. 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 |
PropertyRequiredDefaultDescription
id*-Identifier of the X-Road service : instance.memberClass.memberId.subsystem.service.version
url*-URL of the REST service.
verbGETHTTP verb that's used in the service call. Supported values: GET, POST, PUT and DELETE.
contenttype-Content-type HTTP header that's used in the service call. Required if HTTP verb is POST, PUT or DELETE and HTTP request contains a request body.
accept-Accept HTTP header that's used in the service call.
response.attachmentfalseReturn REST response as SOAP attachment. If response is returned as SOAP attachment, Consumer Gateway ignores the value of HTTP Accept header and returns the response in the original format.
request.xrdheaderstruePass X-Road SOAP headers to REST service via HTTP headers.
namespace.deserialize-Namespace that's used for deserializing incoming SOAP requests. If not defined, default value from provider-gateway.properties is used.
namespace.serialize-Namespace that's used for serializing outgoing SOAP responses. If not defined, default value from provider-gateway.properties is used.
namespace.prefix.serialize-Namespace prefix that's used for serializing outgoing SOAP responses. If not defined, default value from provider-gateway.properties is used.
123 | 124 | ### Publishing to X-Road 125 | 126 | Services provided through Provider Gateway are published to X-Road by adding the URL of the WSDL description to the Security Server and configuring necessary access rights to the services. 127 | 128 | WSDL description URL: 129 | ``` 130 | http://myserver.com/rest-adapter-service/Provider?wsdl 131 | ``` 132 | ### Example 133 | 134 | General configuration at ```provider-gateway.properties```: 135 | 136 | ``` 137 | wsdl.path=provider-gateway.wsdl 138 | # Namespace for ServiceResponse 139 | namespace.serialize=http://test.x-road.fi/producer 140 | namespace.prefix.serialize=ts1 141 | # Namespace for incoming ServiceRequest 142 | namespace.deserialize=http://test.x-road.fi/producer 143 | ``` 144 | 145 | WSDL description at ```provider-gateway.wsdl```: 146 | ``` 147 | 152 | 153 | 154 | 155 | . 156 | . 157 | 158 | 159 | . 160 | . 161 | 162 | 163 | . 164 | . 165 | . 166 | 167 | 168 | v1 169 | . 170 | . 171 | 172 | 173 | ``` 174 | 175 | Organization's X-Road member identifier registered by the X-Road center: 176 | ``` 177 | FI-DEV.GOV.123456-7 178 | ``` 179 | 180 | Subsystem that's used for publishing the service through X-Road (optional): 181 | ``` 182 | TestSystem 183 | ``` 184 | 185 | Service details: 186 | ``` 187 | Service name: getRandom 188 | Service version: v1 189 | Service URL: http://example.com/service/endpoint 190 | ``` 191 | 192 | Configuration at ```providers.properties```: 193 | 194 | ``` 195 | 0.id=FI-DEV.GOV.123456-7.TestSystem.getRandom.v1 196 | 0.url=http://example.com/service/endpoint 197 | 0.verb=get 198 | ``` 199 | -------------------------------------------------------------------------------- /documentation/Encryption.md: -------------------------------------------------------------------------------- 1 | Rest Adapter Service supports message level encryption. The use of encryption requires that service provider and consumer exchange their public keys (provider => ```SPPUB```, consumer => ```SCPUB```) as Rest Adapter Service does not currently offer any mechanism for that. The encryption/decryption process is explained below. 2 | 3 | * Consumer Gateway generates one time symmetric AES-128 key ```K1``` that's used for encrypting the message payload. 4 | * ```K1``` is then encrypted using service provider's public key ```SPPUB```. 5 | * Encrypted data, encrypted ```K1``` and initialization vector are added to the message payload. 6 | 7 | ``` 8 | 9 | nYZYpsPsN+9gqlZScmYsAMQdWUiCFi...EY0e2oPHJWxAbHn4qMzzuC2VmORvhuapEzUsq2+XXkg== 10 | hTDsRrsowRk+qvV9OnWDvnPHrmb/JUvFRR+t...SKVcX2gnH91NXY/+1kV4A== 11 | iVVpqECe1ZLm7LLcGoq7gg== 12 | 13 | ``` 14 | 15 | * Provider Gateway decrypts the one time symmetric AES-128 key ```K1``` using its private key ```SPPRI```. 16 | * Message data is then decrypted using ```K1``` and initialization vector. 17 | * Provider Gateway then calls the information system using the plain text message data. 18 | * Provider Gateway generates an new one time symmetric AES-128 key ```K2``` that's used for encrypting the response message. 19 | * ```K2``` is then encrypted using service consumer's public key ```SCPUB```. 20 | * Encrypted response, encrypted ```K2``` and initialization vector are added to the response message's payload. 21 | 22 | ``` 23 | 24 | nYZYpsPsN+9gqlZScmYsAMQdWUiCFi...EY0e2oPHJWxAbHn4qMzzuC2VmORvhuapEzUsq2+XXkg== 25 | hTDsRrsowRk+qvV9OnWDvnPHrmb/JUvFRR+t...SKVcX2gnH91NXY/+1kV4A== 26 | iVVpqECe1ZLm7LLcGoq7gg== 27 | 28 | 29 | poc3v2yBkHar...xIXLQu9kicblCHdyCqnkKgR3M1XtDxZKwQ== 30 | HpVFE7e6y2JEt8Z/2/4IX9nwEwqLgTYp...bdlxkFaj0WDDBQiGCCurA== 31 | ykbXPforotsFQAVSh9wI+A== 32 | 33 | ``` 34 | 35 | * Consumer Gateway decrypts the one time symmetric AES-128 key ```K2``` using its private key ```SCPRI```. 36 | * Response message's data is then decrypted using ```K2``` and initialization vector. 37 | * Plain text response data is then returned to the client side information system. 38 | 39 | ## Configuration 40 | 41 | * Generate RSA key pair for Consumer Gateway. 42 | 43 | ``` 44 | keytool -genkeypair -keyalg RSA -alias consumerpri -keystore consumerkeystore.jks -storepass consumerks -validity 360 -keysize 2048 -storetype jks 45 | ``` 46 | 47 | * Export the public key. 48 | 49 | ``` 50 | keytool -exportcert -alias consumerpri -keystore consumerkeystore.jks -rfc -file consumer.cer 51 | ``` 52 | 53 | * Generate RSA key pair for Provider Gateway. 54 | 55 | ``` 56 | keytool -genkeypair -keyalg RSA -alias providerpri -keystore providerkeystore.jks -storepass providerks -validity 360 -keysize 2048 -storetype jks 57 | ``` 58 | 59 | * Export the public key. 60 | 61 | ``` 62 | keytool -exportcert -alias providerpri -keystore providerkeystore.jks -rfc -file provider.cer 63 | ``` 64 | 65 | ### Consumer Gateway 66 | 67 | Import Service Provider's certificate to Service Consumer's trust store. Certificate alias must be the complete service identifier of the service (```FI_PILOT.GOV.1019125-0.Demo2Service.getOrganizationList.v1```) that is going to be called using this certificate. **NB!** If other services of the same service provider are called using the same certificate, the certificate must be imported separately for each service using the full service identifier as an alias. 68 | 69 | ``` 70 | keytool -importcert -file provider.cer -alias FI_PILOT.GOV.1019125-0.Demo2Service.getOrganizationList.v1 -keystore consumertruststore.jks -storetype jks 71 | ``` 72 | 73 | ```consumer-gateway.properties``` file must contain the properties below. 74 | 75 | ``` 76 | # Key length (in bits) of symmetric key. Default is 128 bits. 77 | # NB! Longer key requires installing unlimited key file: 78 | # http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html 79 | keyLength=128 80 | # Absolute path of the trust store file where public keys are stored 81 | publicKeyFile=/path/to/consumertruststore.jks 82 | # Password of the trust store file 83 | publicKeyFilePassword=consumerts 84 | # Absolute path of the key store file where the private key is stored 85 | privateKeyFile=/path/to/consumerkeystore.jks 86 | # Password of the key store file 87 | privateKeyFilePassword=consumerks 88 | # Alias of the private key 89 | privateKeyAlias=consumerpri 90 | # Password of the private key 91 | # N.B. if storetype is PKCS12, key password must be the same as the keystore password 92 | privateKeyPassword=consumer 93 | ``` 94 | 95 | Enabling encryption of sent messages and decryption of received responses for each service is enabled in the ```consumers.properties``` file. 96 | 97 | ``` 98 | 0.id=FI_PILOT.GOV.1019125-0.Demo2Service.getOrganizationList.v1 99 | 0.id.client=FI_PILOT.GOV.0245437-2.ConsumerTest 100 | 0.path=/www.hel.fi/palvelukarttaws/rest/v2/organization/ 101 | 0.verb=get 102 | # Optional - If set to true, request is encrypted. Default : false 103 | # If value is true, all the settings related to encryption must be defined 104 | # in consumer-gateway.properties file. 105 | 0.request.encrypted=true 106 | # Optional - If set to true, expects response to be encrypted. Default : false 107 | # If value is true, all the settings related to encryption must be defined 108 | # in consumer-gateway.properties file. 109 | 0.response.encrypted=true 110 | ``` 111 | 112 | ### Provider Gateway 113 | 114 | Import Service Consumer's public key to Service Provider's trust store. Certificate alias must be the complete service identifier of the subsystem (```FI_PILOT.GOV.0245437-2.ConsumerTest```) that has been granted access to one of the services provided by the Provider Gateway instance. Even if the same subsystem is used for accessing multiple services, it's enough to import the certificate once. 115 | 116 | ``` 117 | keytool -importcert -file consumer.cer -alias FI_PILOT.GOV.0245437-2.ConsumerTest -keystore producertruststore.jks -storetype jks 118 | ``` 119 | 120 | ```provider-gateway.properties``` file must contain the properties below. 121 | 122 | ``` 123 | # Key length (in bits) of symmetric key. Default is 128 bits. 124 | # NB! Longer key requires installing unlimited key file: 125 | # http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html 126 | keyLength=128 127 | # Absolute path of the trust store file where public keys are stored 128 | publicKeyFile=/path/to/producertruststore.jks 129 | # Password of the trust store file 130 | publicKeyFilePassword=providerts 131 | # Absolute path of the key store file where the private key is stored 132 | privateKeyFile=/path/to/providerkeystore.jks 133 | # Password of the key store file 134 | privateKeyFilePassword=providerks 135 | # Alias of the private key 136 | privateKeyAlias=providerpri 137 | # Password of the private key 138 | # N.B. if storetype is PKCS12, key password must be the same as the keystore password 139 | privateKeyPassword=provider 140 | ``` 141 | 142 | Enabling decryption of received requests and encryption of returned responses for each service is enabled in the ```providers.properties``` file. 143 | 144 | ``` 145 | 0.id=FI_PILOT.GOV.1019125-0.Demo2Service.getOrganizationList.v1 146 | 0.id.client=FI_PILOT.GOV.0245437-2.ConsumerTest 147 | 0.path=/www.hel.fi/palvelukarttaws/rest/v2/organization/ 148 | 0.verb=get 149 | # Optional - If set to true, expects request to be encrypted. Default : false 150 | # If value is true, all the settings related to encryption must be defined 151 | # in provider-gateway.properties file. 152 | 0.request.encrypted=true 153 | # Optional - If set to true, response is encrypted. Default : false 154 | # If value is true, all the settings related to encryption must be defined 155 | # in provider-gateway.properties file. 156 | 0.response.encrypted=true 157 | ``` 158 | -------------------------------------------------------------------------------- /documentation/Import-a-Certificate-as-a-Trusted-Certificate.md: -------------------------------------------------------------------------------- 1 | The first step is to obtain the server's public certificate. That can be done in a variety of ways, such as contacting the server admin and asking for it, using openssl to download it, or, since it's an HTTP server, connecting to it with any browser, viewing the page's security info, and saving a copy of the certificate. 2 | 3 | ## Import in native deployment 4 | 5 | Now that you have the certificate saved in a file, you need to add it to your JVM's trust store. At ```$JAVA_HOME/jre/lib/security/``` for JDKs or ```$JAVA_HOME/lib/security``` for JREs, there's a file named cacerts, which comes with Java and contains the public certificates of the well-known Certifying Authorities. To import the new cert, run keytool as a user who has permission to write to cacerts: 6 | ``` 7 | keytool -importcert -alias -file -cacerts 8 | ``` 9 | 10 | ## Import in docker container 11 | 12 | With the certificate file saved on host, the first step is copying it to the ```/tmp``` directory of the docker container. Therefore, from host run: 13 | 14 | ``` 15 | docker cp :/tmp 16 | ``` 17 | 18 | Now that the certificate is in the container, we can use the keytool command to import it into the JVM's trust store. 19 | At ```/opt/java/openjdk/lib/security``` there should be a file named cacerts, which comes with Java and contains the public certificates of the well-known Certifying Authorities. 20 | In order to import the new cert, we need to run keytool in docker container as a user who has permission to write to cacerts. 21 | 22 | ``` 23 | keytool -importcert -alias -file /tmp/ -cacerts 24 | ``` 25 | 26 | **N.B.** The certificate is not persistent over a container's lifecycle and therefore, it must be imported again every time when spinning up a new container. 27 | 28 | -------------------------------------------------------------------------------- /documentation/Requirements.md: -------------------------------------------------------------------------------- 1 | * It **must** be possible to access legacy WSDL-defined x-road services via rest/json. It is **not** necessary to generate RAML from WSDL 2 | * It **must** be possible to access rest/json services via WSDL-defined x-road services. 3 | * WSDLs in the security server **must** match the actual service to facilitate service discovery (i.e. an "execute REST with payload" is not an OK x-road service) -------------------------------------------------------------------------------- /documentation/Setting-up-Development-Environment.md: -------------------------------------------------------------------------------- 1 | This document describes how a developer's workstation can be setup. 2 | 3 | ### Software Requirements 4 | 5 | * Linux or Windows 6 | * Java 21 7 | * Gradle 8.x 8 | 9 | ### Getting the code 10 | 11 | There are several of ways to get code, e.g. download it as a [zip](https://github.com/nordic-institute/REST-adapter-service/archive/master.zip) file or clone the git repository. 12 | 13 | ``` 14 | git clone https://github.com/nordic-institute/REST-adapter-service.git 15 | ``` 16 | 17 | The code is located in the ```adapter``` folder. 18 | 19 | ### Building the code 20 | 21 | Rest Adapter Service uses Gradle as the build management tool. In order to build the whole project and generate the jar file (rest-adapter-service-x.x.x.jar), you must run the gradle command below from the ```adapter``` directory. 22 | 23 | ``` 24 | ./gradlew build 25 | ``` 26 | 27 | Running the above gradle command generates the jar file under the directory presented below: 28 | 29 | ``` 30 | adapter/build/libs/rest-adapter-service-x.x.x.jar 31 | ``` 32 | 33 | ### Enabling encryption 34 | 35 | The project has two profiles: encrypted and plaintext. The default profile is plaintext. To switch to the encrypted profile, you need to add the property ```encrypted```. This can be done using ```-Pencrypted``` when running the gradle command. 36 | 37 | By doing this, the adapter uses ```main/profiles/encrypted``` as the configuration directory otherwise the directory ```main/profiles/plaintext``` is used. 38 | 39 | 40 | ### IDE Setup 41 | 42 | The project can be imported into different IDEs. 43 | Required steps vary depending on the chosen IDE. 44 | Simple quick start is described for IntelliJ IDEA. 45 | 46 | #### IntelliJ IDEA 47 | 48 | Opening the project in IDEA. 49 | 50 | * Install Lombok plugin and Gradle integration plugin, if you have not done it yet 51 | * File -> New project from existing sources -> Choose gradle.build.kts 52 | * Rest of the options can be left at defaults 53 | * Run gradle task ./gradlew bootRun to start up Rest Adapter 54 | 55 | Once started up, Rest Adapter landing page can be found at 56 | `http://localhost:8080/rest-adapter-service/` 57 | and will contain links to Consumer and Provider endpoints in addition to the Provider wsdl. 58 | -------------------------------------------------------------------------------- /documentation/Setting-up-SSL-on-Tomcat [deprecated].md: -------------------------------------------------------------------------------- 1 | The guide is relevant if you are deploying Rest Adapter Service web application into a separate Tomcat web container. 2 | 3 | The set up consists of 4 basic steps: 4 | 5 | 1. Create a keystore file using Java 6 | 2. Configure Tomcat to use the keystore 7 | 3. Test it 8 | 4. How to configure web applications for SSL 9 | 10 | #### 1. Create a keystore 11 | 12 | Use ```keytool``` command to create a self-signed certificate. The below command creates a ```mykeystore``` keystore in the current working directory. 13 | 14 | ``` 15 | keytool -genkey -alias mycert -keyalg RSA -keystore mykeystore 16 | ``` 17 | 18 | During the keystore creation process, you need to assign a password and fill in the certificate’s detail. 19 | 20 | ``` 21 | > keytool -genkey -alias mycert -keyalg RSA -keystore mykeystore 22 | Enter keystore password: password 23 | Re-enter new password: password 24 | What is your first and last name? 25 | [Unknown]: mydomain.com 26 | What is the name of your organizational unit? 27 | [Unknown]: My Unit 28 | What is the name of your organization? 29 | [Unknown]: My Organization 30 | What is the name of your City or Locality? 31 | [Unknown]: Helsinki 32 | What is the name of your State or Province? 33 | [Unknown]: Uusimaa 34 | What is the two-letter country code for this unit? 35 | [Unknown]: FI 36 | Is CN=mydomain.com, OU=My Unit, O=My Organization, L=Helsinki, ST=Uusimaa, C=FI correct? 37 | [no]: yes 38 | 39 | Enter key password for 40 | (RETURN if same as keystore password): password 41 | Re-enter new password: password 42 | ``` 43 | 44 | This will create a ```mykeystore``` file in the current working directory. 45 | 46 | ##### Certificate Details 47 | 48 | It's possible to use ```keytool``` command to list the existing certificate's detail. 49 | 50 | ``` 51 | > keytool -list -keystore mykeystore 52 | Enter keystore password: 53 | 54 | Keystore type: JKS 55 | Keystore provider: SUN 56 | 57 | Your keystore contains 1 entry 58 | 59 | mycert, 22.2.2015, PrivateKeyEntry, 60 | Certificate fingerprint (MD5): 52:13:B6:5F:59:28:98:D1:AE:41:E0:96:59:7E:1F:0B 61 | ``` 62 | 63 | #### 2. Configure Tomcat 64 | 65 | Open ```$TOMCAT/conf/server.xml``` file and find the following declaration. 66 | 67 | ``` 68 | 73 | ``` 74 | 75 | Uncomment it and make the following changes. 76 | 77 | ``` 78 | 83 | ``` 84 | 85 | ```keystoreFile``` and ```keystorePass``` declarations were added, and the ```protocol``` declaration was changed. 86 | 87 | **N.B.** ```keystorePass="password"``` is the password you assigned to your keystore via ```keytool``` command. 88 | 89 | **N.B.** In this example ```mykeystore``` keystore file is stored under Tomcat's home directory (```$TOMCAT```). 90 | 91 | #### 3. Test it 92 | 93 | Start Tomcat and try to access ```https://localhost:8443```. The default ```8080``` port is still working too ```http://localhost:8080```. 94 | 95 | #### 4. How to configure web applications for SSL 96 | 97 | Current configuration allows connecting to applications with both HTTP and HTTPS. Restricting access to HTTPS only can be done by adding the following lines at the end of the ```web.xml``` file of an application. 98 | 99 | ``` 100 | 101 | 102 | securedapp 103 | /* 104 | 105 | 106 | CONFIDENTIAL 107 | 108 | 109 | ``` 110 | -------------------------------------------------------------------------------- /images/default_configuration-rest-gateway-0.0.4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nordic-institute/REST-adapter-service/0b6bf9a50f972c921c056ab706d13d2a7e785c31/images/default_configuration-rest-gateway-0.0.4.png -------------------------------------------------------------------------------- /images/message-sequence_rest-gateway-0.0.4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nordic-institute/REST-adapter-service/0b6bf9a50f972c921c056ab706d13d2a7e785c31/images/message-sequence_rest-gateway-0.0.4.png -------------------------------------------------------------------------------- /images/provider_call-rest-gateway-0.0.4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nordic-institute/REST-adapter-service/0b6bf9a50f972c921c056ab706d13d2a7e785c31/images/provider_call-rest-gateway-0.0.4.png -------------------------------------------------------------------------------- /images/restgw-use-cases.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nordic-institute/REST-adapter-service/0b6bf9a50f972c921c056ab706d13d2a7e785c31/images/restgw-use-cases.png -------------------------------------------------------------------------------- /templates/cloudformation/README.md: -------------------------------------------------------------------------------- 1 | # CloudFormation Templates 2 | 3 | This folder contains AWS CloudFormation templates for X-Road REST Adapter Service. 4 | 5 | ## EC2 REST Adapter Service 6 | 7 | **Disclaimer**: This template is NOT officially supported by REST Adapter Service. 8 | This template is only an example of how AWS could be used with REST 9 | Adapter Service. In addition, it is not guaranteed that every version of REST 10 | Adapter Service will work with this AWS template and in the case of issues, 11 | no support is provided by the development team. 12 | 13 | ```ec2-rest-adapter-service.yaml``` template is for for testing the latest development version of X-Road REST Adapter Service. The template creates a VPC and adds an EC2 instance with an Elastic IP address and a security group. After that the latest version of REST Adapter Service is fetched from GitHub, compiled and started. Once the stack is created the URL of the REST Adapter Service can be checked from the ```Output``` tab. **N.B.** REST Adapter Service is not available immediately when the stack is ready. Installing and configuring REST Adapter Service might take 3-5 minutes. 14 | 15 | The template creates the following AWS resources: 16 | 17 | * VPC 18 | * Subnet 19 | * EC2 instance (instance type can be selected) 20 | * Security Group 21 | * Network ACL 22 | * Elastic IP 23 | * Route Table 24 | 25 | ### Parameters 26 | 27 | ```ec2-rest-adapter-service.yaml``` template has the following parameters which values are defined when a new stack is created. 28 | 29 | * InstanceType 30 | * EC2 instance type. 31 | * KeyName 32 | * Existing EC2 KeyPair to enable SSH access to the instance. If you don't have 33 | a key pair yet you must create one before using this template. 34 | * SSHLocation 35 | * The IP address range that can be used to SSH to the EC2 instance. 36 | * Must be a valid IP CIDR range of the form x.x.x.x/x. 37 | * It is not recommended to use ```0.0.0.0/0``` that makes the service accessible anywhere from the internet. 38 | * HTTPAccessLocation 39 | * The IP address range that can be used to access the defined port. 40 | * Must be a valid IP CIDR range of the form x.x.x.x/x. 41 | * It is not recommended to use ```0.0.0.0/0``` that makes the service accessible anywhere from the internet. 42 | * ServerPort 43 | * The port number that REST Adapter Service is listening (default is 8080). 44 | * REST Adapter Service is available at ```http://:/rest-adapter-service/``` 45 | -------------------------------------------------------------------------------- /templates/cloudformation/ec2-rest-adapter-service.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | AWSTemplateFormatVersion: '2010-09-09' 3 | Description: 'AWS CloudFormation template for testing the latest development 4 | version of X-Road REST Adapter Service. The template creates a VPC and adds 5 | an EC2 instance with an Elastic IP address and a security group. After 6 | that the latest version of REST Adapter Service is fetched from GitHub, 7 | compiled and started. 8 | 9 | N.B.! This template is NOT officially supported by REST Adapter Service. 10 | This template is only an example of how AWS could be used with REST 11 | Adapter Service. In addition, it is not guaranteed that every version of REST 12 | Adapter Service will work with this AWS template and in the case of issues, 13 | no support is provided by the development team.' 14 | Metadata: 15 | AWS::CloudFormation::Interface: 16 | ParameterGroups: 17 | - 18 | Label: 19 | default: 'General' 20 | Parameters: 21 | - InstanceType 22 | - 23 | Label: 24 | default: 'Access and Security' 25 | Parameters: 26 | - KeyName 27 | - SSHLocation 28 | - HTTPAccessLocation 29 | - ServerPort 30 | Parameters: 31 | InstanceType: 32 | Description: WebServer EC2 instance type 33 | Type: String 34 | Default: t2.small 35 | AllowedValues: 36 | - t2.micro 37 | - t2.small 38 | - t2.medium 39 | - t2.large 40 | - t2.xlarge 41 | - t2.2xlarge 42 | ConstraintDescription: must be a valid EC2 instance type. 43 | KeyName: 44 | Description: ' EC2 KeyPair to enable SSH access to the instance' 45 | Type: AWS::EC2::KeyPair::KeyName 46 | SSHLocation: 47 | Description: ' The IP address range that can be used to SSH to the EC2 instance (optional)' 48 | Type: String 49 | MinLength: '9' 50 | MaxLength: '18' 51 | Default: 0.0.0.0/0 52 | AllowedPattern: "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})" 53 | ConstraintDescription: must be a valid IP CIDR range of the form x.x.x.x/x. 54 | HTTPAccessLocation: 55 | Description: ' The IP address range that can be used to access the defined port (optional)' 56 | Type: String 57 | MinLength: '9' 58 | MaxLength: '18' 59 | Default: 0.0.0.0/0 60 | AllowedPattern: "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})" 61 | ConstraintDescription: must be a valid IP CIDR range of the form x.x.x.x/x. 62 | ServerPort: 63 | Description: ' The port number that REST Adapter Service is listening' 64 | Type: Number 65 | Default: 8080 66 | ConstraintDescription: must be a valid port number. 67 | Mappings: 68 | RegionMap: 69 | us-east-1: 70 | AMI: ami-6057e21a 71 | us-west-1: 72 | AMI: ami-6057e21a 73 | us-west-2: 74 | AMI: ami-32d8124a 75 | eu-central-1: 76 | AMI: ami-e28d098d 77 | eu-west-1: 78 | AMI: ami-760aaa0f 79 | eu-west-2: 80 | AMI: ami-e3051987 81 | sa-east-1: 82 | AMI: ami-1678037a 83 | ap-southeast-1: 84 | AMI: ami-dd7935be 85 | ap-southeast-2: 86 | AMI: ami-1a668878 87 | ap-northeast-1: 88 | AMI: ami-2803ac4e 89 | ap-northeast-2: 90 | AMI: ami-fc862292 91 | ap-south-1: 92 | AMI: ami-2ed19c41 93 | ca-central-1: 94 | AMI: ami-ef3b838b 95 | Resources: 96 | VPC: 97 | Type: AWS::EC2::VPC 98 | Properties: 99 | CidrBlock: 10.0.0.0/28 100 | Tags: 101 | - Key: Name 102 | Value: !Ref AWS::StackName 103 | Subnet: 104 | Type: AWS::EC2::Subnet 105 | Properties: 106 | VpcId: !Ref VPC 107 | CidrBlock: 10.0.0.0/28 108 | Tags: 109 | - Key: Name 110 | Value: !Ref AWS::StackName 111 | InternetGateway: 112 | Type: AWS::EC2::InternetGateway 113 | Properties: 114 | Tags: 115 | - Key: Name 116 | Value: !Ref AWS::StackName 117 | AttachGateway: 118 | Type: AWS::EC2::VPCGatewayAttachment 119 | Properties: 120 | VpcId: !Ref VPC 121 | InternetGatewayId: !Ref InternetGateway 122 | RouteTable: 123 | Type: AWS::EC2::RouteTable 124 | Properties: 125 | VpcId: !Ref VPC 126 | Tags: 127 | - Key: Name 128 | Value: !Ref AWS::StackName 129 | Route: 130 | Type: AWS::EC2::Route 131 | DependsOn: AttachGateway 132 | Properties: 133 | RouteTableId: !Ref RouteTable 134 | DestinationCidrBlock: 0.0.0.0/0 135 | GatewayId: !Ref InternetGateway 136 | SubnetRouteTableAssociation: 137 | Type: AWS::EC2::SubnetRouteTableAssociation 138 | Properties: 139 | SubnetId: !Ref Subnet 140 | RouteTableId: !Ref RouteTable 141 | NetworkAcl: 142 | Type: AWS::EC2::NetworkAcl 143 | Properties: 144 | VpcId: !Ref VPC 145 | Tags: 146 | - Key: Name 147 | Value: 148 | Ref: AWS::StackName 149 | InboundHTTPNetworkAclEntry: 150 | Type: AWS::EC2::NetworkAclEntry 151 | Properties: 152 | NetworkAclId: !Ref NetworkAcl 153 | RuleNumber: '100' 154 | Protocol: '6' 155 | RuleAction: allow 156 | Egress: 'false' 157 | CidrBlock: 0.0.0.0/0 158 | PortRange: 159 | From: !Ref ServerPort 160 | To: !Ref ServerPort 161 | InboundSSHNetworkAclEntry: 162 | Type: AWS::EC2::NetworkAclEntry 163 | Properties: 164 | NetworkAclId: !Ref NetworkAcl 165 | RuleNumber: '101' 166 | Protocol: '6' 167 | RuleAction: allow 168 | Egress: 'false' 169 | CidrBlock: 0.0.0.0/0 170 | PortRange: 171 | From: '22' 172 | To: '22' 173 | InboundResponsePortsNetworkAclEntry: 174 | Type: AWS::EC2::NetworkAclEntry 175 | Properties: 176 | NetworkAclId: !Ref NetworkAcl 177 | RuleNumber: '102' 178 | Protocol: '6' 179 | RuleAction: allow 180 | Egress: 'false' 181 | CidrBlock: 0.0.0.0/0 182 | PortRange: 183 | From: '1024' 184 | To: '65535' 185 | OutBoundHTTPNetworkAclEntry: 186 | Type: AWS::EC2::NetworkAclEntry 187 | Properties: 188 | NetworkAclId: !Ref NetworkAcl 189 | RuleNumber: '100' 190 | Protocol: '6' 191 | RuleAction: allow 192 | Egress: 'true' 193 | CidrBlock: 0.0.0.0/0 194 | PortRange: 195 | From: '80' 196 | To: '80' 197 | OutBoundHTTPSNetworkAclEntry: 198 | Type: AWS::EC2::NetworkAclEntry 199 | Properties: 200 | NetworkAclId: !Ref NetworkAcl 201 | RuleNumber: '101' 202 | Protocol: '6' 203 | RuleAction: allow 204 | Egress: 'true' 205 | CidrBlock: 0.0.0.0/0 206 | PortRange: 207 | From: '443' 208 | To: '443' 209 | OutBoundResponsePortsNetworkAclEntry: 210 | Type: AWS::EC2::NetworkAclEntry 211 | Properties: 212 | NetworkAclId: !Ref NetworkAcl 213 | RuleNumber: '102' 214 | Protocol: '6' 215 | RuleAction: allow 216 | Egress: 'true' 217 | CidrBlock: 0.0.0.0/0 218 | PortRange: 219 | From: '1024' 220 | To: '65535' 221 | SubnetNetworkAclAssociation: 222 | Type: AWS::EC2::SubnetNetworkAclAssociation 223 | Properties: 224 | SubnetId: !Ref Subnet 225 | NetworkAclId: !Ref NetworkAcl 226 | IPAddress: 227 | Type: AWS::EC2::EIP 228 | DependsOn: AttachGateway 229 | Properties: 230 | Domain: vpc 231 | InstanceId: !Ref WebServerInstance 232 | InstanceSecurityGroup: 233 | Type: AWS::EC2::SecurityGroup 234 | Properties: 235 | VpcId: !Ref VPC 236 | GroupDescription: 'Enable SSH access via port 22 and application access via defined port.' 237 | SecurityGroupIngress: 238 | - IpProtocol: tcp 239 | FromPort: '22' 240 | ToPort: '22' 241 | CidrIp: 242 | Ref: SSHLocation 243 | - IpProtocol: tcp 244 | FromPort: !Ref ServerPort 245 | ToPort: !Ref ServerPort 246 | CidrIp: !Ref HTTPAccessLocation 247 | Tags: 248 | - Key: Name 249 | Value: !Ref AWS::StackName 250 | WebServerInstance: 251 | Type: AWS::EC2::Instance 252 | Properties: 253 | ImageId: 254 | Fn::FindInMap: 255 | - RegionMap 256 | - !Ref AWS::Region 257 | - AMI 258 | SecurityGroupIds: 259 | - !Ref InstanceSecurityGroup 260 | SubnetId: !Ref Subnet 261 | InstanceType: !Ref InstanceType 262 | KeyName: !Ref KeyName 263 | Tags: 264 | - Key: Name 265 | Value: !Ref AWS::StackName 266 | UserData: 267 | Fn::Base64: !Sub | 268 | #!/bin/bash 269 | yum update -y 270 | yum remove java-1.7.0-openjdk -y 271 | yum install java-1.8.0-openjdk-devel -y 272 | yum install git -y 273 | cd /usr/local 274 | wget http://www-us.apache.org/dist/maven/maven-3/3.5.2/binaries/apache-maven-3.5.2-bin.tar.gz 275 | tar xvf apache-maven-3.5.2-bin.tar.gz 276 | rm apache-maven-3.5.2-bin.tar.gz 277 | cd /home/ec2-user 278 | echo "export M2_HOME=/usr/local/apache-maven-3.5.2" >> .bash_profile 279 | echo "export M2=\$M2_HOME/bin" >> .bash_profile 280 | echo "export PATH=\$M2:\$PATH" >> .bash_profile 281 | git clone https://github.com/vrk-kpa/REST-adapter-service.git 282 | chown -R ec2-user:ec2-user REST-adapter-service/ 283 | cd REST-adapter-service/src/ 284 | /usr/local/apache-maven-3.5.2/bin/mvn spring-boot:run -Drun.jvmArguments="-Dserver.port=${ServerPort}" 285 | Outputs: 286 | PublicURL: 287 | Value: !Sub 'http://${WebServerInstance.PublicIp}:${ServerPort}/rest-adapter-service/' 288 | Description: REST Adapter Service URL 289 | --------------------------------------------------------------------------------