# hapi-hazelcast-session

> Hapi session stored in Hazelcast

Latest version **1.0.0** (published 2019-01-28) · MIT license · 0 weekly downloads

## Install

```sh
npm install hapi-hazelcast-session
pnpm add hapi-hazelcast-session
yarn add hapi-hazelcast-session
bun add hapi-hazelcast-session
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-01-28 |
| First published | 2019-01-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 22.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Istislav |
| Maintainers | istislav |
| Keywords | hapi, hazelcast, plugin, server, session |

## Links

- npm: https://www.npmjs.com/package/hapi-hazelcast-session
- Repository: https://github.com/istislav/hapi-hazelcast-session
- Issues: https://github.com/istislav/hapi-hazelcast-session/issues
- npm.io page: https://npm.io/package/hapi-hazelcast-session

## Dependencies (2)

- [hoek](https://npm.io/package/hoek.md) >=5.0.3 <6
- [hazelcast-client](https://npm.io/package/hazelcast-client.md) >=0.10.0

## Alternatives

- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads
- [escher-request](https://npm.io/package/escher-request.md) — 545 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2019-01-28

## README

# hapi-hazelcast-session

Server-side session for hapi, stored in Hazelcast cache server. Based on [hapi-server-session](https://github.com/btmorex/hapi-server-session). 

## Install

    $ npm install hapi-hazelcast-session

## Example

```javascript
'use strict';

const hapi = require('hapi');

const main = async () => {
  const server = new hapi.Server({
    host: 'localhost',
    address: '127.0.0.1',
    port: 8000,
  });

  await server.register({
    plugin: require('hazelcast-server-session'),
    options: {
      host: '127.0.0.1',
      login: 'cluster_login',
      password: 'cluster_password',
      cookie: {
        isSecure: false, // never set to false in production
      },
    },
  });

  server.route({
    method: 'GET',
    path: '/',
    handler: (request, h) => {
      request.session.views = request.session.views + 1 || 1;
      return 'Views: ' + request.session.views;
    },
  });

  await server.start();
};

main().catch(console.error);
```

## Options

      host: '127.0.0.1',
      login: 'cluster_login',
      password: 'cluster_password',
- `host`: [Default: `'127.0.0.1'`] host of the Hazelcast server
- `login`: [Default: `''`] group name of the Hazelcast server 
- `password`: [Default: `''`] password of the Hazelcast server 

- `algorithm`: [Default: `'sha256'`] algorithm to use during signing
- `cache`: supports the same options as [`server.cache(options)`](<https://hapijs.com/api#server.cache()>)
  - `expiresIn`: [Default: session `expiresIn` if set or `2147483647`] session cache expiration in milliseconds
  - `segment`: [Default: `'session'`] session cache segment
- `cookie`: supports the same options as [`server.state(name, [options])`](<https://hapijs.com/api#server.state()>)
  - `isSameSite`: [Default: `'Lax'`] sets the `SameSite` flag
  - `path`: [Default: `'/'`] sets the `Path` flag
  - `ttl`: [Default: session `expiresIn` if set] sets the `Expires` and `Max-Age` flags
- `expiresIn`: session expiration in milliseconds
- `name`: [Default: `'id'`] name of the cookie
- `key`: signing key. Prevents weaknesses in randomness from affecting overall security
- `size`: [Default: `16`] number of random bytes in the session id

---
_Source: https://npm.io/package/hapi-hazelcast-session · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
