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
- Host: GitHub
- URL: https://github.com/opentable/hapi-auth-fake
- Owner: opentable
- License: mit
- Created: 2015-09-01T15:40:55.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2018-02-23T16:31:25.000Z (over 8 years ago)
- Last Synced: 2025-03-02T16:18:35.979Z (over 1 year ago)
- Language: JavaScript
- Size: 141 KB
- Stars: 0
- Watchers: 22
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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);
});
```