This plugin will allow Hapi to authentication against PINGFederate Opentoken endpoints.
const opentoken = {
register: require('hapi-auth-opentoken'),
options: {
password: 'testPassword',
cipherSuite: 0,
tokenName: 'opentoken'
}
};
server.register([opentoken], (err) => {
server.auth.strategy('default', 'opentoken', { validateFunc: validate });
server.route({ method: 'GET', path: '/', config: { auth: 'default' } });
});
function validate(request, token, callback) {
// token contains the decrypted saml response
callback(err, { id: '12345', name: 'Jos Sykes' });
}
Opentoken takes the following options
The validation function has a signature of validate(request, token, callback)
where
callback - a callback function taking the following parameters
Tags: hapijs, javascript, node.js, opentoken