The SingPass .NET Authentication project is an open-source and cross-platfrom implementation to provide Log in with SingPass authentication in .NET application.
- You'll need to install NodeJS and add the NodeJS executable to the
Path
environment variable. - You'll need to install npm package node-jose in the project folder.
- You'll need to perform SingPass onboarding process, where you will exchange following:
ClientJwks
, share either your app JWKS urls or manually created JWKS. Please note that SingPass prefer EC key type. (Responsibility: You/Application Owner)RedirectUrl
, share one or more redirect urls for SingPass authentication. Default: /signin-singpass. (Responsibility: You/Application Owner)ClientId
, after the onboarding SingPass will provide ClientId. (Responsibility: SingPass)
-
Install Package
Using Package Manager:PM> Install-Package SingPassNetAuth
Using .NET CLI:
> dotnet add-package SingPassNetAuth
-
Add Authentication in the
Startup.cs
public void ConfigureServices(IServiceCollection services) { ...other contents... // Refer to SingPass API documentation - https://stg-id.singpass.gov.sg/docs/authorization/api#_staging_and_production_urls services.AddAuthentication() .AddSingPass(options => { options.Authority = ""; options.ClientId = ""; options.ClientJwks = ""; }) ...other contents... }
- .NET Standard 2.0
- .NET Core 3.1
- .NET 5.0
- Windows
- Linux
Need help or wanna share your thoughts? Don't hesitate to create issue, or pull request.
This project is licensed under the MIT License.