public void update(Map userCredentials) throws AuthenticationException {
      if (passwordFile == null) {
         throw new AuthenticationException("update()", new IllegalStateException());
      }
      try {
         String userName = (String) userCredentials.get(Registry.SASL_USERNAME);
         String password = (String) userCredentials.get(Registry.SASL_PASSWORD);
         String uid =      (String) userCredentials.get(CramMD5Registry.UID_FIELD);
         String gid =      (String) userCredentials.get(CramMD5Registry.GID_FIELD);
         String gecos =    (String) userCredentials.get(CramMD5Registry.GECOS_FIELD);
         String dir =      (String) userCredentials.get(CramMD5Registry.DIR_FIELD);
         String shell =    (String) userCredentials.get(CramMD5Registry.SHELL_FIELD);
         if (uid == null || gid == null || gecos == null || dir == null || shell == null) {
            passwordFile.changePasswd(userName, password);
         } else {
            String[] attributes = new String[] {uid, gid, gecos, dir, shell};
            passwordFile.add(userName, password, attributes);
         }
      } catch (Exception x) {
         if (x instanceof AuthenticationException) {
            throw (AuthenticationException) x;
         }
         throw new AuthenticationException("update()", x);
      }
   }