An open API service indexing awesome lists of open source software.

https://github.com/opentable/hapi-auth-fake

will always auth, useful when developing
https://github.com/opentable/hapi-auth-fake

Last synced: 2 months ago
JSON representation

will always auth, useful when developing

Awesome Lists containing this project

README

          

# hapi-auth-fake
will always auth, useful when developing

the only option you need to supply is a data function, this returns the credentials you want to be returned on auth.

##example

```javascript
var Hapi = require('hapi');

var home = function (request, reply) {

reply('Login page

Welcome '
+ request.auth.credentials.name
+ '!


');
};

var server = new Hapi.Server();
server.connection({ port: 8000 });

server.register(require('hapi-auth-fake'), function (err) {

server.auth.strategy('session', 'fake', {
dataFunc: function() {
return { name: 'bob' }
}
});
});

server.route([
{
method: 'GET',
path: '/',
config: {
handler: home,
auth: 'session'
}
}
]);

server.start(function (err) {

if (err) {
throw err;
}
console.log('Server started at: ' + server.info.uri);
});
```