v0.3.1: Consistency in identity.isAuthenticated
The isAuthenticated method of the UserIdentity type has been adjusted to provide a consistent API with other custom Identity objects. All isAuthenticated methods on Identity objects now have this signature:
isAuthenticated(function(err, cb){
});This allows you to check authentication in your activities, like this:
// this now works for the UserIdentity, as well as custom identities
activities.can("do.something", function(identity, params, cb){
// validate authentication first
identity.isAuthenticated(function(err, isAuth){
if (err) { return cb(err); }
cb(null, isAuth);
});
// now write other code to check authorization
});