mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(core): Skip SAML onboarding for users with first- and lastname (#5966)
skip onboarding for users with first- and lastname
This commit is contained in:
parent
02ab1e7eef
commit
8474cd386d
|
@ -104,7 +104,7 @@ export class SamlController {
|
||||||
private async acsHandler(req: express.Request, res: express.Response, binding: SamlLoginBinding) {
|
private async acsHandler(req: express.Request, res: express.Response, binding: SamlLoginBinding) {
|
||||||
const loginResult = await this.samlService.handleSamlLogin(req, binding);
|
const loginResult = await this.samlService.handleSamlLogin(req, binding);
|
||||||
if (loginResult) {
|
if (loginResult) {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
// return attributes if this is a test connection
|
||||||
if (req.body.RelayState && req.body.RelayState === getServiceProviderConfigTestReturnUrl()) {
|
if (req.body.RelayState && req.body.RelayState === getServiceProviderConfigTestReturnUrl()) {
|
||||||
return res.status(202).send(loginResult.attributes);
|
return res.status(202).send(loginResult.attributes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ export class SamlService {
|
||||||
relations: ['globalRole', 'authIdentities'],
|
relations: ['globalRole', 'authIdentities'],
|
||||||
});
|
});
|
||||||
if (user) {
|
if (user) {
|
||||||
// Login path for existing users that are fully set up
|
// Login path for existing users that are fully set up and that have a SAML authIdentity set up
|
||||||
if (
|
if (
|
||||||
user.authIdentities.find(
|
user.authIdentities.find(
|
||||||
(e) => e.providerType === 'saml' && e.providerId === attributes.userPrincipalName,
|
(e) => e.providerType === 'saml' && e.providerId === attributes.userPrincipalName,
|
||||||
|
@ -168,10 +168,11 @@ export class SamlService {
|
||||||
} else {
|
} else {
|
||||||
// Login path for existing users that are NOT fully set up for SAML
|
// Login path for existing users that are NOT fully set up for SAML
|
||||||
const updatedUser = await updateUserFromSamlAttributes(user, attributes);
|
const updatedUser = await updateUserFromSamlAttributes(user, attributes);
|
||||||
|
const onboardingRequired = !updatedUser.firstName || !updatedUser.lastName;
|
||||||
return {
|
return {
|
||||||
authenticatedUser: updatedUser,
|
authenticatedUser: updatedUser,
|
||||||
attributes,
|
attributes,
|
||||||
onboardingRequired: true,
|
onboardingRequired,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue