Skip to content

Commit d425b11

Browse files
committed
Merge commit 'cc489df4a3d8544a52148c079ecaee3d1762108d' into gh-pages
* 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)
2 parents 9cc311c + cc489df commit d425b11

11 files changed

+468
-417
lines changed

Gemfile.lock

+5
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ GEM
2424
ethon (0.11.0)
2525
ffi (>= 1.3.0)
2626
eventmachine (1.2.7)
27+
eventmachine (1.2.7-x64-mingw32)
2728
execjs (2.7.0)
2829
faraday (0.15.4)
2930
multipart-post (>= 1.2, < 3)
3031
ffi (1.9.25)
32+
ffi (1.9.25-x64-mingw32)
3133
forwardable-extended (2.6.0)
3234
gemoji (3.0.0)
3335
github-pages (193)
@@ -207,6 +209,8 @@ GEM
207209
multipart-post (2.0.0)
208210
nokogiri (1.8.5)
209211
mini_portile2 (~> 2.3.0)
212+
nokogiri (1.8.5-x64-mingw32)
213+
mini_portile2 (~> 2.3.0)
210214
octokit (4.13.0)
211215
sawyer (~> 0.8.0, >= 0.5.3)
212216
pathutil (0.16.2)
@@ -240,6 +244,7 @@ GEM
240244

241245
PLATFORMS
242246
ruby
247+
x64-mingw32
243248

244249
DEPENDENCIES
245250
github-pages

_includes/js/local-datastore.md

+23
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,29 @@ The Parse JS SDK (Version 2.2.0+) provides a local datastore which can be used t
44

55
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.
66

7+
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.
8+
9+
```javascript
10+
import SecureLS from 'secure-ls';
11+
const ls = new SecureLS({ isCompression: false });
12+
13+
Parse.enableLocalDatastore();
14+
Parse.setLocalDatastoreController({
15+
fromPinWithName: name => ls.get(name),
16+
pinWithName: (name, objects) => ls.set(name, JSON.stringify(objects)),
17+
unPinWithName: name => ls.remove(name),
18+
getAllContents: () => {
19+
let data = {};
20+
ls.getAllKeys().forEach((key) => {
21+
const value = ls.get(key).data;
22+
data[key] = value.includes('{') ? JSON.parse(value) : value;
23+
})
24+
return data;
25+
},
26+
clear: () => ls.removeAll()
27+
});
28+
```
29+
730
## Pinning
831

932
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.

_includes/js/objects.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class CustomUser extends Parse.User {
101101
return 5;
102102
}
103103
}
104-
Parse.Object.registerSubclass('CustomUser', CustomUser);
104+
Parse.Object.registerSubclass('_User', CustomUser);
105105
```
106106

107107
In addition to queries, `logIn` and `signUp` will return the subclass `CustomUser`.

_includes/js/users.md

+16
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,22 @@ The `Parse.User` obtained from `Parse.User.current()` will always be authenticat
136136

137137
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.
138138

139+
## Encrypting Current User
140+
141+
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:
142+
143+
```javascript
144+
145+
Parse.enableEncryptedUser();
146+
Parse.secret = 'my Secrey Key';
147+
148+
```
149+
* It's important to remember that this function will not work if `Parse.secret` is not set.
150+
* Also note that this only works in the browser.
151+
152+
Now the record in Local Storage looks like a random string and only can be read using `Parse.User.current()`
153+
You can check if this feature is enabled with the function `Parse.isEncryptedUserEnabled()`.
154+
139155
## Security For Other Objects
140156

141157
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.

_includes/parse-server/getting-started.md

-4
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ Parse Server is an open source version of the Parse backend that can be deployed
1414
* Python 2.x (For Windows users, 2.7.1 is the required version)
1515
* For deployment, an infrastructure provider like Heroku or AWS
1616

17-
**Compatibility with hosted Parse**
18-
19-
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).
20-
2117
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.
2218

2319
```bash

_includes/parse-server/live-query.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ We provide JavaScript, Android and iOS LiveQuery Clients for now. Lets use the J
3939
```javascript
4040
let query = new Parse.Query('People');
4141
query.equalTo('name', 'Mengyan');
42-
let subscription = query.subscribe();
42+
let subscription = await query.subscribe();
4343
```
4444

4545
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:

_includes/parse-server/third-party-auth.md

+18
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Parse Server supports 3rd party authentication with
1919
* vKontakte
2020
* WeChat
2121
* Weibo
22+
* Microsoft Graph
2223

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

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

297+
### Microsoft Graph `authData`
298+
299+
```js
300+
{
301+
"microsoft": {
302+
"id": "user's microsoft id (string)", // required
303+
"access_token": "an authorized microsoft graph access token for the user", // required
304+
"mail": "user's microsoft email (string)"
305+
}
306+
}
307+
```
308+
309+
Learn more about [Microsoft Graph Auth Overview](https://docs.microsoft.com/en-us/graph/auth/?view=graph-rest-1.0).
310+
311+
To [get access on behalf of a user](https://docs.microsoft.com/en-us/graph/auth-v2-user?view=graph-rest-1.0).
312+
296313
## Custom authentication
297314

298315
It is possible to leverage the OAuth support with any 3rd party authentication that you bring in.
@@ -317,3 +334,4 @@ For more information about custom auth please see the examples:
317334
- [Facebook OAuth](https://github.com/parse-community/parse-server/blob/master/src/Adapters/Auth/facebook.js)
318335
- [Twitter OAuth](https://github.com/parse-community/parse-server/blob/master/src/Adapters/Auth/twitter.js)
319336
- [Instagram OAuth](https://github.com/parse-community/parse-server/blob/master/src/Adapters/Auth/instagram.js)
337+
- [Microsoft Graph OAuth](https://github.com/parse-community/parse-server/blob/master/src/Adapters/Auth/microsoft.js)

_includes/rest/config.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ The response body is a JSON object containing all the configuration parameters i
3737
}
3838
```
3939

40-
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`:
40+
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`):
4141

4242
<pre><code class="bash">
4343
curl -X PUT \
@@ -70,3 +70,5 @@ The response body is a JSON object containing a simple boolean value in the `res
7070
"result": true
7171
}
7272
```
73+
74+
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.

assets/js/bundle.js

+2-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)