4.0.0 • Published 3 months ago

passport-saml-cache-postgres v4.0.0

Weekly downloads
49
License
EUPL-1.1
Repository
github
Last release
3 months ago

passport-saml-cache-postgres

CI

A PostgreSQL-backed cache provider for @node-saml/passport-saml.

Usage

$ npm install passport-saml-cache-postgres

Create a passport_saml_cache table in your database. The default schema can be found in schema.sql.

import { Strategy as SamlStrategy } from '@node-saml/passport-saml'
import postgresCacheProvider from 'passport-saml-cache-postgres'

passport.use(new SamlStrategy({
    ... other passport-saml options,
    cacheProvider: postgresCacheProvider(pool) // A pg.Pool object
}))

Configuration

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

postgresCacheProvider(pool, {
  // The maximum age of a cache entry in milliseconds. Entries older than this are deleted automatically.
  // A scheduled job deletes old cache entries every `ttlMillis` milliseconds.
  ttlMillis: 1000 * 60 * 60, // 1 hour,
  // 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,
})

Closing the cache

The cache can be closed by calling the .close()-method. This stops the scheduled job that periodically clears stale cache entries.

3.0.0

3 months ago

2.0.2

3 months ago

4.0.0

3 months ago

2.0.1

3 months ago

2.0.0

3 months ago

1.0.1

8 months ago

1.0.1-0

8 months ago

1.0.0

4 years ago

0.2.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago