@semapps/auth 0.9.0 → 0.9.2

Sign up to get free protection for your applications and to get access to all the features.
package/mixins/auth.js CHANGED
@@ -162,8 +162,10 @@ const AuthMixin = {
162
162
  const baseUrlTrailing = urlJoin(this.settings.baseUrl, '/');
163
163
  webId = webId || baseUrlTrailing + username;
164
164
 
165
+ const podUrl = await ctx.call('pod.getUrl', { webId });
166
+
165
167
  // Check if capabilityUri is within the resource owner's pod
166
- if (!webId?.startsWith(baseUrlTrailing) || !capabilityUri?.startsWith(urlJoin(webId, 'data'))) {
168
+ if (!webId?.startsWith(baseUrlTrailing) || !capabilityUri?.startsWith(podUrl)) {
167
169
  return undefined;
168
170
  }
169
171
 
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@semapps/auth",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "Authentification module for SemApps",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Virtual Assembly",
7
7
  "dependencies": {
8
- "@semapps/ldp": "0.9.0",
9
- "@semapps/middlewares": "0.9.0",
10
- "@semapps/mime-types": "0.9.0",
11
- "@semapps/triplestore": "0.9.0",
8
+ "@semapps/ldp": "0.9.2",
9
+ "@semapps/middlewares": "0.9.2",
10
+ "@semapps/mime-types": "0.9.2",
11
+ "@semapps/triplestore": "0.9.2",
12
12
  "bcrypt": "^5.0.1",
13
13
  "express-session": "^1.17.0",
14
14
  "jsonwebtoken": "^8.5.1",
@@ -29,5 +29,5 @@
29
29
  "engines": {
30
30
  "node": ">=14"
31
31
  },
32
- "gitHead": "c37090ef1e0394e3e7be95df90f07605d55afc7b"
32
+ "gitHead": "99b2776a49037c7a46de93f33d98ea7230c495ac"
33
33
  }
@@ -149,8 +149,7 @@ module.exports = {
149
149
  async findDatasetByWebId(ctx) {
150
150
  const webId = ctx.params.webId || ctx.meta.webId;
151
151
  const account = await ctx.call('auth.account.findByWebId', { webId });
152
- // If no podUri exist, it means we are not in Pod config
153
- return account?.podUri ? getSlugFromUri(webId) : undefined;
152
+ return account?.username;
154
153
  },
155
154
  async findSettingsByWebId(ctx) {
156
155
  const webId = ctx.params.webId || ctx.meta.webId;
@@ -214,7 +213,6 @@ module.exports = {
214
213
  // ...except for
215
214
  webId: account.webId,
216
215
  username: account.username,
217
- podUri: account.podUri,
218
216
  // And add a deletedAt date.
219
217
  deletedAt: new Date().toISOString()
220
218
  });
@@ -46,7 +46,7 @@ const AuthLocalService = {
46
46
  },
47
47
  actions: {
48
48
  async signup(ctx) {
49
- const { username, email, password, interactionId, ...rest } = ctx.params;
49
+ const { username, email, password, ...rest } = ctx.params;
50
50
  // This is going to get in our way otherwise when waiting for completions.
51
51
  ctx.meta.skipObjectsWatcher = true;
52
52
 
@@ -72,7 +72,7 @@ const AuthLocalService = {
72
72
  // Link the webId with the account
73
73
  accountData = await ctx.call('auth.account.attachWebId', { accountUri: accountData['@id'], webId });
74
74
 
75
- ctx.emit('auth.registered', { webId, profileData, accountData, interactionId });
75
+ ctx.emit('auth.registered', { webId, profileData, accountData });
76
76
 
77
77
  const token = await ctx.call('auth.jwt.generateToken', { payload: { webId } });
78
78
 
@@ -84,15 +84,11 @@ const AuthLocalService = {
84
84
  }
85
85
  },
86
86
  async login(ctx) {
87
- const { username, password, interactionId } = ctx.params;
87
+ const { username, password } = ctx.params;
88
88
 
89
89
  const accountData = await ctx.call('auth.account.verify', { username, password });
90
90
 
91
- ctx.emit(
92
- 'auth.connected',
93
- { webId: accountData.webId, accountData, interactionId },
94
- { meta: { webId: null, dataset: null } }
95
- );
91
+ ctx.emit('auth.connected', { webId: accountData.webId, accountData }, { meta: { webId: null, dataset: null } });
96
92
 
97
93
  const token = await ctx.call('auth.jwt.generateToken', { payload: { webId: accountData.webId } });
98
94