Coder Social home page Coder Social logo

cflee / mockpass Goto Github PK

View Code? Open in Web Editor NEW

This project forked from opengovsg/mockpass

0.0 1.0 1.0 6.41 MB

A mock SingPass/CorpPass/MyInfo server for dev purposes

Home Page: https://blog.data.gov.sg/mockpass-a-mock-singpass-corppass-server-for-testing-in-development-a583193c898c

License: MIT License

Shell 0.08% JavaScript 41.41% CSS 45.76% HTML 12.71% Dockerfile 0.05%

mockpass's Introduction

MockPass

Gitpod Ready-to-Code

A mock SingPass/CorpPass/MyInfo server for dev purposes

Quick Start (hosted by Gitpod)

  • Click the ready-to-code badge above
  • Wait for MockPass to start
  • Make port 5156 public
  • Open Browser to note the URL hosting MockPass
  • Configure your application per local machine quick start, changing the localhost:5156 to the Gitpod hostname

Quick Start (on local machine)

Configure your application to point to the following endpoints:

SingPass (v1 - Singpass OIDC):

SingPass (v2 - NDI OIDC):

CorpPass (v1 - Corppass OIDC):

CorpPass (v2 - Corppass OIDC):

MyInfo:

sgID:

Provide your application with the spcp* certs found in static/certs and with application certs at static/certs/{key.pem|server.crt}

Alternatively, provide the paths to your app cert as env vars SERVICE_PROVIDER_CERT_PATH and SERVICE_PROVIDER_PUB_KEY

If you are integrating with Singpass NDI OIDC and/or Corppass v2 OIDC, you should provide your well-known key endpoints as env vars SP_RP_JWKS_ENDPOINT and/or CP_RP_JWKS_ENDPOINT respectively. Alternatively, provide your application with the oidc-v2-rp-*.json JWKS.

$ npm install @opengovsg/mockpass

# All values shown here are defaults
$ export MOCKPASS_PORT=5156

$ export SHOW_LOGIN_PAGE=true # Optional, defaults to `false`; can be overridden per request using `X-Show-Login-Page` HTTP header

# Configure which profile to return when login page is disabled
# Can be overridden per request using `X-Custom-NRIC`/`X-Custom-UUID`/`X-Custom-UEN` HTTP headers
$ export MOCKPASS_NRIC=S8979373D # Optional, defaults to first profile

# Disable signing/encryption (Optional, by default `true`)
$ export SIGN_ASSERTION=false
$ export ENCRYPT_ASSERTION=false
$ export SIGN_RESPONSE=false
$ export RESOLVE_ARTIFACT_REQUEST_SIGNED=false

# Encrypt payloads returned by /myinfo/v3/{person, person-basic},
# equivalent to MyInfo Auth Level L2 (testing and production)
$ export ENCRYPT_MYINFO=false

# If specified, will verify token provided in Authorization header
# for requests to /myinfo/*/token
$ export SERVICE_PROVIDER_MYINFO_SECRET=<your secret here>

$ npx mockpass
MockPass listening on 5156

Background

There currently is nothing widely available to test an application's integration with SingPass/CorpPass using a dev machine alone. This is awkward for developers who then need to connect to the staging servers hosted by SingPass/CorpPass, which may not always be available (eg, down for maintenance, or no Internet).

MockPass tries to solves this by providing an extremely lightweight implementation of an OIDC Provider that returns mock SingPass and CorpPass assertions. It optionally provides a mock login page that (badly) mimics the SingPass/CorpPass login experience.

Contributing

We welcome contributions to code open-sourced by the Government Technology Agency of Singapore. All contributors will be asked to sign a Contributor License Agreement (CLA) in order to ensure that everybody is free to use their contributions.

mockpass's People

Contributors

amandalim857 avatar causztic avatar cflee avatar christopherlim98 avatar dependabot[bot] avatar deskoh avatar justin-tay avatar justynoh avatar kenjin-work avatar kevinjom avatar lonerifle avatar mantariksh avatar murugaratham avatar prawiragenestonlia avatar pregnantboy avatar randname avatar renovate-bot avatar renovate[bot] avatar sergey-shambir avatar tangzhenzh avatar victoria281 avatar whipermr5 avatar yahuio avatar yong-jie avatar

Watchers

 avatar

Forkers

jamos-tay

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.