Configuration
AWS Configure
- Local aws cli login is required and the user who's logged in he should have the aws secert manager permission.
Note: AWS_REGION
variable is required in the env file.
Environment
.env.example
file is provided for variable references please check and create the same.
Database
-
Default database: postgres
-
For other databases refer below link.
Sequelize Link
-
You have the seed the idps data to database.
How to use
Middleware IDPAuthenticationMW
is used to authenticate route(s) using Single Sign-On (SSO) of multiple IDP Services.
-
Create IDP Configuration in AWS Secret Manager. (Admin UI can be used to create this)
-
Store the secret_name
in database. (If Admin UI is used, this will be created automatically)
-
Import and include the middleware (IDPAuthenticationMW
) before the controller middleware.
-
Payload is required and can be passed in query params or path params or in the request body.
Example:
const data = {
idp: "string",
tenantId: "string",
};
app.get("/auth/login", IDPAuthenticationMW, function (req, res) {
// existing code of authentication...
});
SSO Configuration
Microsoft
-
Use the below links to create tenant, register application and to create user flows.
Create Tenant
Register Web application
Create User flow
Note: Creating all the above things are mandatory.
-
Custom token generation process should be inside redirect url route.
Eg. 'GET: /callback/uri' route.
Okta
-
Login to Okta (developers credentials) and create an application and add required configurations to it and add users to the application.
Reference Link
-
'POST: /callback/uri' - as mentioned in the okta's official documentation redirect url should be POST method, and returns it will pass the user's information in the response, here we can implement or use the custom token generation process.

Publish as package
index.ts - use this file to rename the middleware.
Steps to publish
-
Execute below command to login to npm registry.
npm login
-
package.json file changes.
-
Update the version
number.
-
Change the private
key as per your requirement. (optional)
-
name
can be changed as per your requirement. (optional)
-
Update/change all the project information in the package.json file.
-
Build the project.
npm run build
-
Publish commad.
npm publish --access public