Skip to content

[MOSIP-44476] setup IDA in local machine and use client to test it. - #1731

Merged
ckm007 merged 3 commits into
mosip:developfrom
mahammedtaheer:develop
May 18, 2026
Merged

ckm007 merged 3 commits into
mosip:developfrom
mahammedtaheer:develop

Conversation

@mahammedtaheer

@mahammedtaheer mahammedtaheer commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Local development environment for ID Authentication service with Docker-based infrastructure
    • Sample authentication client supporting demo authentication, OTP requests, and multi-factor flows
    • Interactive CLI tool for testing authentication scenarios
  • Documentation

    • Complete setup guide covering prerequisites, configuration, services, and troubleshooting

Review Change Stack

Signed-off-by: Mahammed Taheer <mohd.taheer@gmail.com>
@coderabbitai

coderabbitai Bot commented May 14, 2026 •

Copy link
Copy Markdown

Walkthrough

This pull request introduces a complete local development environment for the MOSIP ID Authentication service. It adds a Python FastAPI client with end-to-end OTP and authentication flows, cryptographic request signing and encryption utilities, an interactive CLI for testing, Docker Compose infrastructure for PostgreSQL/config-server/WireMock/BioSDK mock services, and comprehensive setup documentation.

Changes

IDA Sample Python Client

Layer / File(s) Summary
App initialization and configuration
client/__init__.py
FastAPI app initialization, Dynaconf config loading from multiple TOML/config files, logger setup with stdout/file handlers, and runtime metadata resolution (worker ID from pgrep, pod ID from container name).
Request models and exception types
authenticator/model/auth_request.py, authenticator/model/__init__.py, authenticator/exceptions/authenticator_exception.py, authenticator/exceptions/__init__.py
Pydantic models for authentication requests (MOSIPAuthRequest), demographics data, encryption request envelopes, and exception classes (AuthenticatorException, AuthenticatorCryptoException) with error codes.
Cryptographic utilities
authenticator/utils/cryptoutil.py, authenticator/utils/__init__.py
CryptoUtility class implementing AES-GCM symmetric encryption with random keys, RSA-OAEP asymmetric key wrapping, JWS compact serialization with x5c and kid headers derived from X.509 certificates.
REST request utilities
authenticator/utils/restutil.py
RestUtility class wrapping requests library for HTTP GET/POST with configurable authorization headers and optional path parameter appending.
MOSIP authenticator implementation
authenticator/authenticator.py, authenticator/__init__.py
MOSIPAuthenticator class orchestrating demo auth, OTP requests, OTP auth, and combined demo+OTP flows; encrypts/signs request payloads, POSTs to IDA endpoints, and re-raises exceptions as AuthenticatorException.
Interactive CLI and entrypoint
authenticator/cli_options.py, authenticator/main.py, authenticator/authenticator-config-local.toml
Interactive CLI menu for testing all auth flows with JSON sample file loading; menu-driven option selection with exception handling; entrypoint that loads config and launches CLI; local TOML config with MOSIP auth/OTP endpoints, encryption/signing parameters, and logging destination.
Configuration, sample data, and dependencies
requirements.txt, new-keys/ida-partner-local.cer, samples/auth-req-01.json
Python dependencies (fastapi, dynaconf, cryptography, jwcrypto, requests, pydantic); local partner X.509 certificate for encryption; sample identity request JSON with demographics fields.

Local Development Infrastructure

Layer / File(s) Summary
Docker Compose service definitions
docker-compose/docker-compose.yml
PostgreSQL database on port 5455 with init.sql script, Mosip config-server on port 51000 with native filesystem config, WireMock mock service on port 8082 with request/response stubs, and BioSDK mock service on port 8083 with healthcheck dependency ordering.
Database schema and initialization
docker-compose/init.sql
Postgres mosip_ida database and ida schema; 23+ tables for auth transactions, API keys, partner/policy data, OTP/locks, identity cache, and Spring Batch job tracking; indexes and autovacuum tuning; Spring Batch sequences; and INSERT statements seeding authentication/crypto/partner tables.
WireMock mock service stubs
docker-compose/wiremock/mappings/master-data.json, docker-compose/wiremock/__files/EMPTY-FILE
Request/response mappings for masterdata GET (titles, email/SMS templates), OIDC token POST, WebSub hub, OTP generation, and notifier endpoints; response-template usage for dynamic OTP generation.
BioSDK mock artifact preparation
prepare-biosdk-mock-lib.sh, prepare-biosdk-mock-lib.bat
Bash and batch scripts that download BioSDK mock JAR from Maven Central, package into mock-sdk.zip, deploy into WireMock __files directory, with error handling and cleanup on both platforms.

Documentation and Test Report

Layer / File(s) Summary
Setup guide and test report
LOCAL-DEV-SETUP.md, setup-test-report.html
Comprehensive markdown guide covering prerequisites, repository build, property file configuration, Docker Compose startup, OTP/Auth service runtime setup, Python CLI usage, service URLs, and troubleshooting; self-contained HTML test report with environment metadata, configuration matrices, service health status, sample client test results, and log file paths.

Sequence Diagram

sequenceDiagram
  participant CLI as User CLI
  participant Auth as MOSIPAuthenticator
  participant Crypto as CryptoUtility
  participant Rest as RestUtility
  participant IDA as IDA Server

  CLI->>Auth: do_auth(demographics)
  Auth->>Crypto: encrypt_auth_data(payload)
  Crypto-->>Auth: encrypted_auth, encrypted_key, encrypted_hash
  Auth->>Crypto: sign_auth_request_data(request_json)
  Crypto-->>Auth: signed_request_jws
  Auth->>Rest: post_request(ida_auth_url, signed_request)
  Rest->>IDA: POST /ida/v1/auth
  IDA-->>Rest: response_json
  Rest-->>Auth: response_text
  Auth-->>CLI: response_text

  CLI->>Auth: send_otp_request(idvid)
  Auth->>Crypto: sign_auth_request_data(otp_request_json)
  Crypto-->>Auth: signed_request_jws
  Auth->>Rest: post_request(otp_url, signed_request)
  Rest->>IDA: POST /ida/v1/otp/send
  IDA-->>Rest: response_json
  Rest-->>Auth: response_text
  Auth-->>CLI: response_text
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A rabbit hops through auth flows with glee,
Encrypting requests with crypto's decree,
Docker containers spin up, databases bloom,
OTP validations light up the room!
Local dev freedom—no MOSIP in sight,
Just WireMock stubs making everything right! 🔐

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main objective of the changeset: setting up IDA locally and creating a client for testing it, which aligns with the comprehensive set of local development infrastructure, Docker configuration, Python client implementation, and documentation included in the PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Signed-off-by: Mahammed Taheer <mohd.taheer@gmail.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 15

🧹 Nitpick comments (3)
authentication/local-dev-setup/IDA-sample-client/client/requirements.txt (1)

1-13: ⚡ Quick win

Pin build dependencies for reproducibility.

The setuptools and wheel packages are unpinned while runtime dependencies are pinned to August 2022 versions. Even in sample/development code, pinning these build tools ensures consistent build environments across machines.

setuptools>=65.5.0
wheel>=0.37.0

Consider updating the older pinned packages if used elsewhere, but pinning them here is acceptable for a local development sample.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@authentication/local-dev-setup/IDA-sample-client/client/requirements.txt`
around lines 1 - 13, Pin the build dependencies setuptools and wheel in
requirements.txt by replacing the unpinned entries "setuptools" and "wheel" with
the suggested pinned versions (e.g., "setuptools>=65.5.0" and "wheel>=0.37.0")
so they are versioned consistently alongside the other packages; update the
lines for setuptools and wheel in the provided requirements list accordingly.
authentication/local-dev-setup/docker-compose/combined_202604241713.sql (1)

1-369: ⚡ Quick win

Seed data is duplicated with init.sql; keep one source of truth.

Maintaining the same dataset in two files will drift quickly and cause hard-to-debug local mismatches.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@authentication/local-dev-setup/docker-compose/combined_202604241713.sql`
around lines 1 - 369, Duplicate seed rows exist in this combined SQL dump (e.g.,
inserts into ida.api_key_data with api_key_id '198833', ida.partner_data with
partner_id 'auth_v1z0816154432', ida.policy_data with policy_id '98190',
ida.key_alias entries, etc.) and are also present in the primary init seed; keep
only one source of truth by removing the duplicated INSERT blocks from this
combined_202604241713.sql file (or conversely remove them from init.sql),
ensuring you preserve the canonical seed file (init.sql) and update any
references to api_key_id '198833', partner_id 'auth_v1z0816154432', policy_id
'98190', key_alias ids (e.g., '582b6c75-119e-4291-8e2c-068d40e87cdb') so only a
single insert remains for each entity and run a local migration/seed
verification to confirm no missing rows remain.
authentication/local-dev-setup/docker-compose/docker-compose.yml (1)

14-14: ⚡ Quick win

Pin container image versions instead of latest.

Lines 14 and 37 use mutable tags, making environment behavior inconsistent between runs and across developers. Replace mosipid/config-server:latest with mosipid/config-server:1.1.2 and wiremock/wiremock:latest with wiremock/wiremock:3.13.2 to ensure reproducible local development.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@authentication/local-dev-setup/docker-compose/docker-compose.yml` at line 14,
Replace mutable image tags with pinned versions: change the image reference
"mosipid/config-server:latest" to "mosipid/config-server:1.1.2" and change
"wiremock/wiremock:latest" to "wiremock/wiremock:3.13.2" in the
docker-compose.yml; locate the image keys (the lines containing image:
mosipid/config-server:latest and image: wiremock/wiremock:latest) and update
their tags so local dev runs are reproducible.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@authentication/local-dev-setup/docker-compose/docker-compose.yml`:
- Line 19: Replace the hardcoded host mount "-
/Users/taheer-mos/mosip/mosip-config/mosip-config:/mosip-config" with a portable
binding that uses either a relative path or an environment variable (e.g.
"./mosip-config:/mosip-config" or
"${MOSIP_CONFIG_PATH:-./mosip-config}:/mosip-config") so other developers can
run the compose file without machine-specific paths; update the inline comment
to explain to set MOSIP_CONFIG_PATH if they need a custom absolute path.

In `@authentication/local-dev-setup/docker-compose/init.sql`:
- Around line 973-1138: This seed file contains real private keys/certificates
committed in plaintext; remove the sensitive material from the INSERTs (notably
the INSERT INTO ida.key_store rows and any certificate_data values in INSERT
INTO ida.partner_data and oidc_client_data) and replace them with synthetic,
non-production placeholders or references to local-only secrets (e.g., load from
environment/seed generator at runtime or use clearly labelled dummy values);
ensure the database initialization now uses safe test keys generated at
build/dev time or pulls from a local-only secret provider, and regenerate the
SQL so no real key/cert data remains in version control while preserving the
same table/column structure and IDs used by the rest of the scripts.
- Around line 764-766: The sequences BATCH_STEP_EXECUTION_SEQ,
BATCH_JOB_EXECUTION_SEQ, and BATCH_JOB_SEQ are created without a schema
qualifier which can cause them to be created in the wrong schema; update the
CREATE SEQUENCE statements to prefix each name with the ida schema (e.g.,
ida.BATCH_STEP_EXECUTION_SEQ) and ensure the subsequent GRANT statements
reference the same qualified names (ida.BATCH_*), so creation and grants
consistently target the ida schema and avoid schema drift.

In `@authentication/local-dev-setup/IDA-sample-client/client/__init__.py`:
- Around line 38-39: Replace the bare except that sets config.gunicorn.worker_id
= -1 with explicit exception handling: catch the expected exceptions from the
worker-id resolution logic (e.g., subprocess.CalledProcessError, ValueError,
OSError) and set config.gunicorn.worker_id = -1 inside those handlers, and for
each handler log the exception details (using the module logger or existing
process logger) so failures are visible; if necessary add a small fallback
generic Exception handler that logs the error before re-raising to avoid
swallowing interrupts.
- Around line 45-53: The Dynaconf loader instantiation (config = Dynaconf) must
match the CLI entrypoint contract in client/authenticator/main.py: replace the
settings file 'authenticator/authenticator-config.toml' with
'authenticator/authenticator-config-local.toml' and change envvar_prefix from
"TOKENSEEDER" to "MOSIP" so both entrypoints use the same config filename and
environment variable prefix; update the settings_files list and envvar_prefix in
the config = Dynaconf(...) call accordingly.
- Around line 59-68: init_logger currently unconditionally adds StreamHandler
and FileHandler to the root logger causing duplicate log lines and leaked file
descriptors on repeated calls; modify init_logger to first inspect
logger.handlers (or use logger.hasHandlers()) and either clear existing handlers
or skip adding a handler when an equivalent handler already exists (match by
handler class and, for FileHandler, by baseFilename against
config.logging.log_file_name), then set level and add only the needed handlers
(StreamHandler for sys.stdout and FileHandler for config.logging.log_file_name)
with the formatter; ensure you still set the formatter and level on the existing
handlers if reusing them.

In
`@authentication/local-dev-setup/IDA-sample-client/client/authenticator/authenticator-config-local.toml`:
- Around line 8-10: The config file contains committed plaintext secrets
(partner_misp_lk and sign_p12_file_password) and should be replaced with
non-secret placeholders and moved to secret injection; remove the actual values
for partner_misp_lk and any sign_p12_file_password entries in
authenticator-config-local.toml and replace them with placeholder strings (e.g.,
"<REDACTED>") while leaving non-secret keys like partner_apikey and partner_id
as examples, then update the authenticator config loader (where it reads
partner_misp_lk/sign_p12_file_password) to read these values from environment
variables (e.g., process.env.PARTNER_MISP_LK / SIGN_P12_FILE_PASSWORD) or your
secret manager and document the required env vars in the repo README.

In
`@authentication/local-dev-setup/IDA-sample-client/client/authenticator/authenticator.py`:
- Around line 47-64: The current implementation stores a single mutable
MOSIPAuthRequest instance on self (self.auth_request) which is mutated across
flows; change to create a fresh local auth_request for each public request
method by adding a helper like _new_auth_request() that returns a new
MOSIPAuthRequest initialized with the same base fields (id, version, env,
domainUri, specVersion, consentObtained, metadata, thumbprint, etc.), then
inside each public method replace uses of self.auth_request with a local
variable auth_request and only mutate that local object; ensure no other methods
mutate self.auth_request and remove or stop using the shared instance to prevent
concurrent/interleaved call corruption.
- Around line 79-81: do_auth currently mutates its caller's dict by calling
auth_req_data.pop('vid'); change it to avoid side effects by reading vid without
modifying the original (e.g. use vid = auth_req_data.get('vid') or make a
shallow copy first like data = dict(auth_req_data); vid = data.pop('vid')), and
then use the local copy (data) or the original read-only value for the rest of
the method; update references in do_auth to use the chosen local variable
instead of relying on the mutated auth_req_data.

In
`@authentication/local-dev-setup/IDA-sample-client/client/authenticator/cli_options.py`:
- Around line 43-46: The loop over errors should guard against non-dict entries:
in the for error in errors loop check isinstance(error, dict) before calling
error.get; if it is a dict extract error_code = error.get("errorCode") and
error_message = error.get("errorMessage") as before, otherwise render the raw
entry (e.g., print a fallback like "- error: {error!r}") so malformed or string
entries do not raise an exception and the response remains visible; update the
print logic inside the loop that sets error_code/error_message and the fallback
print for non-dict cases.

In
`@authentication/local-dev-setup/IDA-sample-client/client/authenticator/utils/cryptoutil.py`:
- Around line 145-147: The x5c header is being built from PEM bytes which
violates RFC 7515 (it must be base64-encoded DER); in the code that constructs
the protected header (the json.dumps call that uses
self.sign_cert.public_bytes(...)), change the certificate encoding from
serialization.Encoding.PEM to serialization.Encoding.DER so you base64-encode
the raw DER bytes for 'x5c' (leave the base64.b64encode(...).decode('UTF-8')
logic intact and keep the 'x5c' array structure).

In
`@authentication/local-dev-setup/IDA-sample-client/client/authenticator/utils/restutil.py`:
- Around line 15-16: The methods get_request and post_request currently use
mutable default arguments (headers={}, additional_headers={}) and mutate
instance state by calling self.request_headers.update(...), causing header
leakage across requests; change those parameter defaults to None, create a fresh
headers dict each call (e.g., base = dict(self.request_headers) or
dict(self.request_headers or {}) ) and merge in any provided
headers/additional_headers into that new dict (without calling update on
self.request_headers), and use the new merged dict for the request so the
instance's self.request_headers remains unchanged.

In `@authentication/local-dev-setup/LOCAL-DEV-SETUP.md`:
- Line 279: The heading "### 6.3 Update `bootstrap.properties`" is misnumbered;
change it to "### 6.2 Update `bootstrap.properties`" and adjust subsequent
section numbers accordingly so the sequence continues correctly (e.g.,
increment/decrement headings after this point to restore a consistent 6.2 → 6.3
→ ... flow); locate the heading by the exact text "Update
`bootstrap.properties`" to apply the edit.

In `@authentication/local-dev-setup/prepare-biosdk-mock-lib.bat`:
- Around line 30-35: The curl invocation in prepare-biosdk-mock-lib.bat using
"%JAR_URL%" should include the --fail (or -f) flag so HTTP errors produce a
non-zero exit code; update the curl command that writes to
"%TEMP_DIR%\%JAR_NAME%" to add --fail (keep existing -L and --progress-bar) so
the subsequent %ERRORLEVEL% check correctly detects HTTP 4xx/5xx failures and
triggers the error/cleanup path.

In `@authentication/local-dev-setup/prepare-biosdk-mock-lib.sh`:
- Line 44: The curl invocation that downloads the JAR (the command using
JAR_URL, TEMP_DIR and JAR_NAME) doesn't fail on HTTP errors; update that curl
command to include the -f flag (e.g., curl -f -L --progress-bar ...) so HTTP
4xx/5xx responses cause a non‑zero exit and the script aborts; keep existing
retry logic (--retry, etc.) and write the output to "$TEMP_DIR/$JAR_NAME" as
before.

---

Nitpick comments:
In `@authentication/local-dev-setup/docker-compose/combined_202604241713.sql`:
- Around line 1-369: Duplicate seed rows exist in this combined SQL dump (e.g.,
inserts into ida.api_key_data with api_key_id '198833', ida.partner_data with
partner_id 'auth_v1z0816154432', ida.policy_data with policy_id '98190',
ida.key_alias entries, etc.) and are also present in the primary init seed; keep
only one source of truth by removing the duplicated INSERT blocks from this
combined_202604241713.sql file (or conversely remove them from init.sql),
ensuring you preserve the canonical seed file (init.sql) and update any
references to api_key_id '198833', partner_id 'auth_v1z0816154432', policy_id
'98190', key_alias ids (e.g., '582b6c75-119e-4291-8e2c-068d40e87cdb') so only a
single insert remains for each entity and run a local migration/seed
verification to confirm no missing rows remain.

In `@authentication/local-dev-setup/docker-compose/docker-compose.yml`:
- Line 14: Replace mutable image tags with pinned versions: change the image
reference "mosipid/config-server:latest" to "mosipid/config-server:1.1.2" and
change "wiremock/wiremock:latest" to "wiremock/wiremock:3.13.2" in the
docker-compose.yml; locate the image keys (the lines containing image:
mosipid/config-server:latest and image: wiremock/wiremock:latest) and update
their tags so local dev runs are reproducible.

In `@authentication/local-dev-setup/IDA-sample-client/client/requirements.txt`:
- Around line 1-13: Pin the build dependencies setuptools and wheel in
requirements.txt by replacing the unpinned entries "setuptools" and "wheel" with
the suggested pinned versions (e.g., "setuptools>=65.5.0" and "wheel>=0.37.0")
so they are versioned consistently alongside the other packages; update the
lines for setuptools and wheel in the provided requirements list accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6141dcf2-c8d5-41a7-9db0-b8ce15bbb785

📥 Commits

Reviewing files that changed from the base of the PR and between 6189562 and 5f40549.

📒 Files selected for processing (29)
  • authentication/local-dev-setup/IDA-sample-client/client/__init__.py
  • authentication/local-dev-setup/IDA-sample-client/client/authenticator/__init__.py
  • authentication/local-dev-setup/IDA-sample-client/client/authenticator/authenticator-config-local.toml
  • authentication/local-dev-setup/IDA-sample-client/client/authenticator/authenticator.py
  • authentication/local-dev-setup/IDA-sample-client/client/authenticator/cli_options.py
  • authentication/local-dev-setup/IDA-sample-client/client/authenticator/exceptions/__init__.py
  • authentication/local-dev-setup/IDA-sample-client/client/authenticator/exceptions/authenticator_exception.py
  • authentication/local-dev-setup/IDA-sample-client/client/authenticator/main.py
  • authentication/local-dev-setup/IDA-sample-client/client/authenticator/model/__init__.py
  • authentication/local-dev-setup/IDA-sample-client/client/authenticator/model/auth_request.py
  • authentication/local-dev-setup/IDA-sample-client/client/authenticator/utils/__init__.py
  • authentication/local-dev-setup/IDA-sample-client/client/authenticator/utils/cryptoutil.py
  • authentication/local-dev-setup/IDA-sample-client/client/authenticator/utils/restutil.py
  • authentication/local-dev-setup/IDA-sample-client/client/requirements.txt
  • authentication/local-dev-setup/IDA-sample-client/new-keys/ida-partner-local.cer
  • authentication/local-dev-setup/IDA-sample-client/new-keys/partner-mosip-signed.p12
  • authentication/local-dev-setup/IDA-sample-client/samples/auth-req-01.json
  • authentication/local-dev-setup/LOCAL-DEV-SETUP.md
  • authentication/local-dev-setup/docker-compose/combined_202604241713.sql
  • authentication/local-dev-setup/docker-compose/docker-compose.yml
  • authentication/local-dev-setup/docker-compose/init.sql
  • authentication/local-dev-setup/docker-compose/wiremock/__files/EMPTY-FILE
  • authentication/local-dev-setup/docker-compose/wiremock/mappings/master-data.json
  • authentication/local-dev-setup/mosip-ida-ks.p12
  • authentication/local-dev-setup/partner-chain.p12
  • authentication/local-dev-setup/partner-mosip-signed.p12
  • authentication/local-dev-setup/prepare-biosdk-mock-lib.bat
  • authentication/local-dev-setup/prepare-biosdk-mock-lib.sh
  • authentication/local-dev-setup/setup-test-report.html

Signed-off-by: Mahammed Taheer <mohd.taheer@gmail.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
authentication/local-dev-setup/IDA-sample-client/client/__init__.py (1)

47-47: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Config filename mismatch with entrypoint.

Line 47 references authenticator-config.toml, but according to the review stack context and the CLI entrypoint in main.py, the expected filename is authenticator-config-local.toml. This mismatch will cause different configuration to be loaded when using the CLI entrypoint versus when using this init path.

📝 Proposed fix
         settings_files=[
-            os.path.join(os.path.dirname(__file__),'authenticator','authenticator-config.toml'),
+            os.path.join(os.path.dirname(__file__),'authenticator','authenticator-config-local.toml'),
             os.path.join(os.path.dirname(__file__),'config.toml'),
             "config.toml",
             "/app/auth_config.conf",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@authentication/local-dev-setup/IDA-sample-client/client/__init__.py` at line
47, The config filename in the package initializer is incorrect: update the
hardcoded path in __init__.py that currently joins
'authenticator','authenticator-config.toml' to use
'authenticator-config-local.toml' so it matches the CLI entrypoint in main.py;
locate the os.path.join call in __init__.py and replace the filename string to
ensure both entrypoints load the same configuration.
🧹 Nitpick comments (1)
authentication/local-dev-setup/IDA-sample-client/client/authenticator/main.py (1)

14-17: ⚡ Quick win

Add basic error handling for missing configuration.

The script accesses config.mosip_auth_server.ida_auth_url without error handling. If the configuration file is missing or lacks this key, Dynaconf will raise AttributeError, causing the script to crash immediately without a helpful message.

For local dev/test usage, add basic error handling to provide clearer feedback:

🛡️ Suggested error handling
 if __name__ == "__main__":
-    print(f"Configured IDA URL: {config.mosip_auth_server.ida_auth_url}")
-    mosip_authenticator = MOSIPAuthenticator(config)
-    run_cli(mosip_authenticator)
+    try:
+        print(f"Configured IDA URL: {config.mosip_auth_server.ida_auth_url}")
+        mosip_authenticator = MOSIPAuthenticator(config)
+        run_cli(mosip_authenticator)
+    except AttributeError as e:
+        print(f"Configuration error: Missing required config key. Please check authenticator-config-local.toml. ({e})")
+    except Exception as e:
+        print(f"Error: {e}")

Based on learnings, this adds the "basic error handling to avoid crashing local runs" without requiring production-level exception handling.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@authentication/local-dev-setup/IDA-sample-client/client/authenticator/main.py`
around lines 14 - 17, The main block directly accesses
config.mosip_auth_server.ida_auth_url which can raise AttributeError if Dynaconf
config or the mosip_auth_server key is missing; wrap the access in a try/except
(catch AttributeError and possibly KeyError) around the print and
MOSIPAuthenticator(config)/run_cli calls to detect missing configuration, log or
print a clear error message such as "Missing configuration:
mosip_auth_server.ida_auth_url" and exit gracefully (non-zero), and only
instantiate MOSIPAuthenticator and call run_cli if the required key is present.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@authentication/local-dev-setup/LOCAL-DEV-SETUP.md`:
- Around line 528-537: Update the "Local Services Reference" table under the
"Local Services Reference" section to include the missing Authentication service
entry; add a new row alongside the OTP service that names "Authentication
Service" and lists its URL as http://localhost:8090 (or include the base path
used in local testing), so the table explicitly references the auth service and
port 8090 for developers verifying local setup and testing.

---

Duplicate comments:
In `@authentication/local-dev-setup/IDA-sample-client/client/__init__.py`:
- Line 47: The config filename in the package initializer is incorrect: update
the hardcoded path in __init__.py that currently joins
'authenticator','authenticator-config.toml' to use
'authenticator-config-local.toml' so it matches the CLI entrypoint in main.py;
locate the os.path.join call in __init__.py and replace the filename string to
ensure both entrypoints load the same configuration.

---

Nitpick comments:
In
`@authentication/local-dev-setup/IDA-sample-client/client/authenticator/main.py`:
- Around line 14-17: The main block directly accesses
config.mosip_auth_server.ida_auth_url which can raise AttributeError if Dynaconf
config or the mosip_auth_server key is missing; wrap the access in a try/except
(catch AttributeError and possibly KeyError) around the print and
MOSIPAuthenticator(config)/run_cli calls to detect missing configuration, log or
print a clear error message such as "Missing configuration:
mosip_auth_server.ida_auth_url" and exit gracefully (non-zero), and only
instantiate MOSIPAuthenticator and call run_cli if the required key is present.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 110747eb-9797-47cd-8485-706f60aab170

📥 Commits

Reviewing files that changed from the base of the PR and between 5f40549 and ea58643.

📒 Files selected for processing (4)
  • authentication/local-dev-setup/IDA-sample-client/client/__init__.py
  • authentication/local-dev-setup/IDA-sample-client/client/authenticator/main.py
  • authentication/local-dev-setup/LOCAL-DEV-SETUP.md
  • authentication/local-dev-setup/docker-compose/docker-compose.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • authentication/local-dev-setup/docker-compose/docker-compose.yml

Comment on lines +528 to +537
## Local Services Reference

| Service | URL |
|---------|-----|
| Config Server | `http://localhost:51000/config` |
| WireMock (mock APIs) | `http://localhost:8082` |
| BioSDK Service | `http://localhost:8083` |
| PostgreSQL | `localhost:5455` |
| OTP Service | `http://localhost:8092/idauthentication/v1/otp` |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Auth service URL missing from reference table.

The reference table lists the OTP service but omits the Authentication service, which runs on port 8090 and is equally important for users to reference during testing.

📝 Proposed fix
 | Service | URL |
 |---------|-----|
+| Authentication Service | `http://localhost:8090/idauthentication/v1` |
 | Config Server | `http://localhost:51000/config` |
 | WireMock (mock APIs) | `http://localhost:8082` |
 | BioSDK Service | `http://localhost:8083` |
 | PostgreSQL | `localhost:5455` |
 | OTP Service | `http://localhost:8092/idauthentication/v1/otp` |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@authentication/local-dev-setup/LOCAL-DEV-SETUP.md` around lines 528 - 537,
Update the "Local Services Reference" table under the "Local Services Reference"
section to include the missing Authentication service entry; add a new row
alongside the OTP service that names "Authentication Service" and lists its URL
as http://localhost:8090 (or include the base path used in local testing), so
the table explicitly references the auth service and port 8090 for developers
verifying local setup and testing.

@ckm007
ckm007 merged commit 78d0610 into mosip:develop May 18, 2026
41 of 44 checks passed
@ckm007

ckm007 commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

🔗 Linked PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants