SAML Authentication library using passport
npm install saml-sso-node- 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.
- .env.example file is provided for variable references please check and create the same.
- Default database: postgres
- For other databases refer below link.
- You have the seed the idps data to database.
> 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:
``js
const data = {
idp: "string",
tenantId: "string",
};
app.get("/auth/login", IDPAuthenticationMW, function (req, res) {
// existing code of authentication...
});
`
- Use the below links to create tenant, register application and to create user flows.
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.
- Login to Okta (developers credentials) and create an application and add required configurations to it and add users to the application.
- '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.
index.ts - use this file to rename the middleware.
- Execute below command to login to npm registry.
`sh`
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.
`sh`
npm run build
- Publish commad.
`sh``
npm publish --access public