Skip to content

Commit

Permalink
Merge commit 'cc489df4a3d8544a52148c079ecaee3d1762108d' into gh-pages
Browse files Browse the repository at this point in the history
* commit 'cc489df4a3d8544a52148c079ecaee3d1762108d':
  Adding microsoft oauth doc (parse-community#698)
  Encrypting Current User and Local Storage (parse-community#695)
  Update live-query.md (parse-community#696)
  Update config.md (parse-community#689)
  Fix User Subclass Documentation (parse-community#690)
  remove info about parse.com compatibility (parse-community#686)
  • Loading branch information
mtrezza committed Jan 9, 2020
2 parents 9cc311c + cc489df commit d425b11
Show file tree
Hide file tree
Showing 11 changed files with 468 additions and 417 deletions.
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ GEM
ethon (0.11.0)
ffi (>= 1.3.0)
eventmachine (1.2.7)
eventmachine (1.2.7-x64-mingw32)
execjs (2.7.0)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
ffi (1.9.25)
ffi (1.9.25-x64-mingw32)
forwardable-extended (2.6.0)
gemoji (3.0.0)
github-pages (193)
Expand Down Expand Up @@ -207,6 +209,8 @@ GEM
multipart-post (2.0.0)
nokogiri (1.8.5)
mini_portile2 (~> 2.3.0)
nokogiri (1.8.5-x64-mingw32)
mini_portile2 (~> 2.3.0)
octokit (4.13.0)
sawyer (~> 0.8.0, >= 0.5.3)
pathutil (0.16.2)
Expand Down Expand Up @@ -240,6 +244,7 @@ GEM

PLATFORMS
ruby
x64-mingw32

DEPENDENCIES
github-pages
Expand Down
23 changes: 23 additions & 0 deletions _includes/js/local-datastore.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,29 @@ The Parse JS SDK (Version 2.2.0+) provides a local datastore which can be used t

There are a couple of side effects of enabling the local datastore that you should be aware of. When enabled, there will only be one instance of any given `Parse.Object`. For example, imagine you have an instance of the `"GameScore"` class with an `objectId` of `"xWMyZ4YEGZ"`, and then you issue a `Parse.Query` for all instances of `"GameScore"` with that `objectId`. The result will be the same instance of the object you already have in memory.

Also if you don't want to show the data in the local storage you can use [secure-ls](https://github.com/softvar/secure-ls) to Encrypt it.

```javascript
import SecureLS from 'secure-ls';
const ls = new SecureLS({ isCompression: false });

Parse.enableLocalDatastore();
Parse.setLocalDatastoreController({
fromPinWithName: name => ls.get(name),
pinWithName: (name, objects) => ls.set(name, JSON.stringify(objects)),
unPinWithName: name => ls.remove(name),
getAllContents: () => {
let data = {};
ls.getAllKeys().forEach((key) => {
const value = ls.get(key).data;
data[key] = value.includes('{') ? JSON.parse(value) : value;
})
return data;
},
clear: () => ls.removeAll()
});
```

## Pinning

You can store a `Parse.Object` in the local datastore by pinning it. Pinning a `Parse.Object` is recursive, just like saving, so any objects that are pointed to by the one you are pinning will also be pinned. When an object is pinned, every time you update it by fetching or saving new data, the copy in the local datastore will be updated automatically. You don't need to worry about it at all.
Expand Down
2 changes: 1 addition & 1 deletion _includes/js/objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class CustomUser extends Parse.User {
return 5;
}
}
Parse.Object.registerSubclass('CustomUser', CustomUser);
Parse.Object.registerSubclass('_User', CustomUser);
```

In addition to queries, `logIn` and `signUp` will return the subclass `CustomUser`.
Expand Down
16 changes: 16 additions & 0 deletions _includes/js/users.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,22 @@ The `Parse.User` obtained from `Parse.User.current()` will always be authenticat

If you need to check if a `Parse.User` is authenticated, you can invoke the `authenticated` method. You do not need to check `authenticated` with `Parse.User` objects that are obtained via an authenticated method.

## Encrypting Current User

Often you may want to be more careful with user information stored in the browser, if this is the case you can encrypt the current user object:

```javascript

Parse.enableEncryptedUser();
Parse.secret = 'my Secrey Key';

```
* It's important to remember that this function will not work if `Parse.secret` is not set.
* Also note that this only works in the browser.

Now the record in Local Storage looks like a random string and only can be read using `Parse.User.current()`
You can check if this feature is enabled with the function `Parse.isEncryptedUserEnabled()`.

## Security For Other Objects

The same security model that applies to the `Parse.User` can be applied to other objects. For any object, you can specify which users are allowed to read the object, and which users are allowed to modify an object. To support this type of security, each object has an [access control list](http://en.wikipedia.org/wiki/Access_control_list), implemented by the `Parse.ACL` class.
Expand Down
4 changes: 0 additions & 4 deletions _includes/parse-server/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ Parse Server is an open source version of the Parse backend that can be deployed
* Python 2.x (For Windows users, 2.7.1 is the required version)
* For deployment, an infrastructure provider like Heroku or AWS

**Compatibility with hosted Parse**

There are a few areas where Parse Server does not provide compatibility with the Parse hosted backend. If you're migrating a hosted Parse.com app to Parse Server, please take some time to carefully read through the list of [compatibility issues](#compatibility-with-parsecom).

The fastest and easiest way to get started is to run MongoDB and Parse Server locally. Use the bootstrap script to set up Parse Server in the current directory.

```bash
Expand Down
2 changes: 1 addition & 1 deletion _includes/parse-server/live-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ We provide JavaScript, Android and iOS LiveQuery Clients for now. Lets use the J
```javascript
let query = new Parse.Query('People');
query.equalTo('name', 'Mengyan');
let subscription = query.subscribe();
let subscription = await query.subscribe();
```

After you get the `subscription`, you can use it to receive the updates of the related `Parse.Object`. For example, if someone creates a `People` object whose `name` field is `Mengyan`, then you can get the `People` object like this:
Expand Down
18 changes: 18 additions & 0 deletions _includes/parse-server/third-party-auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Parse Server supports 3rd party authentication with
* vKontakte
* WeChat
* Weibo
* Microsoft Graph

Configuration options for these 3rd-party modules is done with the `auth` option passed to Parse Server:

Expand Down Expand Up @@ -293,6 +294,22 @@ Learn more about [PhantAuth](https://www.phantauth.net/).
}
```

### Microsoft Graph `authData`

```js
{
"microsoft": {
"id": "user's microsoft id (string)", // required
"access_token": "an authorized microsoft graph access token for the user", // required
"mail": "user's microsoft email (string)"
}
}
```

Learn more about [Microsoft Graph Auth Overview](https://docs.microsoft.com/en-us/graph/auth/?view=graph-rest-1.0).

To [get access on behalf of a user](https://docs.microsoft.com/en-us/graph/auth-v2-user?view=graph-rest-1.0).

## Custom authentication

It is possible to leverage the OAuth support with any 3rd party authentication that you bring in.
Expand All @@ -317,3 +334,4 @@ For more information about custom auth please see the examples:
- [Facebook OAuth](https://github.com/parse-community/parse-server/blob/master/src/Adapters/Auth/facebook.js)
- [Twitter OAuth](https://github.com/parse-community/parse-server/blob/master/src/Adapters/Auth/twitter.js)
- [Instagram OAuth](https://github.com/parse-community/parse-server/blob/master/src/Adapters/Auth/instagram.js)
- [Microsoft Graph OAuth](https://github.com/parse-community/parse-server/blob/master/src/Adapters/Auth/microsoft.js)
4 changes: 3 additions & 1 deletion _includes/rest/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The response body is a JSON object containing all the configuration parameters i
}
```

You can also update the config by sending a `PUT` request to config URL. Here is a simple example that will update the `Parse.Config`:
You can also update the config by sending a `PUT` request to config URL. Here is a simple example that will update the `Parse.Config` (requires `masterKey`):

<pre><code class="bash">
curl -X PUT \
Expand Down Expand Up @@ -70,3 +70,5 @@ The response body is a JSON object containing a simple boolean value in the `res
"result": true
}
```

If you want to make any changes to configs without sending the `masterkey`, you will need to create a Cloud Function that makes those changes.
15 changes: 2 additions & 13 deletions assets/js/bundle.js

Large diffs are not rendered by default.

Loading

0 comments on commit d425b11

Please sign in to comment.