passport-saml-cache-mongo
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

passport-saml-cache-mongo

CI

A mongo-backed cache provider for passport-saml.

Usage

$ npm install passport-saml-cache-mongo

Use the

import { Strategy as SamlStrategy } from 'passport-saml'
import mongoCacheProvider from 'passport-saml-cache-mongo'

// First, you must create a mongo connection with mongoose/mongodb
const cacheProvider = mongoCacheProvider(mongoClient, { collectionName: 'SamlSsoAttempts', tlMillis: 600000 })

// MAKE SURE YOU CALL THE SETUP FUNCTION!!!!
await cacheProvider.setup()

// ...and finally pass the mongoClient instance to mongoCacheProvider
passport.use(
  new SamlStrategy({
    //... other passport-saml options,
    cacheProvider,
  })
)

Configuration

The mongoCacheProvider function accepts an optional second argument. The default options are as follows:

mongoCacheProvider(mongoClient, {
  // The maximum age of a cache entry in milliseconds.
  ttlMillis: 600000, // 10 minutes,
  // A logger to use. By default, messages are logged to console.
  // The logger should support at least `logger.info()` and `logger.error()` methods.
  logger: console,
})

License

See LICENSE file

Readme

Keywords

none

Package Sidebar

Install

npm i passport-saml-cache-mongo

Weekly Downloads

476

Version

0.0.2

License

GPL

Unpacked Size

13.5 kB

Total Files

7

Last publish

Collaborators

  • mkralla11