loopback/common/models
Miroslav Bajtoš 9c5fe088e3 AccessControl for change replication
1) Add integration tests running change replication over REST to verify
that access control at model level is correctly enforced.

2) Implement a new access type "REPLICATE" that allows principals
to create new checkpoints, even though they don't have full WRITE
access to the model. Together with the "READ" permission, these
two types allow principals to replicate (pull) changes from the server.

Note that anybody having "WRITE" access type is automatically
granted "REPLICATE" type too.

3) Add a new model option "enableRemoteReplication" that exposes
replication methods via strong remoting, but does not configure
change rectification. This option should be used the clients
when setting up Remote models attached to the server via the remoting
connector.
2015-04-07 19:53:58 +02:00
..
README.md Dismantle `lib/models`. 2014-10-13 12:09:27 +02:00
access-token.js Replace deprecated hooks with Operation hooks 2015-03-03 18:06:15 +01:00
access-token.json models: move AccessToken LDL def into a json file 2014-10-14 08:58:17 +02:00
acl.js AccessControl for change replication 2015-04-07 19:53:58 +02:00
acl.json models: move ACL LDL def into a json file 2014-10-14 09:04:43 +02:00
application.js Replace deprecated hooks with Operation hooks 2015-03-03 18:06:15 +01:00
application.json Add realm support 2014-10-23 11:10:39 -07:00
change.js Improve error handling in replication 2015-03-30 11:07:53 +02:00
change.json models: move Change LDL def into a json file 2014-10-14 09:04:43 +02:00
checkpoint.js Merge pull request #1157 from strongloop/feature/replication-improvements 2015-03-04 08:45:19 +01:00
checkpoint.json models: move Checkpoint LDL def into a json file 2014-10-14 09:04:43 +02:00
email.js Clean up jsdoc comments 2014-10-15 09:42:24 +02:00
email.json models: move Email LDL def into `email.json` 2014-10-14 08:58:17 +02:00
role-mapping.js Add support for app level Model isolation 2015-04-03 11:48:45 -07:00
role-mapping.json models: move RoleMapping def into its own files 2014-10-14 09:04:43 +02:00
role.js Add support for app level Model isolation 2015-04-03 11:48:45 -07:00
role.json models: move Role LDL def into a json file 2014-10-14 09:04:43 +02:00
scope.js Add support for app level Model isolation 2015-04-03 11:48:45 -07:00
scope.json models: move Scope def into its own files 2014-10-14 08:58:17 +02:00
user.js Merge pull request #1272 from strongloop/feature/after-remote-error-hook 2015-04-07 09:47:51 +02:00
user.json User: fix `confirm` permissions 2014-10-23 13:19:43 +02:00

README.md

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:

  • id: Automatically generated id
  • name: Name of the application (required)
  • description: Description of the application (optional)
  • icon: URL of the icon
  • status: Status of the application, such as production/sandbox/disabled
  • created: Timestamp of the record being created
  • modified: Timestamp of the record being modified

An application has the following properties linking to users:

  • owner: The user id of the developer who registers the application
  • collaborators: A array of users ids who have permissions to work on this app

oAuth 2.0 settings

  • url: The application url
  • callbackUrls: An array of preregistered callback urls for oAuth 2.0
  • permissions: An array of oAuth 2.0 scopes that can be requested by the application

Security keys

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
  • restApiKey: Secret for REST APIs
  • windowsKey: Secret for Windows applications
  • masterKey: Secret for REST APIS. It bypasses model level permissions

Push notification settings

The application can be configured to support multiple methods of push notifications.

  • pushSettings

    pushSettings: { apns: { certData: config.apnsCertData, keyData: config.apnsKeyData, production: false, // Development mode pushOptions: { // Extra options can go here for APN }, 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
  • credential: Scheme-specific credentials

APIs for Application model

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, application name, and other properties in the options object.

Application.register('rfeng', 'MyApp1',
    {description: 'My first loopback application'},
    function (err, result) {
        var app = result;
    ...
});

Reset keys

You can reset keys for a given application by id.

Application.resetKeys(appId, function (err, result) {
    var app = result;
    ...
});

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.

Application.authenticate(appId, clientKey, function (err, keyName) {
        assert.equal(keyName, 'clientKey');
        ...
});