Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@rss/common-nodejs

Package Overview
Dependencies
Maintainers
0
Versions
229
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rss/common-nodejs

RSS shared Node.js library

  • 1.7.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

@rss/common-nodejs

RSS shared Node.js library for cross cutting concerns.

  • axios http helper
  • env and secrets loading
  • mongo connection
  • redis/in-memory cacher
  • logger and express logging and error middleware
  • openid client
  • openid helper
  • openid strategy
  • passport authentication strategy
  • start child process
  • shared services like relationships, workflow, etc.

Installation

$ npm install @rss/common-nodejs

Auth

OpenId Client

openIdClient must be initialized before calling any other rss apps.

const { env, secret, openIdClient } = require('@rss/common-nodejs');
await openIdClient.init(env.OPENID_URL, { client_id: secret.CLIENT_ID, client_secret: secret.CLIENT_SECRET });
const accessToken = await openIdClient.accessToken();
Passport Auth Strategy

The RSS authentication strategy authenticates users using a token passed in on the Authorization request header. The strategy requires a verify callback, which accepts a valid decoded token and calls done providing a user.

passport.use(
  openIdStrategy(env.OPENID_URL, (red, claim, done) => {
    done(null, claim);
  }),
);
Authenticate Requests

Use passport.authenticate(), specifying the 'jwt' strategy, to authenticate requests.

app.use(passport.authenticate('jwt', { session: false }));
app.use('/api/sample', authz(['SCOPE']), require('./sample.routes'));
Token Types

This strategy takes an hash value with the following options

  • session - Options, save user to session - should be set to false

FAQs

Package last updated on 19 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc