strapi-custom-auth 1.2.30 → 1.2.31
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 +22 -10
- package/dist/server/index.mjs +22 -10
- 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,9 @@ 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({
|
|
3023
|
+
id: activateUser.id
|
|
3024
|
+
});
|
|
3023
3025
|
} else {
|
|
3024
3026
|
const cognitoRoles = await roleService.cognitoRoles();
|
|
3025
3027
|
const roles2 = cognitoRoles && cognitoRoles["roles"] ? cognitoRoles["roles"].map((role2) => ({
|
|
@@ -3033,7 +3035,9 @@ async function cognitoSignInCallback(ctx) {
|
|
|
3033
3035
|
defaultLocale,
|
|
3034
3036
|
roles2
|
|
3035
3037
|
);
|
|
3036
|
-
jwtToken =
|
|
3038
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue({
|
|
3039
|
+
id: activateUser.id
|
|
3040
|
+
});
|
|
3037
3041
|
await oauthService.triggerWebHook(activateUser);
|
|
3038
3042
|
}
|
|
3039
3043
|
oauthService.triggerSignInSuccess(activateUser);
|
|
@@ -3096,7 +3100,7 @@ async function customSignIn(ctx) {
|
|
|
3096
3100
|
}
|
|
3097
3101
|
async function customSignInCallback(ctx) {
|
|
3098
3102
|
const userService = strapi.service("admin::user");
|
|
3099
|
-
|
|
3103
|
+
strapi.service("admin::token");
|
|
3100
3104
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
3101
3105
|
const nonce = v4$1();
|
|
3102
3106
|
try {
|
|
@@ -3108,7 +3112,9 @@ async function customSignInCallback(ctx) {
|
|
|
3108
3112
|
}
|
|
3109
3113
|
if (dbUser) {
|
|
3110
3114
|
activateUser = dbUser;
|
|
3111
|
-
jwtToken =
|
|
3115
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue({
|
|
3116
|
+
id: activateUser.id
|
|
3117
|
+
});
|
|
3112
3118
|
}
|
|
3113
3119
|
oauthService.triggerSignInSuccess(activateUser);
|
|
3114
3120
|
const html = oauthService.renderSignUpSuccess(jwtToken, activateUser, nonce);
|
|
@@ -3177,7 +3183,7 @@ async function customSignInMfa(ctx) {
|
|
|
3177
3183
|
}
|
|
3178
3184
|
}
|
|
3179
3185
|
async function customConfirmMfa(ctx) {
|
|
3180
|
-
|
|
3186
|
+
strapi.service("admin::token");
|
|
3181
3187
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
3182
3188
|
const nonce = v4$1();
|
|
3183
3189
|
const { code, id, uid } = ctx.query;
|
|
@@ -3199,7 +3205,9 @@ async function customConfirmMfa(ctx) {
|
|
|
3199
3205
|
if (!otp2) {
|
|
3200
3206
|
throw new Error("Invalid code");
|
|
3201
3207
|
}
|
|
3202
|
-
jwtToken =
|
|
3208
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue({
|
|
3209
|
+
id: otp2.user.id
|
|
3210
|
+
});
|
|
3203
3211
|
await strapi.query("plugin::strapi-custom-auth.mfaotp").delete({
|
|
3204
3212
|
where: {
|
|
3205
3213
|
id
|
|
@@ -3282,7 +3290,7 @@ async function microsoftSignInCallback(ctx) {
|
|
|
3282
3290
|
console.log("[STRAPI-CUSTOM-AUTH] Enter");
|
|
3283
3291
|
const config2 = configValidation();
|
|
3284
3292
|
const userService = strapi.service("admin::user");
|
|
3285
|
-
|
|
3293
|
+
strapi.service("admin::token");
|
|
3286
3294
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
3287
3295
|
const roleService = strapi.plugin("strapi-custom-auth").service("role");
|
|
3288
3296
|
console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback query code:", ctx?.query?.code);
|
|
@@ -3357,14 +3365,18 @@ async function microsoftSignInCallback(ctx) {
|
|
|
3357
3365
|
} else {
|
|
3358
3366
|
activateUser = dbUser;
|
|
3359
3367
|
}
|
|
3360
|
-
jwtToken =
|
|
3368
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue({
|
|
3369
|
+
id: activateUser.id
|
|
3370
|
+
});
|
|
3361
3371
|
} else {
|
|
3362
3372
|
console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback: user does not exist, creating it");
|
|
3363
3373
|
const roles2 = await roleService.retrieveMicrosoftUserRoles(groupResponse, config2);
|
|
3364
3374
|
const defaultLocale = oauthService.localeFindByHeader(ctx.request.headers);
|
|
3365
3375
|
activateUser = await oauthService.createUser(mail, surname, givenName, defaultLocale, roles2);
|
|
3366
3376
|
console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback: user created, generating token");
|
|
3367
|
-
jwtToken =
|
|
3377
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue({
|
|
3378
|
+
id: activateUser.id
|
|
3379
|
+
});
|
|
3368
3380
|
}
|
|
3369
3381
|
oauthService.triggerSignInSuccess(activateUser);
|
|
3370
3382
|
const nonce = v4();
|
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,9 @@ 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({
|
|
3008
|
+
id: activateUser.id
|
|
3009
|
+
});
|
|
3008
3010
|
} else {
|
|
3009
3011
|
const cognitoRoles = await roleService.cognitoRoles();
|
|
3010
3012
|
const roles2 = cognitoRoles && cognitoRoles["roles"] ? cognitoRoles["roles"].map((role2) => ({
|
|
@@ -3018,7 +3020,9 @@ async function cognitoSignInCallback(ctx) {
|
|
|
3018
3020
|
defaultLocale,
|
|
3019
3021
|
roles2
|
|
3020
3022
|
);
|
|
3021
|
-
jwtToken =
|
|
3023
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue({
|
|
3024
|
+
id: activateUser.id
|
|
3025
|
+
});
|
|
3022
3026
|
await oauthService.triggerWebHook(activateUser);
|
|
3023
3027
|
}
|
|
3024
3028
|
oauthService.triggerSignInSuccess(activateUser);
|
|
@@ -3081,7 +3085,7 @@ async function customSignIn(ctx) {
|
|
|
3081
3085
|
}
|
|
3082
3086
|
async function customSignInCallback(ctx) {
|
|
3083
3087
|
const userService = strapi.service("admin::user");
|
|
3084
|
-
|
|
3088
|
+
strapi.service("admin::token");
|
|
3085
3089
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
3086
3090
|
const nonce = v4$1();
|
|
3087
3091
|
try {
|
|
@@ -3093,7 +3097,9 @@ async function customSignInCallback(ctx) {
|
|
|
3093
3097
|
}
|
|
3094
3098
|
if (dbUser) {
|
|
3095
3099
|
activateUser = dbUser;
|
|
3096
|
-
jwtToken =
|
|
3100
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue({
|
|
3101
|
+
id: activateUser.id
|
|
3102
|
+
});
|
|
3097
3103
|
}
|
|
3098
3104
|
oauthService.triggerSignInSuccess(activateUser);
|
|
3099
3105
|
const html = oauthService.renderSignUpSuccess(jwtToken, activateUser, nonce);
|
|
@@ -3162,7 +3168,7 @@ async function customSignInMfa(ctx) {
|
|
|
3162
3168
|
}
|
|
3163
3169
|
}
|
|
3164
3170
|
async function customConfirmMfa(ctx) {
|
|
3165
|
-
|
|
3171
|
+
strapi.service("admin::token");
|
|
3166
3172
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
3167
3173
|
const nonce = v4$1();
|
|
3168
3174
|
const { code, id, uid } = ctx.query;
|
|
@@ -3184,7 +3190,9 @@ async function customConfirmMfa(ctx) {
|
|
|
3184
3190
|
if (!otp2) {
|
|
3185
3191
|
throw new Error("Invalid code");
|
|
3186
3192
|
}
|
|
3187
|
-
jwtToken =
|
|
3193
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue({
|
|
3194
|
+
id: otp2.user.id
|
|
3195
|
+
});
|
|
3188
3196
|
await strapi.query("plugin::strapi-custom-auth.mfaotp").delete({
|
|
3189
3197
|
where: {
|
|
3190
3198
|
id
|
|
@@ -3267,7 +3275,7 @@ async function microsoftSignInCallback(ctx) {
|
|
|
3267
3275
|
console.log("[STRAPI-CUSTOM-AUTH] Enter");
|
|
3268
3276
|
const config2 = configValidation();
|
|
3269
3277
|
const userService = strapi.service("admin::user");
|
|
3270
|
-
|
|
3278
|
+
strapi.service("admin::token");
|
|
3271
3279
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
3272
3280
|
const roleService = strapi.plugin("strapi-custom-auth").service("role");
|
|
3273
3281
|
console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback query code:", ctx?.query?.code);
|
|
@@ -3342,14 +3350,18 @@ async function microsoftSignInCallback(ctx) {
|
|
|
3342
3350
|
} else {
|
|
3343
3351
|
activateUser = dbUser;
|
|
3344
3352
|
}
|
|
3345
|
-
jwtToken =
|
|
3353
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue({
|
|
3354
|
+
id: activateUser.id
|
|
3355
|
+
});
|
|
3346
3356
|
} else {
|
|
3347
3357
|
console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback: user does not exist, creating it");
|
|
3348
3358
|
const roles2 = await roleService.retrieveMicrosoftUserRoles(groupResponse, config2);
|
|
3349
3359
|
const defaultLocale = oauthService.localeFindByHeader(ctx.request.headers);
|
|
3350
3360
|
activateUser = await oauthService.createUser(mail, surname, givenName, defaultLocale, roles2);
|
|
3351
3361
|
console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback: user created, generating token");
|
|
3352
|
-
jwtToken =
|
|
3362
|
+
jwtToken = strapi.plugins["users-permissions"].services.jwt.issue({
|
|
3363
|
+
id: activateUser.id
|
|
3364
|
+
});
|
|
3353
3365
|
}
|
|
3354
3366
|
oauthService.triggerSignInSuccess(activateUser);
|
|
3355
3367
|
const nonce = v4();
|
package/package.json
CHANGED