@daysmart/sso
v1.1.0
Published
This repo contains the code for `@daysmart/sso`, an npm package for using DaySmart SSO
Downloads
21
Maintainers
Keywords
Readme
DaySmart SSO npm package
This repo contains the code for @daysmart/sso
, an npm package for using DaySmart SSO
Usage
This package exposes two methods:
openPopup(options?: SSOOptions): Promise<SSOResponse>
- This method opens a popup window for the user to log in via DaySmart SSO. On valid authenication, it returns a promise containing a status string, a tokens object, and an error message if something failed, and by default saves the tokens into cookies on the current domain. The options parameter can be used to further control behavior.
openIFrame(targetElementId: string, options?: SSOOptions): Promise<SSOResponse>
- This method embeds an iframe into the target element that allows the user to login via DaySmart SSO. On valid authenication, it returns a promise containing a status string, a tokens object, and an error message if something failed, and by default saves the tokens into cookies on the current domain. The options parameter can be used to further control behavior.
interface SSOOptions {
/** Automatically save tokens in both the SSO and client sites. Default true. */
saveTokens?: boolean;
/** Run in temporary mode, which will not read any existing tokens (forcing the user to log in) and will not save the tokens. Default false. */
isTemporary?: boolean;
/** Optionally provide the Url of the SSO page. A default url will be used if omitted. */
ssoUrl?: string;
/** Prompt the user to use existing tokens instead of automatically using them. Default false. */
promptForExistingTokens?: boolean;
/** Force the SSO page to remove any existing tokens automatically. Default false. */
removeExistingTokens?: boolean;
}
Development
git pull
npm i
npm run dev
- serve testing page and watch for changes
npm run build
- build package
npm run test
- run unit tests
Publishing
TODO: This should be automated, via a commit message trigger or similar, to update package version and publish
Before publishing, make sure to run npm run build
to ensure the latest build artifacts are being committed/published. Then if not already, log into the cli with npm login
. Be sure to use credentials that have access to the @daysmart
org.
The NPM registry doesn't allow overwriting an existing version of the package, so we need to update the package version following SemVer practices.
Given version scheme MAJOR
.MINOR
.PATCH
:
- for incompatible API changes, run
npm version major
- for new (but backwards-compatible) functionality, run
npm version minor
- for backwards-compatible bug fixes, run
npm version patch
Each of the above npm version
commands will automatically create a commit and tag with the new package version. npm publish
to publish the built library to NPM. Don't forget to push that new version commit.