
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
hapi-auth-man
Advanced tools
Cookie authentication plugin with onPostAuth ACL roles and view injection
Based on hapi-auth-cookie added
###ACL Support
After initializing this plugin, you can set roles like plugins.plugin["hapi-auth-man"].roles = roles
roles
must be object which keys specifies roles, values are promise returned functions.
roles = {
"superadmin": function(request, database) {
database.getUser(request.auth.credentials.id).then(function (user)) {
if ( user.isSuperAdmin ) {
return true;
}
return false;
}.catch(function (e)) {
return false;
}
},
"admin": function(request, database) {
}
...
}
###Inject credentials into view context
On hapi 's onPreResponse
event, if response object contains successful authentication and response type is view,
request.auth.credentials
injecting into the view context as a credentials
You can use it in templates files like;
// in EJS
<% if (locals.credentials) { %>
<h2><%= credentials.id %></h2>
<% } %>
###Authentication
Check out hapi-auth-cookie
FAQs
Cookie authentication plugin with onPostAuth ACL roles and view injection
We found that hapi-auth-man demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.