npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ums-auth-client

v2.0.1

Published

Plug-and-play UMS authorization SDK for JavaScript and Angular applications.

Readme

UMS Authorization Client Plugin

Production-ready plug-and-play authorization SDK for plain JavaScript and Angular applications.

Install

npm install ums-auth-client

JavaScript Mode

<script src="https://ums-auth.qlotech.com/ums-auth-client.js"></script>
<script>
  // response should come from your backend-authenticated UMS login call
  UMS.init(loginResponse);

  if (UMS.hasPermission('GENERAL', 'CREATE')) {
    console.log('Create allowed');
  }

  if (UMS.hasPermission('GENERAL', 'EDIT').has('ai_access')) {
    console.log('AI feature enabled');
  }
</script>

Angular Mode

import { UmsAuthModule, UmsAuthService } from 'ums-auth-client/angular';

@NgModule({
  imports: [UmsAuthModule]
})
export class AppModule {}
constructor(private readonly ums: UmsAuthService) {}

ngOnInit() {
  this.ums.init(loginResponse);

  if (this.ums.hasPermission('GENERAL', 'CREATE')) {
    // allowed
  }
}
<button *umsCan="'GENERAL.CREATE'">Create</button>
<div *umsCan="'GENERAL.EDIT'; attr: 'ai_access'">AI Feature</div>
<div *umsCan="'GENERAL.EDIT_1'; attr: 'genapi'">GenAPI Feature</div>

SDK API

  • UMS.init(loginResponse)
  • UMS.hasPermission(moduleName, permissionCode)
  • UMS.hasPermission(moduleName, permissionCode).has(attributeName)
  • UMS.getUser()
  • UMS.getModules()
  • UMS.getPermissionMap()
  • UMS.getTenantContext()
  • UMS.reset()

UMS Login API Format

POST /ums/api/v1/auth/login
Content-Type: application/json
X-CLIENT-ID: <client-id>
X-CLIENT-SECRET: <client-secret>
X-CLIENT-CERT: <client-cert>

{
  "userId": "user1"
}

Example curl:

curl --request POST 'http://localhost:8080/ums/api/v1/auth/login' \
  --header 'Content-Type: application/json' \
  --header 'X-CLIENT-ID: client_xxxxx' \
  --header 'X-CLIENT-SECRET: secret_xxxxx' \
  --header 'X-CLIENT-CERT: certificate_value' \
  --data '{"userId":"user1"}'

After authentication, initialize once:

UMS.init(loginResponseFromBackend);

Permission Map Generated Internally

The SDK builds an indexed permission map from authorization.modules.

{
  GENERAL: {
    CREATE: {
      allowed: true,
      attributes: {}
    },
    EDIT: {
      allowed: true,
      attributes: {
        ai_access: true
      }
    },
    EDIT_1: {
      allowed: true,
      attributes: {
        genapi: true
      }
    }
  }
}

Behavior

  • Missing permission returns false
  • Existing permission with allowed=false returns false
  • Existing and allowed permission returns a grant object with .has(attributeName)

Usage examples:

UMS.hasPermission('GENERAL', 'CREATE');
UMS.hasPermission('GENERAL', 'EDIT').has('ai_access');
UMS.hasPermission('GENERAL', 'EDIT_1').has('genapi');

Security Guidance

Never expose X-CLIENT-SECRET or X-CLIENT-CERT in frontend code.

Recommended flow:

  1. Frontend calls your application backend login endpoint.
  2. Backend injects UMS client credentials securely.
  3. Backend calls UMS login API.
  4. Backend returns login response to frontend.
  5. Frontend calls UMS.init(response).

Multi-Tenant Support

The SDK preserves user context from login response (organizationId, applicationId, activeRole) via UMS.getTenantContext() and supports role-based and attribute-based checks.