loopback/lib/models/user.js

45 lines
1.1 KiB
JavaScript
Raw Normal View History

2013-07-01 23:50:03 +00:00
/**
* Module Dependencies.
*/
var Model = require('../asteroid').Model;
2013-07-02 00:01:26 +00:00
/**
* Default User properties.
*/
var properties = {
id: {type: String, required: true},
realm: {type: String},
username: {type: String, required: true},
// password: {type: String, transient: true}, // Transient property
hash: {type: String}, // Hash code calculated from sha256(realm, username, password, salt, macKey)
salt: {type: String},
macKey: {type: String}, // HMAC to calculate the hash code
email: String,
emailVerified: Boolean,
credentials: [
'UserCredential' // User credentials, private or public, such as private/public keys, Kerberos tickets, oAuth tokens, facebook, google, github ids
],
challenges: [
'Challenge' // Security questions/answers
],
// https://en.wikipedia.org/wiki/Multi-factor_authentication
/*
factors: [
'AuthenticationFactor'
],
*/
status: String,
created: Date,
lastUpdated: Date
}
2013-07-01 23:50:03 +00:00
/**
* Extends from the built in `asteroid.Model` type.
*/
2013-07-02 00:01:26 +00:00
var User = module.exports = Model.extend('user', properties);
2013-07-01 23:50:03 +00:00