Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
dba7864180
5 changed files with 43 additions and 18 deletions
|
@ -20,7 +20,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-10 col-md-10">
|
<div class="col-sm-10 col-md-10">
|
||||||
<input type="text" class="form-control" id="username" name="username" disabled="disabled" value="${account.username!''}"/>
|
<input type="text" class="form-control" id="username" name="username" disabled="disabled" value="${(account.username!'')?html}"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-10 col-md-10">
|
<div class="col-sm-10 col-md-10">
|
||||||
<input type="text" class="form-control" id="email" name="email" autofocus value="${account.email!''}"/>
|
<input type="text" class="form-control" id="email" name="email" autofocus value="${(account.email!'')?html}"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-10 col-md-10">
|
<div class="col-sm-10 col-md-10">
|
||||||
<input type="text" class="form-control" id="lastName" name="lastName" value="${account.lastName!''}"/>
|
<input type="text" class="form-control" id="lastName" name="lastName" value="${(account.lastName!'')?html}"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-sm-10 col-md-10">
|
<div class="col-sm-10 col-md-10">
|
||||||
<input type="text" class="form-control" id="firstName" name="firstName" value="${account.firstName!''}"/>
|
<input type="text" class="form-control" id="firstName" name="firstName" value="${(account.firstName!'')?html}"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<label for="email" class="${properties.kcLabelClass!}">${rb.email}</label>
|
<label for="email" class="${properties.kcLabelClass!}">${rb.email}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="${properties.kcInputWrapperClass!}">
|
<div class="${properties.kcInputWrapperClass!}">
|
||||||
<input type="text" id="email" name="email" value="${user.email!''}" class="${properties.kcInputClass!}" />
|
<input type="text" id="email" name="email" value="${(user.email!'')?html}" class="${properties.kcInputClass!}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
<label for="firstName" class="${properties.kcLabelClass!}">${rb.firstName}</label>
|
<label for="firstName" class="${properties.kcLabelClass!}">${rb.firstName}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="${properties.kcInputWrapperClass!}">
|
<div class="${properties.kcInputWrapperClass!}">
|
||||||
<input type="text" id="firstName" name="firstName" value="${user.firstName!''}" class="${properties.kcInputClass!}" />
|
<input type="text" id="firstName" name="firstName" value="${(user.firstName!'')?html}" class="${properties.kcInputClass!}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
<label for="lastName" class="${properties.kcLabelClass!}">${rb.lastName}</label>
|
<label for="lastName" class="${properties.kcLabelClass!}">${rb.lastName}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="${properties.kcInputWrapperClass!}">
|
<div class="${properties.kcInputWrapperClass!}">
|
||||||
<input type="text" id="lastName" name="lastName" value="${user.lastName!''}" class="${properties.kcInputClass!}" />
|
<input type="text" id="lastName" name="lastName" value="${(user.lastName!'')?html}" class="${properties.kcInputClass!}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="${properties.kcInputWrapperClass!}">
|
<div class="${properties.kcInputWrapperClass!}">
|
||||||
<input id="username" class="${properties.kcInputClass!}" name="username" value="${login.username!''}" type="text" autofocus />
|
<input id="username" class="${properties.kcInputClass!}" name="username" value="${(login.username!'')?html}" type="text" autofocus />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<label for="username" class="${properties.kcLabelClass!}">${rb.username}</label>
|
<label for="username" class="${properties.kcLabelClass!}">${rb.username}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="${properties.kcInputWrapperClass!}">
|
<div class="${properties.kcInputWrapperClass!}">
|
||||||
<input type="text" id="username" class="${properties.kcInputClass!}" name="username" value="${register.formData.username!''}" />
|
<input type="text" id="username" class="${properties.kcInputClass!}" name="username" value="${(register.formData.username!'')?html}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
<label for="firstName" class="${properties.kcLabelClass!}">${rb.firstName}</label>
|
<label for="firstName" class="${properties.kcLabelClass!}">${rb.firstName}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="${properties.kcInputWrapperClass!}">
|
<div class="${properties.kcInputWrapperClass!}">
|
||||||
<input type="text" id="firstName" class="${properties.kcInputClass!}" name="firstName" value="${register.formData.firstName!''}" />
|
<input type="text" id="firstName" class="${properties.kcInputClass!}" name="firstName" value="${(register.formData.firstName!'')?html}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
<label for="lastName" class="${properties.kcLabelClass!}">${rb.lastName}</label>
|
<label for="lastName" class="${properties.kcLabelClass!}">${rb.lastName}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="${properties.kcInputWrapperClass!}">
|
<div class="${properties.kcInputWrapperClass!}">
|
||||||
<input type="text" id="lastName" class="${properties.kcInputClass!}" name="lastName" value="${register.formData.lastName!''}" />
|
<input type="text" id="lastName" class="${properties.kcInputClass!}" name="lastName" value="${(register.formData.lastName!'')?html}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
<label for="email" class="${properties.kcLabelClass!}">${rb.email}</label>
|
<label for="email" class="${properties.kcLabelClass!}">${rb.email}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="${properties.kcInputWrapperClass!}">
|
<div class="${properties.kcInputWrapperClass!}">
|
||||||
<input type="text" id="email" class="${properties.kcInputClass!}" name="email" value="${register.formData.email!''}" />
|
<input type="text" id="email" class="${properties.kcInputClass!}" name="email" value="${(register.formData.email!'')?html}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,9 @@ public class InfinispanCacheUserProviderFactory implements CacheUserProviderFact
|
||||||
|
|
||||||
protected final RealmLookup emailLookup = new RealmLookup();
|
protected final RealmLookup emailLookup = new RealmLookup();
|
||||||
|
|
||||||
|
// Method CacheEntryCreatedEvent.getValue is available from ispn 6 (EAP6 and AS7 are on ispn 5)
|
||||||
|
private boolean isNewInfinispan;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CacheUserProvider create(KeycloakSession session) {
|
public CacheUserProvider create(KeycloakSession session) {
|
||||||
lazyInit(session);
|
lazyInit(session);
|
||||||
|
@ -37,6 +40,7 @@ public class InfinispanCacheUserProviderFactory implements CacheUserProviderFact
|
||||||
if (userCache == null) {
|
if (userCache == null) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (userCache == null) {
|
if (userCache == null) {
|
||||||
|
checkIspnVersion();
|
||||||
Cache<String, CachedUser> cache = session.getProvider(InfinispanConnectionProvider.class).getCache("users");
|
Cache<String, CachedUser> cache = session.getProvider(InfinispanConnectionProvider.class).getCache("users");
|
||||||
cache.addListener(new CacheListener());
|
cache.addListener(new CacheListener());
|
||||||
userCache = new InfinispanUserCache(cache, usernameLookup, emailLookup);
|
userCache = new InfinispanUserCache(cache, usernameLookup, emailLookup);
|
||||||
|
@ -45,6 +49,15 @@ public class InfinispanCacheUserProviderFactory implements CacheUserProviderFact
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void checkIspnVersion() {
|
||||||
|
try {
|
||||||
|
CacheEntryCreatedEvent.class.getMethod("getValue");
|
||||||
|
isNewInfinispan = true;
|
||||||
|
} catch (NoSuchMethodException nsme) {
|
||||||
|
isNewInfinispan = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(Config.Scope config) {
|
public void init(Config.Scope config) {
|
||||||
}
|
}
|
||||||
|
@ -63,12 +76,24 @@ public class InfinispanCacheUserProviderFactory implements CacheUserProviderFact
|
||||||
|
|
||||||
@CacheEntryCreated
|
@CacheEntryCreated
|
||||||
public void userCreated(CacheEntryCreatedEvent<String, CachedUser> event) {
|
public void userCreated(CacheEntryCreatedEvent<String, CachedUser> event) {
|
||||||
if (!event.isPre() && event.getValue() != null) {
|
if (!event.isPre()) {
|
||||||
CachedUser cachedUser = event.getValue();
|
|
||||||
String realm = cachedUser.getRealm();
|
CachedUser cachedUser;
|
||||||
usernameLookup.put(realm, cachedUser.getUsername(), cachedUser.getId());
|
|
||||||
if (cachedUser.getEmail() != null) {
|
// Try optimized version if available
|
||||||
emailLookup.put(realm, cachedUser.getEmail(), cachedUser.getId());
|
if (isNewInfinispan) {
|
||||||
|
cachedUser = event.getValue();
|
||||||
|
} else {
|
||||||
|
String userId = event.getKey();
|
||||||
|
cachedUser = event.getCache().get(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cachedUser != null) {
|
||||||
|
String realm = cachedUser.getRealm();
|
||||||
|
usernameLookup.put(realm, cachedUser.getUsername(), cachedUser.getId());
|
||||||
|
if (cachedUser.getEmail() != null) {
|
||||||
|
emailLookup.put(realm, cachedUser.getEmail(), cachedUser.getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue