accredifysg/singpass-login
Laravel package for SingPass Login, MyInfo, and CorpPass using FAPI 2.0-style auth: OpenID discovery, Pushed Authorization Requests (PAR) with DPoP, PKCE, and private-key JWT client assertions. Includes shared services and thin provider controllers.
vendor:publish simplify setup.NDI_PRIVATE_JWKS (private key for JWT assertions). Misconfiguration could lead to token forgery or revocation issues.state parameter). Session storage must be persistent and secure (e.g., Redis for distributed setups).SingPassUser::getNric() is deprecated; migration to sub_attributes.identity_number may require refactoring existing listeners.user.identity) may break actor resolution.NDI_PRIVATE_JWKS be stored securely (e.g., AWS KMS, HashiCorp Vault)?nationality, dob) whitelisted in config/myinfo.php?entity (company) and actor (user) to internal models?NDI_LOGS_ENABLED=false by default, how will debugging be handled in production?Auth facade for session-based login.web middleware (CSRF protection)..env overrides.league/oauth2-server for FAPI 2.0). No heavy frameworks like Symfony.NDI_PRIVATE_JWKS (e.g., encrypted .env or secrets manager).composer require accredifysg/singpass-login
php artisan vendor:publish --provider="Accredifysg\SingPassLogin\SingPassLoginServiceProvider" --tag="config"
.env with SingPass/MyInfo/CorpPass credentials (e.g., SINGPASS_CLIENT_ID, MYINFO_REDIRECT_URI).config/ndi.php.SingPassSuccessfulLoginEvent) to map SingPass/MyInfo/CorpPass data to your user model.Http::fake()).trustedproxy middleware if behind a load balancer.openid, name, email).nationality, dob).NDI_LOGS_ENABLED=true and integrate logs with your monitoring system (e.g., Sentry, Datadog).NDI_PRIVATE_JWKS must be rotated periodically (follow SingPass/MyInfo/CorpPass guidelines). Automate this with a cron job or secrets manager.league/oauth2-server for FAPI 2.0 updates. Test package upgrades in staging.SINGPASS_DISCOVERY_ENDPOINT) may change. Use feature flags or environment-specific configs to manage drift.SingPassUser::getNric()). Plan migrations proactively.NDI_LOGS_ENABLED=true for troubleshooting. Logs include:
throttle middleware for /ndi/jwks or auth endpoints if hit by abuse.// config/ndi.php
'cache_discovery' => true,
'cache_jwks' => true,
MyInfoDataRetrievedEvent/CorpPassDataRetrievedEvent to avoid blocking the auth flow.| Failure Scenario | Impact | Mitigation Strategy |
|---|---|---|
Invalid NDI_PRIVATE_JWKS |
DPoP proofs fail; auth rejected | Validate keys on startup; use secrets manager. |
| Malformed access token | Silent scope assumption failures | Enable strict token validation; log errors. |
| SingPass/MyInfo outage | Auth flow breaks | Retry logic; fallback UI. |
| CSRF state mismatch |
How can I help you explore Laravel packages today?