mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Merge pull request #4343 from Infisical/fix/oauth-issue
feat: oauth error resolved due to srp removal
This commit is contained in:
@@ -557,14 +557,13 @@ export const ldapConfigServiceFactory = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const isUserCompleted = Boolean(user.isAccepted);
|
const isUserCompleted = Boolean(user.isAccepted);
|
||||||
const userEnc = await userDAL.findUserEncKeyByUserId(user.id);
|
|
||||||
|
|
||||||
const providerAuthToken = crypto.jwt().sign(
|
const providerAuthToken = crypto.jwt().sign(
|
||||||
{
|
{
|
||||||
authTokenType: AuthTokenType.PROVIDER_TOKEN,
|
authTokenType: AuthTokenType.PROVIDER_TOKEN,
|
||||||
userId: user.id,
|
userId: user.id,
|
||||||
username: user.username,
|
username: user.username,
|
||||||
hasExchangedPrivateKey: Boolean(userEnc?.serverEncryptedPrivateKey),
|
hasExchangedPrivateKey: true,
|
||||||
...(user.email && { email: user.email, isEmailVerified: user.isEmailVerified }),
|
...(user.email && { email: user.email, isEmailVerified: user.isEmailVerified }),
|
||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
|
|||||||
@@ -404,7 +404,6 @@ export const oidcConfigServiceFactory = ({
|
|||||||
|
|
||||||
await licenseService.updateSubscriptionOrgMemberCount(organization.id);
|
await licenseService.updateSubscriptionOrgMemberCount(organization.id);
|
||||||
|
|
||||||
const userEnc = await userDAL.findUserEncKeyByUserId(user.id);
|
|
||||||
const isUserCompleted = Boolean(user.isAccepted);
|
const isUserCompleted = Boolean(user.isAccepted);
|
||||||
const providerAuthToken = crypto.jwt().sign(
|
const providerAuthToken = crypto.jwt().sign(
|
||||||
{
|
{
|
||||||
@@ -417,7 +416,7 @@ export const oidcConfigServiceFactory = ({
|
|||||||
organizationName: organization.name,
|
organizationName: organization.name,
|
||||||
organizationId: organization.id,
|
organizationId: organization.id,
|
||||||
organizationSlug: organization.slug,
|
organizationSlug: organization.slug,
|
||||||
hasExchangedPrivateKey: Boolean(userEnc?.serverEncryptedPrivateKey),
|
hasExchangedPrivateKey: true,
|
||||||
authMethod: AuthMethod.OIDC,
|
authMethod: AuthMethod.OIDC,
|
||||||
authType: UserAliasType.OIDC,
|
authType: UserAliasType.OIDC,
|
||||||
isUserCompleted,
|
isUserCompleted,
|
||||||
|
|||||||
@@ -411,7 +411,6 @@ export const samlConfigServiceFactory = ({
|
|||||||
await licenseService.updateSubscriptionOrgMemberCount(organization.id);
|
await licenseService.updateSubscriptionOrgMemberCount(organization.id);
|
||||||
|
|
||||||
const isUserCompleted = Boolean(user.isAccepted && user.isEmailVerified);
|
const isUserCompleted = Boolean(user.isAccepted && user.isEmailVerified);
|
||||||
const userEnc = await userDAL.findUserEncKeyByUserId(user.id);
|
|
||||||
const providerAuthToken = crypto.jwt().sign(
|
const providerAuthToken = crypto.jwt().sign(
|
||||||
{
|
{
|
||||||
authTokenType: AuthTokenType.PROVIDER_TOKEN,
|
authTokenType: AuthTokenType.PROVIDER_TOKEN,
|
||||||
@@ -424,7 +423,7 @@ export const samlConfigServiceFactory = ({
|
|||||||
organizationId: organization.id,
|
organizationId: organization.id,
|
||||||
organizationSlug: organization.slug,
|
organizationSlug: organization.slug,
|
||||||
authMethod: authProvider,
|
authMethod: authProvider,
|
||||||
hasExchangedPrivateKey: Boolean(userEnc?.serverEncryptedPrivateKey),
|
hasExchangedPrivateKey: true,
|
||||||
authType: UserAliasType.SAML,
|
authType: UserAliasType.SAML,
|
||||||
isUserCompleted,
|
isUserCompleted,
|
||||||
...(relayState
|
...(relayState
|
||||||
|
|||||||
@@ -824,7 +824,6 @@ export const authLoginServiceFactory = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const userEnc = await userDAL.findUserEncKeyByUserId(user.id);
|
|
||||||
const isUserCompleted = user.isAccepted;
|
const isUserCompleted = user.isAccepted;
|
||||||
const providerAuthToken = crypto.jwt().sign(
|
const providerAuthToken = crypto.jwt().sign(
|
||||||
{
|
{
|
||||||
@@ -835,7 +834,7 @@ export const authLoginServiceFactory = ({
|
|||||||
isEmailVerified: user.isEmailVerified,
|
isEmailVerified: user.isEmailVerified,
|
||||||
firstName: user.firstName,
|
firstName: user.firstName,
|
||||||
lastName: user.lastName,
|
lastName: user.lastName,
|
||||||
hasExchangedPrivateKey: Boolean(userEnc?.serverEncryptedPrivateKey),
|
hasExchangedPrivateKey: true,
|
||||||
authMethod,
|
authMethod,
|
||||||
isUserCompleted,
|
isUserCompleted,
|
||||||
...(callbackPort
|
...(callbackPort
|
||||||
@@ -880,8 +879,7 @@ export const authLoginServiceFactory = ({
|
|||||||
const userEnc =
|
const userEnc =
|
||||||
usersByUsername?.length > 1 ? usersByUsername.find((el) => el.username === email) : usersByUsername?.[0];
|
usersByUsername?.length > 1 ? usersByUsername.find((el) => el.username === email) : usersByUsername?.[0];
|
||||||
|
|
||||||
if (!userEnc?.serverEncryptedPrivateKey)
|
if (!userEnc) throw new BadRequestError({ message: "User encryption not found" });
|
||||||
throw new BadRequestError({ message: "Key handoff incomplete. Please try logging in again." });
|
|
||||||
|
|
||||||
const token = await generateUserTokens({
|
const token = await generateUserTokens({
|
||||||
user: { ...userEnc, id: userEnc.userId },
|
user: { ...userEnc, id: userEnc.userId },
|
||||||
|
|||||||
Reference in New Issue
Block a user