@semapps/auth 0.4.0-alpha.13 → 0.4.0-alpha.14
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/mixins/auth.js +4 -2
- package/mixins/auth.sso.js +4 -4
- package/package.json +5 -5
- package/services/auth.local.js +7 -2
package/mixins/auth.js
CHANGED
@@ -24,7 +24,7 @@ const AuthMixin = {
|
|
24
24
|
|
25
25
|
await this.broker.createService(AuthAccountService, {
|
26
26
|
settings: { reservedUsernames },
|
27
|
-
adapter: new TripleStoreAdapter({ type: 'AuthAccount', dataset: accountsDataset })
|
27
|
+
adapter: new TripleStoreAdapter({ type: 'AuthAccount', dataset: accountsDataset })
|
28
28
|
});
|
29
29
|
},
|
30
30
|
async started() {
|
@@ -115,7 +115,9 @@ const AuthMixin = {
|
|
115
115
|
},
|
116
116
|
pickAccountData(data) {
|
117
117
|
if (this.settings.accountSelection.length > 0) {
|
118
|
-
return Object.fromEntries(
|
118
|
+
return Object.fromEntries(
|
119
|
+
this.settings.accountSelection.filter(key => key in data).map(key => [key, data[key]])
|
120
|
+
);
|
119
121
|
} else {
|
120
122
|
return data || {};
|
121
123
|
}
|
package/mixins/auth.sso.js
CHANGED
@@ -32,9 +32,9 @@ const AuthSSOMixin = {
|
|
32
32
|
newUser = false;
|
33
33
|
|
34
34
|
// TODO update account with recent information
|
35
|
-
// await
|
35
|
+
// await ctx.call('webid.edit', profileData, { meta: { webId } });
|
36
36
|
|
37
|
-
|
37
|
+
ctx.emit('auth.connected', { webId, accountData, ssoData }, { meta: { webId: null, dataset: null } });
|
38
38
|
} else {
|
39
39
|
if (!this.settings.registrationAllowed) {
|
40
40
|
throw new Error('registration.not-allowed');
|
@@ -47,10 +47,10 @@ const AuthSSOMixin = {
|
|
47
47
|
// Link the webId with the account
|
48
48
|
await ctx.call('auth.account.attachWebId', { accountUri: accountData['@id'], webId });
|
49
49
|
|
50
|
-
ctx.emit('auth.registered', { webId, profileData, accountData }, { meta: { webId: null, dataset: null } });
|
50
|
+
ctx.emit('auth.registered', { webId, profileData, accountData, ssoData }, { meta: { webId: null, dataset: null } });
|
51
51
|
}
|
52
52
|
|
53
|
-
const token = await ctx.call('auth.jwt.generateToken', { payload: { webId
|
53
|
+
const token = await ctx.call('auth.jwt.generateToken', { payload: { webId } });
|
54
54
|
|
55
55
|
return { token, newUser };
|
56
56
|
}
|
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@semapps/auth",
|
3
|
-
"version": "0.4.0-alpha.
|
3
|
+
"version": "0.4.0-alpha.14",
|
4
4
|
"description": "Authentification module for SemApps",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"author": "Virtual Assembly",
|
7
7
|
"dependencies": {
|
8
|
-
"@semapps/mime-types": "0.4.0-alpha.
|
9
|
-
"@semapps/triplestore": "0.4.0-alpha.
|
8
|
+
"@semapps/mime-types": "0.4.0-alpha.14",
|
9
|
+
"@semapps/triplestore": "0.4.0-alpha.14",
|
10
10
|
"bcrypt": "^5.0.1",
|
11
11
|
"express-session": "^1.17.0",
|
12
12
|
"jsonwebtoken": "^8.5.1",
|
@@ -15,12 +15,12 @@
|
|
15
15
|
"moleculer-web": "^0.10.0-beta1",
|
16
16
|
"openid-client": "^4.7.4",
|
17
17
|
"passport": "^0.4.1",
|
18
|
-
"passport-cas2": "0.0.
|
18
|
+
"passport-cas2": "0.0.12",
|
19
19
|
"passport-local": "^1.0.0",
|
20
20
|
"url-join": "^4.0.1"
|
21
21
|
},
|
22
22
|
"publishConfig": {
|
23
23
|
"access": "public"
|
24
24
|
},
|
25
|
-
"gitHead": "
|
25
|
+
"gitHead": "d84cc686bf0a0404a94cefe9d8b5828a058659da"
|
26
26
|
}
|
package/services/auth.local.js
CHANGED
@@ -12,7 +12,7 @@ const AuthLocalService = {
|
|
12
12
|
registrationAllowed: true,
|
13
13
|
reservedUsernames: [],
|
14
14
|
webIdSelection: [],
|
15
|
-
accountSelection: []
|
15
|
+
accountSelection: []
|
16
16
|
},
|
17
17
|
created() {
|
18
18
|
this.passportId = 'local';
|
@@ -21,7 +21,12 @@ const AuthLocalService = {
|
|
21
21
|
async signup(ctx) {
|
22
22
|
const { username, email, password, ...rest } = ctx.params;
|
23
23
|
|
24
|
-
let accountData = await ctx.call('auth.account.create', {
|
24
|
+
let accountData = await ctx.call('auth.account.create', {
|
25
|
+
username,
|
26
|
+
email,
|
27
|
+
password,
|
28
|
+
...this.pickAccountData(rest)
|
29
|
+
});
|
25
30
|
|
26
31
|
const profileData = { nick: username, email, ...rest };
|
27
32
|
const webId = await ctx.call('webid.create', this.pickWebIdData(profileData));
|