strapi-custom-auth 1.2.21 → 1.2.22
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 +21 -0
- package/dist/server/index.mjs +21 -0
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -2982,6 +2982,7 @@ async function cognitoSignInCallback(ctx) {
|
|
|
2982
2982
|
const userService = strapi.service("admin::user");
|
|
2983
2983
|
const tokenService = strapi.service("admin::token");
|
|
2984
2984
|
console.log("---tokenService---", tokenService);
|
|
2985
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
2985
2986
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
2986
2987
|
const roleService = strapi.plugin("strapi-custom-auth").service("role");
|
|
2987
2988
|
if (!ctx.query.code) {
|
|
@@ -3020,6 +3021,8 @@ async function cognitoSignInCallback(ctx) {
|
|
|
3020
3021
|
let jwtToken;
|
|
3021
3022
|
if (dbUser) {
|
|
3022
3023
|
activateUser = dbUser;
|
|
3024
|
+
console.log("---tokenService---", tokenService);
|
|
3025
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
3023
3026
|
jwtToken = await tokenService.createJwtToken(dbUser);
|
|
3024
3027
|
} else {
|
|
3025
3028
|
const cognitoRoles = await roleService.cognitoRoles();
|
|
@@ -3034,6 +3037,8 @@ async function cognitoSignInCallback(ctx) {
|
|
|
3034
3037
|
defaultLocale,
|
|
3035
3038
|
roles2
|
|
3036
3039
|
);
|
|
3040
|
+
console.log("---tokenService---", tokenService);
|
|
3041
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
3037
3042
|
jwtToken = await tokenService.createJwtToken(activateUser);
|
|
3038
3043
|
await oauthService.triggerWebHook(activateUser);
|
|
3039
3044
|
}
|
|
@@ -3098,6 +3103,8 @@ async function customSignIn(ctx) {
|
|
|
3098
3103
|
async function customSignInCallback(ctx) {
|
|
3099
3104
|
const userService = strapi.service("admin::user");
|
|
3100
3105
|
const tokenService = strapi.service("admin::token");
|
|
3106
|
+
console.log("---tokenService---", tokenService);
|
|
3107
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
3101
3108
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
3102
3109
|
const nonce = v4$1();
|
|
3103
3110
|
try {
|
|
@@ -3109,6 +3116,8 @@ async function customSignInCallback(ctx) {
|
|
|
3109
3116
|
}
|
|
3110
3117
|
if (dbUser) {
|
|
3111
3118
|
activateUser = dbUser;
|
|
3119
|
+
console.log("---tokenService---", tokenService);
|
|
3120
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
3112
3121
|
jwtToken = await tokenService.createJwtToken(dbUser);
|
|
3113
3122
|
}
|
|
3114
3123
|
oauthService.triggerSignInSuccess(activateUser);
|
|
@@ -3179,6 +3188,8 @@ async function customSignInMfa(ctx) {
|
|
|
3179
3188
|
}
|
|
3180
3189
|
async function customConfirmMfa(ctx) {
|
|
3181
3190
|
const tokenService = strapi.service("admin::token");
|
|
3191
|
+
console.log("---tokenService---", tokenService);
|
|
3192
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
3182
3193
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
3183
3194
|
const nonce = v4$1();
|
|
3184
3195
|
const { code, id, uid } = ctx.query;
|
|
@@ -3200,6 +3211,8 @@ async function customConfirmMfa(ctx) {
|
|
|
3200
3211
|
if (!otp2) {
|
|
3201
3212
|
throw new Error("Invalid code");
|
|
3202
3213
|
}
|
|
3214
|
+
console.log("---tokenService---", tokenService);
|
|
3215
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
3203
3216
|
jwtToken = await tokenService.createJwtToken(otp2.user);
|
|
3204
3217
|
await strapi.query("plugin::strapi-custom-auth.mfaotp").delete({
|
|
3205
3218
|
where: {
|
|
@@ -3283,6 +3296,8 @@ async function microsoftSignInCallback(ctx) {
|
|
|
3283
3296
|
const config2 = configValidation();
|
|
3284
3297
|
const userService = strapi.service("admin::user");
|
|
3285
3298
|
const tokenService = strapi.service("admin::token");
|
|
3299
|
+
console.log("---tokenService---", tokenService);
|
|
3300
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
3286
3301
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
3287
3302
|
const roleService = strapi.plugin("strapi-custom-auth").service("role");
|
|
3288
3303
|
console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback query code:", ctx?.query?.code);
|
|
@@ -3364,6 +3379,8 @@ async function microsoftSignInCallback(ctx) {
|
|
|
3364
3379
|
const defaultLocale = oauthService.localeFindByHeader(ctx.request.headers);
|
|
3365
3380
|
activateUser = await oauthService.createUser(mail, surname, givenName, defaultLocale, roles2);
|
|
3366
3381
|
console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback: user created, generating token");
|
|
3382
|
+
console.log("---tokenService---", tokenService);
|
|
3383
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
3367
3384
|
jwtToken = await tokenService.createJwtToken(activateUser);
|
|
3368
3385
|
}
|
|
3369
3386
|
oauthService.triggerSignInSuccess(activateUser);
|
|
@@ -3392,6 +3409,8 @@ async function microsoftLogout(ctx) {
|
|
|
3392
3409
|
async function microsoftTokenRenewal(ctx) {
|
|
3393
3410
|
const userService = strapi.service("admin::user");
|
|
3394
3411
|
const tokenService = strapi.service("admin::token");
|
|
3412
|
+
console.log("---tokenService---", tokenService);
|
|
3413
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
3395
3414
|
const config2 = configValidation();
|
|
3396
3415
|
const { body } = ctx.request;
|
|
3397
3416
|
const params = new URLSearchParams();
|
|
@@ -3416,6 +3435,8 @@ async function microsoftTokenRenewal(ctx) {
|
|
|
3416
3435
|
});
|
|
3417
3436
|
const { mail } = userResponse?.data;
|
|
3418
3437
|
const dbUser = await userService.findOneByEmail(mail);
|
|
3438
|
+
console.log("---tokenService---", tokenService);
|
|
3439
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
3419
3440
|
const jwtToken = await tokenService.createJwtToken(dbUser);
|
|
3420
3441
|
return ctx.send({ accessToken: jwtToken, refreshToken: tokenResponse.data.refresh_token });
|
|
3421
3442
|
} catch (e2) {
|
package/dist/server/index.mjs
CHANGED
|
@@ -2967,6 +2967,7 @@ async function cognitoSignInCallback(ctx) {
|
|
|
2967
2967
|
const userService = strapi.service("admin::user");
|
|
2968
2968
|
const tokenService = strapi.service("admin::token");
|
|
2969
2969
|
console.log("---tokenService---", tokenService);
|
|
2970
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
2970
2971
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
2971
2972
|
const roleService = strapi.plugin("strapi-custom-auth").service("role");
|
|
2972
2973
|
if (!ctx.query.code) {
|
|
@@ -3005,6 +3006,8 @@ async function cognitoSignInCallback(ctx) {
|
|
|
3005
3006
|
let jwtToken;
|
|
3006
3007
|
if (dbUser) {
|
|
3007
3008
|
activateUser = dbUser;
|
|
3009
|
+
console.log("---tokenService---", tokenService);
|
|
3010
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
3008
3011
|
jwtToken = await tokenService.createJwtToken(dbUser);
|
|
3009
3012
|
} else {
|
|
3010
3013
|
const cognitoRoles = await roleService.cognitoRoles();
|
|
@@ -3019,6 +3022,8 @@ async function cognitoSignInCallback(ctx) {
|
|
|
3019
3022
|
defaultLocale,
|
|
3020
3023
|
roles2
|
|
3021
3024
|
);
|
|
3025
|
+
console.log("---tokenService---", tokenService);
|
|
3026
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
3022
3027
|
jwtToken = await tokenService.createJwtToken(activateUser);
|
|
3023
3028
|
await oauthService.triggerWebHook(activateUser);
|
|
3024
3029
|
}
|
|
@@ -3083,6 +3088,8 @@ async function customSignIn(ctx) {
|
|
|
3083
3088
|
async function customSignInCallback(ctx) {
|
|
3084
3089
|
const userService = strapi.service("admin::user");
|
|
3085
3090
|
const tokenService = strapi.service("admin::token");
|
|
3091
|
+
console.log("---tokenService---", tokenService);
|
|
3092
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
3086
3093
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
3087
3094
|
const nonce = v4$1();
|
|
3088
3095
|
try {
|
|
@@ -3094,6 +3101,8 @@ async function customSignInCallback(ctx) {
|
|
|
3094
3101
|
}
|
|
3095
3102
|
if (dbUser) {
|
|
3096
3103
|
activateUser = dbUser;
|
|
3104
|
+
console.log("---tokenService---", tokenService);
|
|
3105
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
3097
3106
|
jwtToken = await tokenService.createJwtToken(dbUser);
|
|
3098
3107
|
}
|
|
3099
3108
|
oauthService.triggerSignInSuccess(activateUser);
|
|
@@ -3164,6 +3173,8 @@ async function customSignInMfa(ctx) {
|
|
|
3164
3173
|
}
|
|
3165
3174
|
async function customConfirmMfa(ctx) {
|
|
3166
3175
|
const tokenService = strapi.service("admin::token");
|
|
3176
|
+
console.log("---tokenService---", tokenService);
|
|
3177
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
3167
3178
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
3168
3179
|
const nonce = v4$1();
|
|
3169
3180
|
const { code, id, uid } = ctx.query;
|
|
@@ -3185,6 +3196,8 @@ async function customConfirmMfa(ctx) {
|
|
|
3185
3196
|
if (!otp2) {
|
|
3186
3197
|
throw new Error("Invalid code");
|
|
3187
3198
|
}
|
|
3199
|
+
console.log("---tokenService---", tokenService);
|
|
3200
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
3188
3201
|
jwtToken = await tokenService.createJwtToken(otp2.user);
|
|
3189
3202
|
await strapi.query("plugin::strapi-custom-auth.mfaotp").delete({
|
|
3190
3203
|
where: {
|
|
@@ -3268,6 +3281,8 @@ async function microsoftSignInCallback(ctx) {
|
|
|
3268
3281
|
const config2 = configValidation();
|
|
3269
3282
|
const userService = strapi.service("admin::user");
|
|
3270
3283
|
const tokenService = strapi.service("admin::token");
|
|
3284
|
+
console.log("---tokenService---", tokenService);
|
|
3285
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
3271
3286
|
const oauthService = strapi.plugin("strapi-custom-auth").service("oauth");
|
|
3272
3287
|
const roleService = strapi.plugin("strapi-custom-auth").service("role");
|
|
3273
3288
|
console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback query code:", ctx?.query?.code);
|
|
@@ -3349,6 +3364,8 @@ async function microsoftSignInCallback(ctx) {
|
|
|
3349
3364
|
const defaultLocale = oauthService.localeFindByHeader(ctx.request.headers);
|
|
3350
3365
|
activateUser = await oauthService.createUser(mail, surname, givenName, defaultLocale, roles2);
|
|
3351
3366
|
console.log("[STRAPI-CUSTOM-AUTH] Microsoft Sign Callback: user created, generating token");
|
|
3367
|
+
console.log("---tokenService---", tokenService);
|
|
3368
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
3352
3369
|
jwtToken = await tokenService.createJwtToken(activateUser);
|
|
3353
3370
|
}
|
|
3354
3371
|
oauthService.triggerSignInSuccess(activateUser);
|
|
@@ -3377,6 +3394,8 @@ async function microsoftLogout(ctx) {
|
|
|
3377
3394
|
async function microsoftTokenRenewal(ctx) {
|
|
3378
3395
|
const userService = strapi.service("admin::user");
|
|
3379
3396
|
const tokenService = strapi.service("admin::token");
|
|
3397
|
+
console.log("---tokenService---", tokenService);
|
|
3398
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
3380
3399
|
const config2 = configValidation();
|
|
3381
3400
|
const { body } = ctx.request;
|
|
3382
3401
|
const params = new URLSearchParams();
|
|
@@ -3401,6 +3420,8 @@ async function microsoftTokenRenewal(ctx) {
|
|
|
3401
3420
|
});
|
|
3402
3421
|
const { mail } = userResponse?.data;
|
|
3403
3422
|
const dbUser = await userService.findOneByEmail(mail);
|
|
3423
|
+
console.log("---tokenService---", tokenService);
|
|
3424
|
+
console.log("---tokenService---", JSON.stringify(tokenService));
|
|
3404
3425
|
const jwtToken = await tokenService.createJwtToken(dbUser);
|
|
3405
3426
|
return ctx.send({ accessToken: jwtToken, refreshToken: tokenResponse.data.refresh_token });
|
|
3406
3427
|
} catch (e2) {
|
package/package.json
CHANGED