# passport-saml-cache-postgres

> A PostgreSQL-backed cache provider for passport-saml

Latest version **4.0.0** (published 2024-02-16) · EUPL-1.1 license · 0 weekly downloads

## Install

```sh
npm install passport-saml-cache-postgres
pnpm add passport-saml-cache-postgres
yarn add passport-saml-cache-postgres
bun add passport-saml-cache-postgres
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2024-02-16 |
| First published | 2020-09-30 |
| Weekly downloads | 0 |
| License | EUPL-1.1 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >= 8 |
| Dependencies | 2 |
| Unpacked size | 9.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Matriculation Examination Board, Finland |
| Maintainers | digabi |

## Links

- npm: https://www.npmjs.com/package/passport-saml-cache-postgres
- Repository: https://github.com/digabi/passport-saml-cache-postgres
- Homepage: https://github.com/digabi/passport-saml-cache-postgres#readme
- Issues: https://github.com/digabi/passport-saml-cache-postgres/issues
- npm.io page: https://npm.io/package/passport-saml-cache-postgres

## Dependencies (2)

- [@types/pg](https://npm.io/package/@types/pg.md) ^8.6.1
- [@node-saml/passport-saml](https://npm.io/package/@node-saml/passport-saml.md) ^4.0.4

## Recent versions

- 4.0.0 (latest) — 2024-02-16
- 1.0.1 — 2023-09-13
- 1.0.1-0 — 2023-09-12
- 1.0.0 — 2020-10-02
- 0.2.0 — 2020-09-30
- 0.1.2 — 2020-09-30
- 0.1.1 — 2020-09-30
- 0.1.0 — 2020-09-30

## README

# passport-saml-cache-postgres

![CI](https://github.com/digabi/passport-saml-cache-postgres/workflows/CI/badge.svg)

A PostgreSQL-backed cache provider for [@node-saml/passport-saml](https://github.com/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](schema.sql).

```typescript
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:

```typescript
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.

---
_Source: https://npm.io/package/passport-saml-cache-postgres · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
