@stonyx/oauth 0.1.1-alpha.0 → 0.1.1-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -4
- package/src/main.js +4 -0
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"stonyx-async",
|
|
5
5
|
"stonyx-module"
|
|
6
6
|
],
|
|
7
|
-
"version": "0.1.1-alpha.
|
|
7
|
+
"version": "0.1.1-alpha.2",
|
|
8
8
|
"description": "OAuth2 authentication module for the Stonyx framework",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
@@ -25,14 +25,15 @@
|
|
|
25
25
|
"provenance": true
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"stonyx": "0.2.3-beta.
|
|
28
|
+
"stonyx": "0.2.3-beta.6",
|
|
29
|
+
"@stonyx/events": "0.1.1-beta.7"
|
|
29
30
|
},
|
|
30
31
|
"peerDependencies": {
|
|
31
32
|
"@stonyx/rest-server": ">=0.2.1-beta.11"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
|
-
"@stonyx/rest-server": "0.2.1-beta.
|
|
35
|
-
"@stonyx/utils": "0.2.3-beta.
|
|
35
|
+
"@stonyx/rest-server": "0.2.1-beta.16",
|
|
36
|
+
"@stonyx/utils": "0.2.3-beta.5",
|
|
36
37
|
"qunit": "^2.24.1",
|
|
37
38
|
"sinon": "^21.0.0"
|
|
38
39
|
},
|
package/src/main.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import config from 'stonyx/config';
|
|
2
2
|
import log from 'stonyx/log';
|
|
3
3
|
import { waitForModule } from 'stonyx';
|
|
4
|
+
import { setup, emit } from '@stonyx/events';
|
|
4
5
|
import RestServer from '@stonyx/rest-server';
|
|
5
6
|
import TokenManager from './token-manager.js';
|
|
6
7
|
import SessionManager from './session-manager.js';
|
|
7
8
|
import AuthRequest from './auth-request.js';
|
|
8
9
|
|
|
10
|
+
setup(['authenticate']);
|
|
11
|
+
|
|
9
12
|
export default class OAuth {
|
|
10
13
|
providers = new Map();
|
|
11
14
|
pendingStates = new Map();
|
|
@@ -66,6 +69,7 @@ export default class OAuth {
|
|
|
66
69
|
const tokens = await tokenManager.getTokens(code);
|
|
67
70
|
const rawUser = await flow.fetchUserInfo(tokens.accessToken);
|
|
68
71
|
const user = flow.normalizeUser(rawUser);
|
|
72
|
+
await emit('authenticate', user);
|
|
69
73
|
return this.sessionManager.create(user, tokens);
|
|
70
74
|
}
|
|
71
75
|
|