Update README for application model

This commit is contained in:
Raymond Feng 2013-12-19 13:42:12 -08:00
parent 7c4737f397
commit a47317de0d
1 changed files with 34 additions and 46 deletions

View File

@ -1,6 +1,7 @@
# Application
Application model captures the metadata for a loopback application.
Application model represents the metadata for a client application that has its
own identity and associated configuration with the LoopBack server.
## Each application has the following basic properties:
@ -25,7 +26,8 @@ Application model captures the metadata for a loopback application.
## Security keys
The following keys are automatically generated by the application creation process. They can be reset upon request.
The following keys are automatically generated by the application creation
process. They can be reset upon request.
* clientKey: Secret for mobile clients
* javaScriptKey: Secret for JavaScript clients
@ -40,48 +42,50 @@ The application can be configured to support multiple methods of push notificati
* pushSettings
{
pushSettings: [
{ "platform": "apns",
"apns": {
"pushOptions": {
"gateway": "gateway.sandbox.push.apple.com",
"cert": "credentials/apns_cert_dev.pem",
"key": "credentials/apns_key_dev.pem"
pushSettings: {
apns: {
certData: config.apnsCertData,
keyData: config.apnsKeyData,
production: false, // Development mode
pushOptions: {
// Extra options can go here for APN
},
"feedbackOptions": {
"gateway": "feedback.sandbox.push.apple.com",
"cert": "credentials/apns_cert_dev.pem",
"key": "credentials/apns_key_dev.pem",
"batchFeedback": true,
"interval": 300
feedbackOptions: {
batchFeedback: true,
interval: 300
}
},
gcm: {
serverApiKey: config.gcmServerApiKey
}
}
}}
]}
## Authentication schemes
* authenticationEnabled
* anonymousAllowed
* authenticationSchemes
### Authentication scheme settings
* scheme: Name of the authentication scheme, such as local, facebook, google, twitter, linkedin, github
* scheme: Name of the authentication scheme, such as local, facebook, google,
twitter, linkedin, github
* credential: Scheme-specific credentials
## APIs for Application model
In addition to the CRUD methods, the Application model also has the following apis:
In addition to the CRUD methods, the Application model also has the following
apis:
### Register a new application
You can register a new application by providing the owner user id, applicaiton name, and other properties in the options object.
You can register a new application by providing the owner user id, application
name, and other properties in the options object.
Application.register('rfeng', 'MyApp1', {description: 'My first loopback application'}, function (err, result) {
Application.register('rfeng', 'MyApp1',
{description: 'My first loopback application'},
function (err, result) {
var app = result;
...
});
@ -97,7 +101,9 @@ You can reset keys for a given application by id.
### Authenticate by appId and key
You can authenticate an application by id and one of the keys. If successful, it calls back with the key name in the result argument. Otherwise, the keyName is null.
You can authenticate an application by id and one of the keys. If successful,
it calls back with the key name in the result argument. Otherwise, the
keyName is null.
Application.authenticate(appId, clientKey, function (err, keyName) {
assert.equal(keyName, 'clientKey');
@ -105,21 +111,3 @@ You can authenticate an application by id and one of the keys. If successful, it
});
# Installation
Installation captures the installation of the application on devices.
Each record of installation has the following properties:
* id: Generated id that uniquely identifies the installation
* appId: Application id
* appVersion: Application version
* userId: The current user id that logs into the application
* deviceToken: Device token
* deviceType: Device type, such as apns
* subscriptions: An Array of tags that represents subscriptions of notifications
* status: Status of the application, production/sandbox/disabled
* created: Timestamp of the recored being created
* modified: Timestamp of the recored being modified