@strapi/plugin-users-permissions 4.0.0-beta.18 → 4.0.0-beta.21

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.
@@ -6,7 +6,7 @@
6
6
  "security": [],
7
7
  "externalDocs": {
8
8
  "description": "Find out more in the strapi's documentation",
9
- "url": "https://strapi.io/documentation/developer-docs/latest/development/plugins/users-permissions.html#registration"
9
+ "url": "https://docs.strapi.io/developer-docs/latest/plugins/users-permissions.html#registration"
10
10
  },
11
11
  "responses": {
12
12
  "200": {
@@ -58,7 +58,7 @@
58
58
  "security": [],
59
59
  "externalDocs": {
60
60
  "description": "Find out more in the strapi's documentation",
61
- "url": "https://strapi.io/documentation/developer-docs/latest/development/plugins/users-permissions.html#email-validation"
61
+ "url": "https://docs.strapi.io/developer-docs/latest/plugins/users-permissions.html#email-validation"
62
62
  },
63
63
  "responses": {
64
64
  "200": {
@@ -130,7 +130,7 @@
130
130
  ],
131
131
  "externalDocs": {
132
132
  "description": "Find out more about the authentication flow in the strapi documentation",
133
- "url": "https://strapi.io/documentation/developer-docs/latest/development/plugins/users-permissions.html#setting-up-the-provider-examples"
133
+ "url": "https://docs.strapi.io/developer-docs/latest/plugins/users-permissions.html#providers"
134
134
  },
135
135
  "responses": {
136
136
  "200": {
@@ -143,7 +143,7 @@
143
143
  "post": {
144
144
  "externalDocs": {
145
145
  "description": "Find out more in the strapi's documentation",
146
- "url": "https://strapi.io/documentation/developer-docs/latest/development/plugins/users-permissions.html#login"
146
+ "url": "https://docs.strapi.io/developer-docs/latest/plugins/users-permissions.html#login"
147
147
  },
148
148
  "tags": ["Authentication"],
149
149
  "security": [],
@@ -188,7 +188,7 @@
188
188
  "tags": ["Authentication"],
189
189
  "externalDocs": {
190
190
  "description": "Find out more in the strapi's documentation",
191
- "url": "https://strapi.io/documentation/developer-docs/latest/development/plugins/users-permissions.html#setting-up-the-provider-examples"
191
+ "url": "https://docs.strapi.io/developer-docs/latest/plugins/users-permissions.html#providers"
192
192
  },
193
193
  "parameters": [
194
194
  {
@@ -223,7 +223,7 @@
223
223
  "summary": "Send an email to reset your password",
224
224
  "externalDocs": {
225
225
  "description": "Find out more in the strapi's documentation",
226
- "url": "https://strapi.io/documentation/developer-docs/latest/development/plugins/users-permissions.html#forgotten-reset-password"
226
+ "url": "https://docs.strapi.io/developer-docs/latest/plugins/users-permissions.html#forgotten-reset-password"
227
227
  },
228
228
  "requestBody": {
229
229
  "description": "",
@@ -315,7 +315,7 @@
315
315
  "description": "All the routes related to the authentication",
316
316
  "externalDocs": {
317
317
  "description": "Find out more in strapi's documentation",
318
- "url": "https://strapi.io/documentation/developer-docs/latest/development/plugins/users-permissions.html"
318
+ "url": "https://docs.strapi.io/developer-docs/latest/plugins/users-permissions.html"
319
319
  }
320
320
  },
321
321
  {
package/package.json CHANGED
@@ -1,21 +1,31 @@
1
1
  {
2
2
  "name": "@strapi/plugin-users-permissions",
3
- "version": "4.0.0-beta.18",
3
+ "version": "4.0.0-beta.21",
4
4
  "description": "Protect your API with a full-authentication process based on JWT",
5
- "strapi": {
6
- "displayName": "Roles & Permissions",
7
- "name": "users-permissions",
8
- "description": "Protect your API with a full authentication process based on JWT. This plugin comes also with an ACL strategy that allows you to manage the permissions between the groups of users.",
9
- "required": true,
10
- "kind": "plugin"
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git://github.com/strapi/strapi.git"
11
8
  },
9
+ "license": "SEE LICENSE IN LICENSE",
10
+ "author": {
11
+ "name": "Strapi Solutions SAS",
12
+ "email": "hi@strapi.io",
13
+ "url": "https://strapi.io"
14
+ },
15
+ "maintainers": [
16
+ {
17
+ "name": "Strapi Solutions SAS",
18
+ "email": "hi@strapi.io",
19
+ "url": "https://strapi.io"
20
+ }
21
+ ],
12
22
  "scripts": {
13
23
  "test": "echo \"no tests yet\""
14
24
  },
15
25
  "dependencies": {
16
26
  "@purest/providers": "^1.0.2",
17
- "@strapi/helper-plugin": "4.0.0-beta.18",
18
- "@strapi/utils": "4.0.0-beta.18",
27
+ "@strapi/helper-plugin": "4.0.0-beta.21",
28
+ "@strapi/utils": "4.0.0-beta.21",
19
29
  "bcryptjs": "2.4.3",
20
30
  "grant-koa": "5.4.8",
21
31
  "jsonwebtoken": "^8.1.0",
@@ -36,26 +46,16 @@
36
46
  "devDependencies": {
37
47
  "koa": "^2.13.1"
38
48
  },
39
- "author": {
40
- "name": "Strapi team",
41
- "email": "hi@strapi.io",
42
- "url": "https://strapi.io"
43
- },
44
- "maintainers": [
45
- {
46
- "name": "Strapi team",
47
- "email": "hi@strapi.io",
48
- "url": "https://strapi.io"
49
- }
50
- ],
51
- "repository": {
52
- "type": "git",
53
- "url": "git://github.com/strapi/strapi.git"
54
- },
55
49
  "engines": {
56
50
  "node": ">=12.x.x <=16.x.x",
57
51
  "npm": ">=6.0.0"
58
52
  },
59
- "license": "SEE LICENSE IN LICENSE",
60
- "gitHead": "3e9e3f13cb85822e6d92b0e448ae0b94d440dac1"
53
+ "strapi": {
54
+ "displayName": "Roles & Permissions",
55
+ "name": "users-permissions",
56
+ "description": "Protect your API with a full authentication process based on JWT. This plugin comes also with an ACL strategy that allows you to manage the permissions between the groups of users.",
57
+ "required": true,
58
+ "kind": "plugin"
59
+ },
60
+ "gitHead": "dd25a85f8ea5d7b2445e0ba8fe4448087be20839"
61
61
  }
@@ -41,9 +41,6 @@ const initGrant = async pluginStore => {
41
41
  const baseURL = `${strapi.config.server.url}/${apiPrefix}/auth`;
42
42
 
43
43
  const grantConfig = {
44
- defaults: {
45
- prefix: `${apiPrefix}/connect`,
46
- },
47
44
  email: {
48
45
  enabled: true,
49
46
  icon: 'envelope',
@@ -162,10 +162,18 @@ module.exports = {
162
162
  async connect(ctx, next) {
163
163
  const grant = require('grant-koa');
164
164
 
165
- const grantConfig = await strapi
165
+ const providers = await strapi
166
166
  .store({ type: 'plugin', name: 'users-permissions', key: 'grant' })
167
167
  .get();
168
168
 
169
+ const apiPrefix = strapi.config.get('api.rest.prefix');
170
+ const grantConfig = {
171
+ defaults: {
172
+ prefix: `${apiPrefix}/connect`,
173
+ },
174
+ ...providers,
175
+ };
176
+
169
177
  const [requestPath] = ctx.request.url.split('?');
170
178
  const provider = requestPath.split('/connect/')[1].split('/')[0];
171
179
 
@@ -175,7 +183,7 @@ module.exports = {
175
183
 
176
184
  if (!strapi.config.server.url.startsWith('http')) {
177
185
  strapi.log.warn(
178
- 'You are using a third party provider for login. Make sure to set an absolute url in config/server.js. More info here: https://strapi.io/documentation/developer-docs/latest/development/plugins/users-permissions.html#setting-up-the-server-url'
186
+ 'You are using a third party provider for login. Make sure to set an absolute url in config/server.js. More info here: https://docs.strapi.io/developer-docs/latest/plugins/users-permissions.html#setting-up-the-server-url'
179
187
  );
180
188
  }
181
189
 
@@ -28,7 +28,7 @@ module.exports = ({ strapi }) => {
28
28
  const getProfile = async (provider, query, callback) => {
29
29
  const access_token = query.access_token || query.code || query.oauth_token;
30
30
 
31
- const grant = await strapi
31
+ const providers = await strapi
32
32
  .store({ type: 'plugin', name: 'users-permissions', key: 'grant' })
33
33
  .get();
34
34
 
@@ -168,7 +168,7 @@ module.exports = ({ strapi }) => {
168
168
  return callback(null, {
169
169
  username: userbody.login,
170
170
  email: Array.isArray(emailsbody)
171
- ? emailsbody.find((email) => email.primary === true).email
171
+ ? emailsbody.find(email => email.primary === true).email
172
172
  : null,
173
173
  });
174
174
  });
@@ -201,8 +201,8 @@ module.exports = ({ strapi }) => {
201
201
  const twitter = purest({
202
202
  provider: 'twitter',
203
203
  config: purestConfig,
204
- key: grant.twitter.key,
205
- secret: grant.twitter.secret,
204
+ key: providers.twitter.key,
205
+ secret: providers.twitter.secret,
206
206
  });
207
207
 
208
208
  twitter
@@ -225,8 +225,8 @@ module.exports = ({ strapi }) => {
225
225
  case 'instagram': {
226
226
  const instagram = purest({
227
227
  provider: 'instagram',
228
- key: grant.instagram.key,
229
- secret: grant.instagram.secret,
228
+ key: providers.instagram.key,
229
+ secret: providers.instagram.secret,
230
230
  config: purestConfig,
231
231
  });
232
232
 
@@ -298,7 +298,7 @@ module.exports = ({ strapi }) => {
298
298
 
299
299
  twitch
300
300
  .get('users')
301
- .auth(access_token, grant.twitch.key)
301
+ .auth(access_token, providers.twitch.key)
302
302
  .request((err, res, body) => {
303
303
  if (err) {
304
304
  callback(err);
@@ -403,7 +403,7 @@ module.exports = ({ strapi }) => {
403
403
  }
404
404
  case 'auth0': {
405
405
  const purestAuth0Conf = {};
406
- purestAuth0Conf[`https://${grant.auth0.subdomain}.auth0.com`] = {
406
+ purestAuth0Conf[`https://${providers.auth0.subdomain}.auth0.com`] = {
407
407
  __domain: {
408
408
  auth: {
409
409
  auth: { bearer: '[0]' },
@@ -442,7 +442,7 @@ module.exports = ({ strapi }) => {
442
442
  break;
443
443
  }
444
444
  case 'cas': {
445
- const provider_url = 'https://' + _.get(grant['cas'], 'subdomain');
445
+ const provider_url = 'https://' + _.get(providers.cas, 'subdomain');
446
446
  const cas = purest({
447
447
  provider: 'cas',
448
448
  config: {
@@ -551,7 +551,7 @@ module.exports = ({ strapi }) => {
551
551
  }
552
552
 
553
553
  if (
554
- !_.isEmpty(_.find(users, (user) => user.provider !== provider)) &&
554
+ !_.isEmpty(_.find(users, user => user.provider !== provider)) &&
555
555
  advanced.unique_email
556
556
  ) {
557
557
  return resolve([