Skip to content

passport-saml CacheProvider implementation using Redis as the distributed store

License

Notifications You must be signed in to change notification settings

mkralla11/passport-saml-cache-redis

Repository files navigation

passport-saml-cache-redis

CI

A redis-backed cache provider for passport-saml.

Usage

$ npm install passport-saml-cache-redis

Use the

import { Strategy as SamlStrategy } from 'passport-saml'
import redisCacheProvider from 'redis-saml-cache-redis'

const Redis = require('ioredis')

// create a redis instance
const redisClient = Redis.createClient({
  host,
  port,
  password,
})

passport.use(
  new SamlStrategy({
    //... other passport-saml options,
    cacheProvider: redisCacheProvider(redis), // provide the redis instance
  })
)

Configuration

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

redisCacheProvider(pool, {
  // The maximum age of a cache entry in milliseconds. Uses redis's TTL implementation under the hood.
  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

About

passport-saml CacheProvider implementation using Redis as the distributed store

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published