UNPKG

stulz-sso-node-sdk-pub

Version:

<p align="center"> <img alt="STULZ Logo" height="100" src="https://www.stulz.com/typo3conf/ext/siteskin/Resources/Public/Images/Logos/logo.svg" title="STULZ-INDIA"/> </p>

71 lines (49 loc) 2.17 kB
#### <p align="center"> <img alt="STULZ Logo" height="100" src="https://www.stulz.com/typo3conf/ext/siteskin/Resources/Public/Images/Logos/logo.svg" title="STULZ-INDIA"/> </p> # STULZ-INDIA SSO Node SDK A lightweight Node.js SDK for integrating STULZ-INDIA's Single Sign-On (SSO) service. Easily plug in secure authentication and permission management into any backend service. --- ## ✨ Features - Encrypt and decrypt payloads using AES - Register and authenticate users securely - Validate login state - Retrieve user and permission details --- ## 📦 Installation ```bash npm install stulz-sso-node-sdk-pub ``` ## Usage ### Import the Module Import the `StulzAuthNodeSdk` in your Node application's server file and configure it with your STULZ SSO settings: ```javascript import { StulzAuthNodeSdk } from 'stulz-sso-node-sdk-pub'; const stulzSSO = new StulzAuthNodeSdk({ serverUrl: 'https://your-stulz-sso-server.com', clientId: 'your-client-id', clientSecret:'your-client-secrate', redirectionUrl: 'https://your-app.com/redirect', postLogoutRedirection: 'https://your-app.com/logout-redirect', scope: ['openid', 'profile', 'email'] }); export default stulzSSO; ``` ### Use the SDK Service ```javascript import sso from './ssoInstance'; const isLoggedIn = await sso.isLoggedIn(sessionId); const userInfo = await sso.getUserInfo(userId); const roles = await sso.getUserRole(userId); ``` ## Configuration Options | Option | Type | Description | | ----------------------- | ---------- | ------------------------------------------- | | `serverUrl` | `string` | Base URL of the STULZ SSO server | | `clientId` | `string` | Client identifier registered with STULZ SSO | | `redirectionUrl` | `string` | URL to redirect after successful login | | `postLogoutRedirection` | `string` | URL to redirect after logout | | `scope` | `string[]` | Array of scopes for authentication | | `clientSecret` | `string` | Client secrete registered with STULZ SSO |