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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nyby/scimmy-routers

v1.2.3

Published

SCIMMY Express Routers

Downloads

11

Readme

SCIMMY Express Routers

Provides a set of express routers that implement the application-level HTTP-based SCIM 2.0 protocol (RFC7644), which is designed to simplify resource provisioning and identity management in cloud-based applications and services.
The routers leverage work done in the SCIMMY package, which provides a set of tools that can be used to parse incoming, and format outgoing data according to the SCIM 2.0 protocol.

Requirements

Installation and Usage

Through NPM:

$ npm install scimmy-routers

In your code:

import express from "express";
import SCIMMY from "scimmy";
import SCIMMYRouters from "scimmy-routers";

// Create a new express app
let app = express();

// Declare resource types to SCIMMY package (see SCIMMY documentation for more details)
SCIMMY.Resources.declare(SCIMMY.Resources.User, {/* Your handlers for user resource type */});
SCIMMY.Resources.declare(SCIMMY.Resources.Group, {/* Your handlers for group resource type */});

// Instantiate SCIMMYRouters as new middleware for express
app.use("/scim", new SCIMMYRouters({
    type: "bearer",
    docUri: "https://example.com/help/oauth.html",
    // Your handler for verifying authentication status of a request
    handler: (request) => {
        if (!request.header("Authorization")?.startsWith("Bearer ")) {
            throw new Error("Authorization not detected!");
        } else {
            return "some-user-ID";
        }
    },
    // Optionally, some method to provide additional context to requests...
    context: (request) => {
        // ...in this case, the URL params from the express request 
        return request.params;
    }
}));

API

SCIMMY Express Routers provides a constructable middleware class which extends the Express Router class.
It can be used at any level of an Express app, as with any other middleware, however it is recommended that you include the path /scim somewhere in your mountpath.

The SCIMMYRouters constructor accepts a single configuration object argument which defines how authentication will be handled in the middleware. The properties of that object are:

  • type - required string specifying SCIM service provider authentication scheme type.

    • Currently supported values are "oauth", "bearer", "basic", and "digest", which respectively map to authenticationScheme types of "oauth2", "oauthbearertoken", "httpbasic", and "httpdigest".
  • handler - required function specifying the method to invoke to authenticate SCIM requests to this middleware.

    • If a request is not authenticated, the function should throw a new Error with a brief message to be passed back by the response.
    • If a specific user is authenticated, the function should return the ID string of the authenticated user.
  • context - optional function specifying the method to invoke to provide additional context to SCIM requests.

    • Evaluated for each request, it can return anything, with the returned value passed directly to the ingress/egress/degress handler methods.
  • docUri - optional string specifying the URL to use as the documentation URI for the service provider authentication scheme.