@Transactional
  public void removeAuthentication(UserEntity userEntity, Long authenticationId) {
    if ((userEntity != null) && (authenticationId != null)) {
      boolean changed = false;

      // Ensure we have a latest version of an attached UserEntity...
      userEntity = userDAO.findByPK(userEntity.getUserId());

      // Find the remove the specified UserAuthenticationEntity from the user's collection of
      // UserAuthenticationEntities
      List<UserAuthenticationEntity> authenticationEntities = userEntity.getAuthenticationEntities();
      Iterator<UserAuthenticationEntity> iterator = authenticationEntities.iterator();
      while (iterator.hasNext()) {
        UserAuthenticationEntity authenticationEntity = iterator.next();
        if (authenticationId.equals(authenticationEntity.getUserAuthenticationId())) {
          userAuthenticationDAO.remove(authenticationEntity);
          iterator.remove();
          changed = true;
          break;
        }
      }

      if (changed) {
        // Update the UserEntity to realize the changed set of authentication sources...
        userDAO.merge(userEntity);
      }
    }
  }
Modifies authentication key of an authentication source for a user

@throws AmbariException
ambari-server/src/main/java/org/apache/ambari/server/security/authorization/Users.java