org.keycloak.models.RealmModel.isDuplicateEmailsAllowed()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(64)

本文整理了Java中org.keycloak.models.RealmModel.isDuplicateEmailsAllowed方法的一些代码示例,展示了RealmModel.isDuplicateEmailsAllowed的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RealmModel.isDuplicateEmailsAllowed方法的具体详情如下:
包路径:org.keycloak.models.RealmModel
类名称:RealmModel
方法名:isDuplicateEmailsAllowed

RealmModel.isDuplicateEmailsAllowed介绍

暂无

代码示例

代码示例来源:origin: org.keycloak/keycloak-model-jpa

@Override
public void setEmail(String email) {
  email = KeycloakModelUtils.toLowerCaseSafe(email);
  user.setEmail(email, realm.isDuplicateEmailsAllowed());
}

代码示例来源:origin: org.keycloak/keycloak-model-infinispan

@Override
public boolean isDuplicateEmailsAllowed() {
  if (isUpdated()) return updated.isDuplicateEmailsAllowed();
  return cached.isDuplicateEmailsAllowed();
}

代码示例来源:origin: org.keycloak/keycloak-model-mongo

@Override
public void setEmail(String email) {
  email = KeycloakModelUtils.toLowerCaseSafe(email);
  user.setEmail(email, realm.isDuplicateEmailsAllowed());
  updateUser();
}

代码示例来源:origin: org.keycloak/keycloak-model-jpa

protected void ensureEmailConstraint(List<UserEntity> users, RealmModel realm) {
  UserEntity user = users.get(0);
  
  if (users.size() > 1) {
    // Realm settings have been changed from allowing duplicate emails to not allowing them
    // but duplicates haven't been removed.
    throw new ModelDuplicateException("Multiple users with email '" + user.getEmail() + "' exist in Keycloak.");
  }
  
  if (realm.isDuplicateEmailsAllowed()) {
    return;
  }
   if (user.getEmail() != null && !user.getEmail().equals(user.getEmailConstraint())) {
    // Realm settings have been changed from allowing duplicate emails to not allowing them.
    // We need to update the email constraint to reflect this change in the user entities.
    user.setEmailConstraint(user.getEmail());
    em.persist(user);
  }  
}

代码示例来源:origin: org.keycloak/keycloak-model-mongo

protected void ensureEmailConstraint(List<MongoUserEntity> users, RealmModel realm) {
    MongoUserEntity user = users.get(0);
    
    if (users.size() > 1) {
      // Realm settings have been changed from allowing duplicate emails to not allowing them
      // but duplicates haven't been removed.
      throw new ModelDuplicateException("Multiple users with email '" + user.getEmail() + "' exist in Keycloak.");
    }
    
    if (realm.isDuplicateEmailsAllowed()) {
      return;
    }
       if (user.getEmail() != null && user.getEmailIndex() == null) {
      // Realm settings have been changed from allowing duplicate emails to not allowing them.
      // We need to update the email index to reflect this change in the user entities.
      user.setEmail(user.getEmail(), false);
      getMongoStore().updateEntity(user, invocationContext);
    }  
  }
}

代码示例来源:origin: org.keycloak/keycloak-model-infinispan

verifyEmail = model.isVerifyEmail();
loginWithEmailAllowed = model.isLoginWithEmailAllowed();
duplicateEmailsAllowed = model.isDuplicateEmailsAllowed();
resetPasswordAllowed = model.isResetPasswordAllowed();
identityFederationEnabled = model.isIdentityFederationEnabled();

相关文章

微信公众号

最新文章

更多

RealmModel类方法