strapi-custom-auth 1.2.30 → 1.2.32
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/dist/server/index.js +11 -13
- package/dist/server/index.mjs +11 -13
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -2980,7 +2980,7 @@ async function cognitoSignIn(ctx) {
|
|
|
2980
2980
|
async function cognitoSignInCallback(ctx) {
|
|
2981
2981
|
const config2 = configValidation$2();
|
|
2982
2982
|
const userService = strapi.service("admin::user");
|
|
2983
|
-
|
|
2983
|
+
strapi.service("admin::token");
|
|
2984
2984
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
2985
2985
|
const roleService = strapi.plugin("strapi-custom-auth").service("role");
|
|
2986
2986
|
if (!ctx.query.code) {
|
|
@@ -3019,7 +3019,7 @@ async function cognitoSignInCallback(ctx) {
|
|
|
3019
3019
|
let jwtToken;
|
|
3020
3020
|
if (dbUser) {
|
|
3021
3021
|
activateUser = dbUser;
|
|
3022
|
-
jwtToken =
|
|
3022
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue(dbUser);
|
|
3023
3023
|
} else {
|
|
3024
3024
|
const cognitoRoles = await roleService.cognitoRoles();
|
|
3025
3025
|
const roles2 = cognitoRoles && cognitoRoles["roles"] ? cognitoRoles["roles"].map((role2) => ({
|
|
@@ -3033,7 +3033,7 @@ async function cognitoSignInCallback(ctx) {
|
|
|
3033
3033
|
defaultLocale,
|
|
3034
3034
|
roles2
|
|
3035
3035
|
);
|
|
3036
|
-
jwtToken =
|
|
3036
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue(activateUser);
|
|
3037
3037
|
await oauthService.triggerWebHook(activateUser);
|
|
3038
3038
|
}
|
|
3039
3039
|
oauthService.triggerSignInSuccess(activateUser);
|
|
@@ -3096,7 +3096,7 @@ async function customSignIn(ctx) {
|
|
|
3096
3096
|
}
|
|
3097
3097
|
async function customSignInCallback(ctx) {
|
|
3098
3098
|
const userService = strapi.service("admin::user");
|
|
3099
|
-
|
|
3099
|
+
strapi.service("admin::token");
|
|
3100
3100
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
3101
3101
|
const nonce = v4$1();
|
|
3102
3102
|
try {
|
|
@@ -3108,7 +3108,7 @@ async function customSignInCallback(ctx) {
|
|
|
3108
3108
|
}
|
|
3109
3109
|
if (dbUser) {
|
|
3110
3110
|
activateUser = dbUser;
|
|
3111
|
-
jwtToken =
|
|
3111
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue(dbUser);
|
|
3112
3112
|
}
|
|
3113
3113
|
oauthService.triggerSignInSuccess(activateUser);
|
|
3114
3114
|
const html = oauthService.renderSignUpSuccess(jwtToken, activateUser, nonce);
|
|
@@ -3177,7 +3177,7 @@ async function customSignInMfa(ctx) {
|
|
|
3177
3177
|
}
|
|
3178
3178
|
}
|
|
3179
3179
|
async function customConfirmMfa(ctx) {
|
|
3180
|
-
|
|
3180
|
+
strapi.service("admin::token");
|
|
3181
3181
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
3182
3182
|
const nonce = v4$1();
|
|
3183
3183
|
const { code, id, uid } = ctx.query;
|
|
@@ -3199,7 +3199,7 @@ async function customConfirmMfa(ctx) {
|
|
|
3199
3199
|
if (!otp2) {
|
|
3200
3200
|
throw new Error("Invalid code");
|
|
3201
3201
|
}
|
|
3202
|
-
jwtToken =
|
|
3202
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue(otp2.user);
|
|
3203
3203
|
await strapi.query("plugin::strapi-custom-auth.mfaotp").delete({
|
|
3204
3204
|
where: {
|
|
3205
3205
|
id
|
|
@@ -3282,7 +3282,7 @@ async function microsoftSignInCallback(ctx) {
|
|
|
3282
3282
|
console.log("[STRAPI-CUSTOM-AUTH] Enter");
|
|
3283
3283
|
const config2 = configValidation();
|
|
3284
3284
|
const userService = strapi.service("admin::user");
|
|
3285
|
-
|
|
3285
|
+
strapi.service("admin::token");
|
|
3286
3286
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
3287
3287
|
const roleService = strapi.plugin("strapi-custom-auth").service("role");
|
|
3288
3288
|
console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback query code:", ctx?.query?.code);
|
|
@@ -3357,14 +3357,14 @@ async function microsoftSignInCallback(ctx) {
|
|
|
3357
3357
|
} else {
|
|
3358
3358
|
activateUser = dbUser;
|
|
3359
3359
|
}
|
|
3360
|
-
jwtToken =
|
|
3360
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue(activateUser);
|
|
3361
3361
|
} else {
|
|
3362
3362
|
console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback: user does not exist, creating it");
|
|
3363
3363
|
const roles2 = await roleService.retrieveMicrosoftUserRoles(groupResponse, config2);
|
|
3364
3364
|
const defaultLocale = oauthService.localeFindByHeader(ctx.request.headers);
|
|
3365
3365
|
activateUser = await oauthService.createUser(mail, surname, givenName, defaultLocale, roles2);
|
|
3366
3366
|
console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback: user created, generating token");
|
|
3367
|
-
jwtToken =
|
|
3367
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue(activateUser);
|
|
3368
3368
|
}
|
|
3369
3369
|
oauthService.triggerSignInSuccess(activateUser);
|
|
3370
3370
|
const nonce = v4();
|
|
@@ -3416,9 +3416,7 @@ async function microsoftTokenRenewal(ctx) {
|
|
|
3416
3416
|
});
|
|
3417
3417
|
const { mail } = userResponse?.data;
|
|
3418
3418
|
const dbUser = await userService.findOneByEmail(mail);
|
|
3419
|
-
const jwtToken = strapi.plugins["users-permissions"].services.jwt.issue(
|
|
3420
|
-
id: dbUser.id
|
|
3421
|
-
});
|
|
3419
|
+
const jwtToken = strapi.plugins["users-permissions"].services.jwt.issue(dbUser);
|
|
3422
3420
|
return ctx.send({ accessToken: jwtToken, refreshToken: tokenResponse.data.refresh_token });
|
|
3423
3421
|
} catch (e2) {
|
|
3424
3422
|
console.error(e2.message);
|
package/dist/server/index.mjs
CHANGED
|
@@ -2965,7 +2965,7 @@ async function cognitoSignIn(ctx) {
|
|
|
2965
2965
|
async function cognitoSignInCallback(ctx) {
|
|
2966
2966
|
const config2 = configValidation$2();
|
|
2967
2967
|
const userService = strapi.service("admin::user");
|
|
2968
|
-
|
|
2968
|
+
strapi.service("admin::token");
|
|
2969
2969
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
2970
2970
|
const roleService = strapi.plugin("strapi-custom-auth").service("role");
|
|
2971
2971
|
if (!ctx.query.code) {
|
|
@@ -3004,7 +3004,7 @@ async function cognitoSignInCallback(ctx) {
|
|
|
3004
3004
|
let jwtToken;
|
|
3005
3005
|
if (dbUser) {
|
|
3006
3006
|
activateUser = dbUser;
|
|
3007
|
-
jwtToken =
|
|
3007
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue(dbUser);
|
|
3008
3008
|
} else {
|
|
3009
3009
|
const cognitoRoles = await roleService.cognitoRoles();
|
|
3010
3010
|
const roles2 = cognitoRoles && cognitoRoles["roles"] ? cognitoRoles["roles"].map((role2) => ({
|
|
@@ -3018,7 +3018,7 @@ async function cognitoSignInCallback(ctx) {
|
|
|
3018
3018
|
defaultLocale,
|
|
3019
3019
|
roles2
|
|
3020
3020
|
);
|
|
3021
|
-
jwtToken =
|
|
3021
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue(activateUser);
|
|
3022
3022
|
await oauthService.triggerWebHook(activateUser);
|
|
3023
3023
|
}
|
|
3024
3024
|
oauthService.triggerSignInSuccess(activateUser);
|
|
@@ -3081,7 +3081,7 @@ async function customSignIn(ctx) {
|
|
|
3081
3081
|
}
|
|
3082
3082
|
async function customSignInCallback(ctx) {
|
|
3083
3083
|
const userService = strapi.service("admin::user");
|
|
3084
|
-
|
|
3084
|
+
strapi.service("admin::token");
|
|
3085
3085
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
3086
3086
|
const nonce = v4$1();
|
|
3087
3087
|
try {
|
|
@@ -3093,7 +3093,7 @@ async function customSignInCallback(ctx) {
|
|
|
3093
3093
|
}
|
|
3094
3094
|
if (dbUser) {
|
|
3095
3095
|
activateUser = dbUser;
|
|
3096
|
-
jwtToken =
|
|
3096
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue(dbUser);
|
|
3097
3097
|
}
|
|
3098
3098
|
oauthService.triggerSignInSuccess(activateUser);
|
|
3099
3099
|
const html = oauthService.renderSignUpSuccess(jwtToken, activateUser, nonce);
|
|
@@ -3162,7 +3162,7 @@ async function customSignInMfa(ctx) {
|
|
|
3162
3162
|
}
|
|
3163
3163
|
}
|
|
3164
3164
|
async function customConfirmMfa(ctx) {
|
|
3165
|
-
|
|
3165
|
+
strapi.service("admin::token");
|
|
3166
3166
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
3167
3167
|
const nonce = v4$1();
|
|
3168
3168
|
const { code, id, uid } = ctx.query;
|
|
@@ -3184,7 +3184,7 @@ async function customConfirmMfa(ctx) {
|
|
|
3184
3184
|
if (!otp2) {
|
|
3185
3185
|
throw new Error("Invalid code");
|
|
3186
3186
|
}
|
|
3187
|
-
jwtToken =
|
|
3187
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue(otp2.user);
|
|
3188
3188
|
await strapi.query("plugin::strapi-custom-auth.mfaotp").delete({
|
|
3189
3189
|
where: {
|
|
3190
3190
|
id
|
|
@@ -3267,7 +3267,7 @@ async function microsoftSignInCallback(ctx) {
|
|
|
3267
3267
|
console.log("[STRAPI-CUSTOM-AUTH] Enter");
|
|
3268
3268
|
const config2 = configValidation();
|
|
3269
3269
|
const userService = strapi.service("admin::user");
|
|
3270
|
-
|
|
3270
|
+
strapi.service("admin::token");
|
|
3271
3271
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
3272
3272
|
const roleService = strapi.plugin("strapi-custom-auth").service("role");
|
|
3273
3273
|
console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback query code:", ctx?.query?.code);
|
|
@@ -3342,14 +3342,14 @@ async function microsoftSignInCallback(ctx) {
|
|
|
3342
3342
|
} else {
|
|
3343
3343
|
activateUser = dbUser;
|
|
3344
3344
|
}
|
|
3345
|
-
jwtToken =
|
|
3345
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue(activateUser);
|
|
3346
3346
|
} else {
|
|
3347
3347
|
console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback: user does not exist, creating it");
|
|
3348
3348
|
const roles2 = await roleService.retrieveMicrosoftUserRoles(groupResponse, config2);
|
|
3349
3349
|
const defaultLocale = oauthService.localeFindByHeader(ctx.request.headers);
|
|
3350
3350
|
activateUser = await oauthService.createUser(mail, surname, givenName, defaultLocale, roles2);
|
|
3351
3351
|
console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback: user created, generating token");
|
|
3352
|
-
jwtToken =
|
|
3352
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue(activateUser);
|
|
3353
3353
|
}
|
|
3354
3354
|
oauthService.triggerSignInSuccess(activateUser);
|
|
3355
3355
|
const nonce = v4();
|
|
@@ -3401,9 +3401,7 @@ async function microsoftTokenRenewal(ctx) {
|
|
|
3401
3401
|
});
|
|
3402
3402
|
const { mail } = userResponse?.data;
|
|
3403
3403
|
const dbUser = await userService.findOneByEmail(mail);
|
|
3404
|
-
const jwtToken = strapi.plugins["users-permissions"].services.jwt.issue(
|
|
3405
|
-
id: dbUser.id
|
|
3406
|
-
});
|
|
3404
|
+
const jwtToken = strapi.plugins["users-permissions"].services.jwt.issue(dbUser);
|
|
3407
3405
|
return ctx.send({ accessToken: jwtToken, refreshToken: tokenResponse.data.refresh_token });
|
|
3408
3406
|
} catch (e2) {
|
|
3409
3407
|
console.error(e2.message);
|
package/package.json
CHANGED