[keycloak-dev] Users with duplicated emails

Fabricio Milone fabricio.milone at shinetech.com
Sun Feb 14 23:51:04 EST 2016


Hi,

I've been trying to solve an issue with my Federator for a few days now
when I import users that don't exist in Keycloak (but they do exist in my
Federator DB).

I'm getting a duplicated value constraint violation error on
email_constraint attribute from user_entity table. So I looked into the
source code and found that the emailConstraint attribute is being set to
the email value when I'm calling UserEntity.setEmail(String email).

public void setEmail(String email) {
    this.email = email;
    this.emailConstraint = email != null ? email :
KeycloakModelUtils.generateId();
}


Also I saw this comment in UserEntity.java:64:

// Hack just to workaround the fact that on MS-SQL you can't have
unique constraint with multiple NULL values TODO: Find better solution
(like unique index with 'where' but that's proprietary)
@Column(name = "EMAIL_CONSTRAINT")
protected String emailConstraint = KeycloakModelUtils.generateId();


My system allows duplicated email addresses and that cannot change.

Is there any way to allow duplicated email addresses on Keycloak?
Are you planning on an improvement to add support for a configurable unique
key for users?
What would be the best way to get rid of that constraint?

As a reference, I'm using Keycloak 1.7.0 and Informix as a DB.

Any help would be appreciated.

Thanks in advance.

Regards,
Fab


-- 
*Fabricio Milone*
Developer

*Shine Consulting *

30/600 Bourke Street

Melbourne VIC 3000

T: 03 8488 9939

M: 04 3200 4006


www.shinetech.com  *a* passion for excellence
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-dev/attachments/20160215/6e4af81a/attachment-0001.html 


More information about the keycloak-dev mailing list