private String copyCallbackValues(Callback[] srcInstances, Callback[] destInstances,
			GhidraPrincipal principal) throws IOException {
		PasswordCallback srcPcb =
			AuthenticationModule.getFirstCallbackOfType(PasswordCallback.class, srcInstances);
		NameCallback srcNcb =
			AuthenticationModule.getFirstCallbackOfType(NameCallback.class, srcInstances);

		String userName = null;
		NameCallback destNcb =
			AuthenticationModule.getFirstCallbackOfType(NameCallback.class, destInstances);
		if (destNcb != null) {
			userName =
				(allowUserToSpecifyName && srcNcb != null) ? srcNcb.getName() : principal.getName();
			destNcb.setName(userName);
		}

		PasswordCallback destPcb =
			AuthenticationModule.getFirstCallbackOfType(PasswordCallback.class, destInstances);
		if (destPcb != null) {
			if (srcPcb == null) {
				throw new IOException("Missing password callback value");
			}
			destPcb.setPassword(srcPcb.getPassword());
		}
		return userName;
	}
Copies the callback values from the callback instances in the src list to the
corresponding instances (matched by callback class type) in the dest list, and
then returns the user name.

@param srcInstances array of callback instances to copy from
@param destInstances array of callback instances to copy to
@param principal the user principal (ie. default) name, used when no
name callback is found
@return the effective user name, either the principal or value from name callback.
@throws IOException if missing password callback
Ghidra/Features/GhidraServer/src/main/java/ghidra/server/security/JAASAuthenticationModule.java