Skip to content

NotificationHandler

Zoltan Tarcsay edited this page Oct 10, 2015 · 3 revisions

NotificationHandler

Kind: global class

new NotificationHandler([options])

Handles notifications

Param Type Default Description
[options] object Options
[options.logger] winston~Logger | Logger new Logger() Logger

notificationHandler.router : express~Router

A express router for the notification receiver endpoint. It can be used as a middleware for your express application. It adds a single route: /agent/notifications which can be used to receive notifications from OpenAM. When a notification is received, its contents will be parsed and handled by one of the handler functions.

Kind: instance property of NotificationHandler
Example

var app = require('express')(),
    agent = new (require('openam-agent').PolicyAgent)({...});

app.use(agent.notifications)

notificationHandler.logger : winston~Logger | Logger

Logger

Kind: instance property of NotificationHandler

notificationHandler.sessionNotification(notificationSet)

Parses notifications in a notification set and emits a 'session' event for each. CookieShield instances listen on this event to delete any destroyed cookies from the agent's session cache.

Kind: instance method of NotificationHandler
Emits: event:session

Param Type Description
notificationSet object OpenAM notification set (parsed XML document)

Example

app.use(agent.notifications.router);
  agent.notifications.on('session', function (session) {
  console.log('server - session changed: %s', JSON.stringify(session));
});