-
Notifications
You must be signed in to change notification settings - Fork 96
Develop test#1830: taking latest release changes to develop #337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
91 commits
Select commit
Hold shift + click to select a range
ce7b333
Updated Pom versions for release changes
Prafulrakhade a077d3b
Merge pull request #239 from mosip/releas-branch
ckm007 d315033
[MOSIP-35160] Updated URL from https://github.com/mosip/mosip-infra/b…
Prafulrakhade 1b01fc0
Merge pull request #244 from Prafulrakhade/release-1.3.x
ckm007 a1618bb
MOSIP-32453: Fixed pdf generation issue (#245)
dhanendra06 c2c7eeb
Updated the released versions for commons dependency
GOKULRAJ136 4ace410
updated the versions from the props
GOKULRAJ136 d4f0c3a
Merge pull request #246 from GOKULRAJ136/pom-1.3.x
ckm007 9aedc4b
updated readme for developer guide java21
GOKULRAJ136 409fb54
updated config props and jdk versions
GOKULRAJ136 f59af6f
updated the configuration
GOKULRAJ136 0704db5
Update configuration.md
GOKULRAJ136 d979cf1
Merge pull request #249 from GOKULRAJ136/doc-1.3.x
ckm007 c4ff3fb
MOSIP-32453
dhanendra06 3e05771
MOSIP-32453
dhanendra06 5376dc0
Merge pull request #250 from dhanendra06/mosip-186
ckm007 1a0ac8d
Updated chart versions, image and tag for release changes
Prafulrakhade d75bb0f
Merge pull request #252 from mosip/releas-branch
ckm007 4557954
[DSD-6825] platform 1.2.1.0-beta-1 release (#253)
ckm007 bdd00b4
Updated chart versions, image and tag for release changes (#254)
ckm007 c07c6ec
Updated Pom version and Chart version for post-release changes (#255)
ckm007 f86b2af
MOSIP-25202 - fix sonar reliability issues
ymahtat-dev a9a8411
MOSIP-25202 - github actions fix - update actions/upload-artifact and…
ymahtat-dev 116b3b6
Merge pull request #259 from ymahtat-dev/draft-release-1.3.x
ckm007 89ef4ee
[MOSIP-40012] Corrected ZGC (#263)
GOKULRAJ136 caac4cb
MOSIP-40719 change version to snapshot (#264)
kameshsr 0546ea0
MOSIP-37901: print-release (#260)
nagendra0721 a9464d7
MOSIP-37901: change to RC (#265)
nagendra0721 a351bf0
[MOSIP-41674] Updated the changes for mosip namespace migration from …
Prafulrakhade 9f7bd02
Merge pull request #271 from Prafulrakhade/release-1.3.x
ckm007 de5a004
[MOSIP-42464] [MOSIP-41674] central sonatype migration changes
Prafulrakhade 0941336
Merge pull request #278 from Prafulrakhade/release-1.3.x-MOSIP-42464
dhanendra06 d52bb40
pom and util updates
nandhu-kumar 716d135
dateutil changes
nandhu-kumar 40ba6dc
Merge pull request #283 from nandhu-kumar/release13x
dhanendra06 3668689
[MOSIP-43631] updated helm charts
GOKULRAJ136 85ef9ef
Merge pull request #285 from GOKULRAJ136/MOSIP-43631
dhanendra06 4d52088
Update values.yaml
GOKULRAJ136 52c93da
Merge pull request #288 from GOKULRAJ136/patch-1
dhanendra06 ca2473c
update tag version
dhanendra06 a8d88dc
Updated tag version
dhanendra06 ff0c443
Merge pull request #289 from dhanendra06/MOSIP-018
ckm007 d93da27
Add THIRD-PARTY-NOTICES.txt with package details
Rakshithasai123 23c23af
MOSIP-43803 - removed commented out dependency in pom
nandhu-kumar 81f08c8
Merge pull request #293 from nandhu-kumar/release-13x-01
dhanendra06 251ac0a
Create Apache-2.0.txt
Rakshithasai123 9a13d8b
fix cpu & memory
kaledOu 3fb2502
Merge pull request #296 from kaledOu/release-1.3.x-helm
ckm007 547d28a
Create NOTICES.txt
rajapandi1234 b95445b
Update THIRD-PARTY-NOTICES.txt
Rakshithasai123 b12cf10
Update THIRD-PARTY-NOTICES.txt
Rakshithasai123 f2518ba
Update THIRD-PARTY-NOTICES.txt
Rakshithasai123 75bbd9f
Update THIRD-PARTY-NOTICES.txt
Rakshithasai123 ca72c8d
Create NOTICES.txt
Rakshithasai123 a1682b9
Create MPL-2.0.txt
Rakshithasai123 b815db5
Create EPL-1.0.txt
Rakshithasai123 eb4fba7
Create EPL-2.0.txt
Rakshithasai123 196d341
Create BSD-2.0.txt
Rakshithasai123 a78f943
Create BSD-3-Clause.txt
Rakshithasai123 f2ab7dd
Create AGPL-3.0-only.txt
Rakshithasai123 ad8f0d9
Create LGPL-3.0-only.txt
Rakshithasai123 a449971
Create JSON.txt
Rakshithasai123 4fa488d
Create MIT.txt
Rakshithasai123 f76c4b1
Rename NOTICES.txt to NOTICE
Rakshithasai123 69fad02
[MOSIP-42190] : Sonar coverage, Taken test cases from develop (#299)
chetankh239 a78fccb
Rename NOTICES.txt to NOTICE
rajapandi1234 bae3edb
Update Apache-2.0.txt
Rakshithasai123 012b81a
Update Apache-2.0.txt
Rakshithasai123 d5940fc
Update THIRD-PARTY-NOTICES.txt
Rakshithasai123 7f8e82d
[MOSIP-44072] : Updated README.md (#310)
chetankh239 1a63a31
Merge pull request #303 from rajapandi1234/patch-5
Mahesh-Binayak b739140
Merge pull request #295 from Rakshithasai123/patch-3
Mahesh-Binayak 035588a
Merge pull request #292 from Rakshithasai123/patch-1
Mahesh-Binayak e9ac0e3
Merge pull request #309 from Rakshithasai123/patch-14
Mahesh-Binayak 24f0271
Updated chart versions, image and tag for release changes (#312)
ckm007 dd8f5be
Updated Pom versions for release changes (#313)
ckm007 f2b1709
[MOSIP-44867]fixing duplicate license issues (#317)
Mahesh-Binayak 095fd4d
[MOSIP-44894] Renamed licences (#320)
amanbh321 b7baebb
SNAPSHOT changes for licensing folder space issue fix (#326)
kameshsr a55f369
Updated chart versions, image and tag for release changes (#334)
ckm007 2f574d7
Updated Pom versions for release changes (#335)
ckm007 82ff1f5
Merge branch 'rel-1.3.1-test' into develop-test
nagendra0721 7aced28
#1830: taking latest release changes to develop
nagendra0721 257d705
#1830: image revert to qa
nagendra0721 38680ab
#1830: agents.md file added
nagendra0721 3d028cb
#1830: agents.md file modified
nagendra0721 ea20c2e
#1830: modified as per suggestion
nagendra0721 e22baa2
#1830: update bootstrap fie
nagendra0721 25f1501
#1830: update agents file
nagendra0721 1244290
#1830: update pom file
nagendra0721 390fa65
#1830: update readme file
nagendra0721 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,265 @@ | ||
| # AGENTS.md — MOSIP Print Service | ||
|
|
||
| This file provides guidance to AI agents when working with code in this repository. | ||
|
|
||
| --- | ||
|
|
||
| ## Project Overview | ||
|
|
||
| The **MOSIP Print Service** is a Spring Boot microservice that generates PDF identity credentials (eUIN cards, reprint cards, QR code cards) for residents enrolled in MOSIP — the Modular Open Source Identity Platform. | ||
|
|
||
| It sits at the tail end of the **ID Lifecycle Management** pipeline: | ||
| 1. A resident registers or updates their ID at a registration centre. | ||
| 2. Demographic and biometric data are captured and processed by Registration Processor. | ||
| 3. Credentials are issued and an event is published to WebSub. | ||
| 4. **This service** consumes the credential event, decrypts resident data, renders a template, generates a PDF, uploads it to DataShare, and publishes a completion event. | ||
|
|
||
| The service is a **reference implementation** for credential partner onboarding. Deployers are expected to customise templates and partner certificates. | ||
|
|
||
| --- | ||
|
|
||
| ## Technology Stack | ||
|
|
||
| | Layer | Technology | | ||
| |---|--------------------------------------------| | ||
| | Language | Java 21 | | ||
| | Framework | Spring Boot 3.2.3 + Spring Cloud Config | | ||
| | Build | Maven 3.9.6 | | ||
| | PDF generation | pdfbox | ||
| | Template engine | Apache Velocity 1.7 | | ||
| | QR codes | ZXing (Google) 3.4.1 | | ||
| | Cryptography | BouncyCastle 1.66, JWT 3.8.1 | | ||
| | Messaging | MOSIP WebSub (kernel-websub-client-api) | | ||
| | Biometrics | CBEFF format via kernel-cbeffutil | | ||
| | Tests | JUnit 5, Mockito 4.11.0, JaCoCo | | ||
| | Containerisation | Docker (Alpine-based), Helm for Kubernetes | | ||
|
|
||
| --- | ||
|
|
||
| ## Repository Layout | ||
|
|
||
| ``` | ||
| print/ | ||
| ├── src/main/java/io/mosip/print/ | ||
| │ ├── PrintPDFApplication.java # Spring Boot entry point | ||
| │ ├── controller/Print.java # Single REST endpoint (WebSub callback) | ||
| │ ├── service/ | ||
| │ │ ├── PrintService.java # Interface | ||
| │ │ └── impl/ | ||
| │ │ ├── PrintServiceImpl.java # Core orchestration logic (~500 lines) | ||
| │ │ ├── PDFGeneratorImpl.java # iText PDF generation | ||
| │ │ ├── QrcodeGeneratorImpl.java # ZXing QR code generation | ||
| │ │ ├── TemplateManagerImpl.java # Velocity template processing | ||
| │ │ ├── CbeffImpl.java # Biometric (CBEFF) handling | ||
| │ │ └── UinCardGeneratorImpl.java | ||
| │ ├── util/ # 50+ utility classes | ||
| │ │ ├── CryptoUtil.java # Encryption / decryption | ||
| │ │ ├── DataShareUtil.java # DataShare upload | ||
| │ │ ├── TemplateGenerator.java # Template instantiation | ||
| │ │ ├── DigitalSignatureUtility.java # PDF digital signing | ||
| │ │ ├── WebSubSubscriptionHelper.java # WebSub subscription management | ||
| │ │ └── RestApiClient.java # HTTP client wrapper | ||
| │ ├── dto/ # 65+ Data Transfer Objects | ||
| │ ├── constant/ # 35+ constant classes | ||
| │ ├── exception/ # 35+ custom exception classes | ||
| │ ├── model/ # Domain models (Event, StatusEvent) | ||
| │ └── entity/ # CBEFF entity models | ||
| ├── src/main/resources/ | ||
| │ ├── application-local1.properties # Local dev config (port 8088) | ||
| │ ├── bootstrap.properties # Spring Cloud Config bootstrap | ||
| │ └── partner.p12 # Sample partner certificate | ||
| ├── src/test/java/io/mosip/print/ # 45+ unit test files | ||
| ├── docs/ | ||
| │ ├── build-and-run.md | ||
| │ ├── configuration.md | ||
| │ └── print-service.png # Architecture diagram | ||
| ├── deploy/ # Shell scripts for bare-metal deploy | ||
| ├── helm/ # Kubernetes Helm charts | ||
| ├── Dockerfile | ||
| └── pom.xml | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Build and Run | ||
|
|
||
| ### Build (skip tests) | ||
| ```bash | ||
| mvn install -DskipTests=true -Dmaven.javadoc.skip=true -Dgpg.skip=true | ||
| ``` | ||
|
|
||
| ### Build with tests | ||
| ```bash | ||
| mvn clean install -Dmaven.javadoc.skip=true -Dgpg.skip=true | ||
| ``` | ||
|
|
||
| ### Run tests only | ||
| ```bash | ||
| mvn test | ||
| ``` | ||
|
|
||
| ### Run the JAR | ||
| ```bash | ||
| java -Dloader.path=<path-to-kernel-auth-adapter.jar> \ | ||
| -Dspring.profiles.active=local1 \ | ||
| -jar target/print-*.jar | ||
| ``` | ||
|
|
||
| ### Docker | ||
| ```bash | ||
| # Build image | ||
| docker build -t print-service:local . | ||
|
|
||
| # Run container | ||
| docker run -d -p 8099:8099 --name print-service print-service:local | ||
| ``` | ||
|
|
||
| Service listens on **port 8099** (default) or **port 8088** (local1 profile). | ||
|
|
||
| --- | ||
|
|
||
| ## Key Configuration Properties | ||
|
|
||
| All runtime configuration is sourced from a **Spring Cloud Config Server** (mosip-config repository). Local overrides live in `application-local1.properties`. | ||
|
|
||
| | Property | Purpose | | ||
| |---|---| | ||
| | `mosip.event.hubURL` | WebSub hub URL | | ||
| | `mosip.partner.id` | This service's partner ID (`mpartner-default-print`) | | ||
| | `mosip.event.topic` | WebSub topic to subscribe to | | ||
| | `mosip.event.callBackUrl` | Public URL of the `/print/callback/notifyPrint` endpoint | | ||
| | `mosip.event.secret` | WebSub HMAC secret | | ||
| | `mosip.datashare.partner.id` | DataShare partner (`mpartner-default-resident`) | | ||
| | `mosip.datashare.policy.id` | DataShare policy (`mpolicy-default-resident`) | | ||
| | `mosip.print.crypto.p12.filename` | Partner P12 certificate filename | | ||
| | `mosip.print.crypto.p12.password` | P12 password | | ||
| | `mosip.print.crypto.p12.alias` | P12 key alias | | ||
| | `mosip.template-language` | Language code for template lookup (e.g. `eng`) | | ||
| | `mosip.kernel.pdf_owner_password` | PDF encryption owner password | | ||
| | `mosip.supported-languages` | Comma-separated ISO language codes | | ||
| | `mosip.iam.adapter.clientid` | Keycloak client ID for this service | | ||
| | `mosip.iam.adapter.issuerURL` | Keycloak realm issuer URL | | ||
| | `TEMPLATES` | Masterdata templates endpoint | | ||
| | `CREATEDATASHARE` | DataShare create endpoint | | ||
| | `PDFSIGN` | Keymanager PDF sign endpoint | | ||
|
|
||
| --- | ||
|
|
||
| ## REST API | ||
|
|
||
| ### `POST /v1/print/print/callback/notifyPrint` | ||
|
|
||
| The single public endpoint. Called by the WebSub hub when a credential event is published. | ||
|
|
||
| **Headers required:** | ||
| - `x-hub-signature` — HMAC-SHA256 signature from WebSub hub (validated by the service) | ||
|
|
||
| **Body:** WebSub notification JSON containing the credential event payload. | ||
|
|
||
| **Flow:** | ||
| 1. Validates WebSub signature and intent. | ||
| 2. Extracts and decrypts credential data using the partner P12 key. | ||
| 3. Fetches the HTML template for the card type from Masterdata. | ||
| 4. Renders the template with resident data using Velocity. | ||
| 5. Converts HTML to PDF via iText html2pdf. | ||
| 6. Optionally embeds a QR code and applies a digital signature. | ||
| 7. Uploads the PDF to DataShare. | ||
| 8. Publishes a `CREDENTIAL_STATUS_UPDATE` event back to WebSub. | ||
|
|
||
| --- | ||
|
|
||
| ## Data Flow and Integration Points | ||
|
|
||
| ``` | ||
| WebSub Hub | ||
| │ POST /print/callback/notifyPrint | ||
| ▼ | ||
| Print.java (controller) | ||
| │ generateCard(event) | ||
| ▼ | ||
| PrintServiceImpl.java | ||
| ├── KeyManager / CryptoUtil — decrypt credential data | ||
| ├── Masterdata (TEMPLATES) — fetch HTML template | ||
| ├── TemplateManagerImpl — merge template + data (Velocity) | ||
| ├── PDFGeneratorImpl — HTML → PDF (PDF Box) | ||
| ├── QrcodeGeneratorImpl — embed QR code (ZXing) | ||
| ├── DigitalSignatureUtility — sign PDF (Keymanager PDFSIGN) | ||
| ├── DataShareUtil — upload PDF (DataShare) | ||
| └── WebSubSubscriptionHelper — publish status event | ||
| ``` | ||
|
|
||
| External services consumed: | ||
| - **Keymanager** — decryption and PDF signing | ||
| - **Masterdata** — HTML templates | ||
| - **DataShare** — secure PDF upload | ||
| - **WebSub** — event subscription and publication | ||
| - **IAM (Keycloak)** — token-based authentication for all REST calls | ||
|
|
||
| --- | ||
|
|
||
| ## ID Lifecycle Context | ||
|
|
||
| MOSIP's ID Lifecycle Management covers the full journey of an identity: | ||
|
|
||
| - **Registration** — Resident attends a registration centre; demographic and biometric data are captured. | ||
| - **Processing** — Registration Processor de-duplicates and validates the data. | ||
| - **Activation** — A UIN (Unique Identification Number) is issued; the ID is active. | ||
| - **Credential Issuance** — Credentials (VCs, PDF cards) are generated for configured partners. | ||
| - **Updates** — Resident can update demographics or biometrics; a new credential is re-issued. | ||
| - **Deactivation / Reactivation** — IDs can be deactivated and reactivated via resident services. | ||
| - **Print / Reprint** — This service handles the print partner use case: it receives credential events and produces PDF identity cards. | ||
|
|
||
| This service handles the **Credential Issuance → Print** leg. The `UinCardType` constant class enumerates supported card types: `EUIN`, `REPRINT`, `QRCODE`. | ||
|
|
||
| --- | ||
|
|
||
| ## Working with This Codebase | ||
|
|
||
| ### Before making changes | ||
| 1. Read `PrintServiceImpl.java` — it is the central orchestrator; most changes flow through it. | ||
| 2. Check `PrintRestClientServiceImpl.java` for how external REST calls are made before adding new ones. | ||
| 3. Verify properties exist in `application-local1.properties` or `docs/configuration.md` before introducing new config keys. | ||
|
|
||
| ### Adding a new card type | ||
| 1. Add a constant to `UinCardType.java`. | ||
| 2. Add a template to Masterdata and reference it in `PrintServiceImpl.generateCard()`. | ||
| 3. Add a corresponding branch in `TemplateGenerator.java` if template rendering differs. | ||
|
|
||
| ### Modifying template rendering | ||
| Templates are HTML files processed by Velocity. Variables are injected via `VelocityContext`. See `TemplateManagerImpl.java` and `TemplateGenerator.java`. | ||
|
|
||
| ### Cryptography | ||
| Do not modify `CryptoUtil.java` without understanding the P12 key usage. The partner certificate must match the credential encryption key registered in Keymanager. | ||
|
|
||
| ### Tests | ||
| - Unit tests are in `src/test/java/io/mosip/print/`. | ||
| - Tests use Mockito; external service calls are mocked. | ||
| - Run `mvn test` before committing any change. | ||
| - JaCoCo generates a coverage report under `target/site/jacoco/`. | ||
|
|
||
| ### Docker image | ||
| The `Dockerfile` copies the built JAR and runs it. The image is published to Docker Hub as `mosipid/print-service`. | ||
|
|
||
| --- | ||
|
|
||
| ## Conventions | ||
|
|
||
| - Package root: `io.mosip.print` | ||
| - All Spring beans follow constructor injection where possible. | ||
| - REST responses are wrapped in a standard `ResponseWrapper<T>` DTO. | ||
| - Exceptions extend `BaseCheckedException` or `BaseUncheckedException` from the MOSIP kernel. | ||
| - Logging uses `io.mosip.print.logger.PrintLogger` (SLF4J wrapper); do not use `System.out`. | ||
| - Constants live in dedicated files under the `constant/` package; do not hard-code strings inline. | ||
| - All external HTTP calls go through `PrintRestClientService` — do not use `RestTemplate` directly in service classes. | ||
|
|
||
| --- | ||
|
|
||
| ## Useful References | ||
|
|
||
| - MOSIP documentation: https://docs.mosip.io/1.2.0/ | ||
| - ID Lifecycle Management: https://docs.mosip.io/1.2.0/id-lifecycle-management | ||
| - mosip-config repository: contains `print-default.properties` with all runtime properties | ||
| - MOSIP functional tests: https://github.com/mosip/mosip-functional-tests | ||
| - Docker Hub image: `mosipid/print-service` | ||
| - Build and run guide: `docs/build-and-run.md` | ||
| - Configuration guide: `docs/configuration.md` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.