mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(core): Use lower cased email for SAML email attribute (#6663)
lower case saml email attribute
This commit is contained in:
parent
0c47be254b
commit
eedde24cc0
|
@ -145,8 +145,9 @@ export class SamlService {
|
||||||
}> {
|
}> {
|
||||||
const attributes = await this.getAttributesFromLoginResponse(req, binding);
|
const attributes = await this.getAttributesFromLoginResponse(req, binding);
|
||||||
if (attributes.email) {
|
if (attributes.email) {
|
||||||
|
const lowerCasedEmail = attributes.email.toLowerCase();
|
||||||
const user = await Db.collections.User.findOne({
|
const user = await Db.collections.User.findOne({
|
||||||
where: { email: attributes.email },
|
where: { email: lowerCasedEmail },
|
||||||
relations: ['globalRole', 'authIdentities'],
|
relations: ['globalRole', 'authIdentities'],
|
||||||
});
|
});
|
||||||
if (user) {
|
if (user) {
|
||||||
|
|
|
@ -97,7 +97,8 @@ export function generatePassword(): string {
|
||||||
export async function createUserFromSamlAttributes(attributes: SamlUserAttributes): Promise<User> {
|
export async function createUserFromSamlAttributes(attributes: SamlUserAttributes): Promise<User> {
|
||||||
const user = new User();
|
const user = new User();
|
||||||
const authIdentity = new AuthIdentity();
|
const authIdentity = new AuthIdentity();
|
||||||
user.email = attributes.email;
|
const lowerCasedEmail = attributes.email?.toLowerCase() ?? '';
|
||||||
|
user.email = lowerCasedEmail;
|
||||||
user.firstName = attributes.firstName;
|
user.firstName = attributes.firstName;
|
||||||
user.lastName = attributes.lastName;
|
user.lastName = attributes.lastName;
|
||||||
user.globalRole = await Container.get(RoleRepository).findGlobalMemberRoleOrFail();
|
user.globalRole = await Container.get(RoleRepository).findGlobalMemberRoleOrFail();
|
||||||
|
|
Loading…
Reference in a new issue