Example #1
0
  @Override
  public void updateCredentialDirectly(UserCredentialValueModel credModel) {
    CredentialEntity credentialEntity = getCredentialEntity(user, credModel.getType());

    if (credentialEntity == null) {
      credentialEntity = new CredentialEntity();
      //    credentialEntity.setId(KeycloakModelUtils.generateId());
      credentialEntity.setType(credModel.getType());
      //    credentialEntity.setUser(user);
      credModel.setCreatedDate(credModel.getCreatedDate());
      user.getCredentials().add(credentialEntity);
    }

    credentialEntity.setValue(credModel.getValue());
    credentialEntity.setSalt(credModel.getSalt());
    credentialEntity.setDevice(credModel.getDevice());
    credentialEntity.setHashIterations(credModel.getHashIterations());
  }
Example #2
0
 private CredentialEntity setCredentials(UserEntity user, UserCredentialModel cred) {
   CredentialEntity credentialEntity = new CredentialEntity();
   credentialEntity.setType(cred.getType());
   credentialEntity.setDevice(cred.getDevice());
   return credentialEntity;
 }