Technically, the airline is the one that is asking for ID; the law apparently authorizes TSA to require the airlines to ask for it. I say "apparently" because that is what the TSA says that it says; the US govt. is refusing to publish that particular law, they claim that the particulars must be kept secret in the interest of national security. However, in no case is a passenger actually *required* to show a govt. issued ID in order to board a domestic flight; you may at your discretion choose to become a "selectee" and undergo an especially diligent search process instead. (Of course, the airline may refuse to issue a boarding pass to you if you don't prove that you are the passenger for whom the ticket was purchased, which has the same effect. That part has nothing to do with security, though; it is contract law, because the airline sells tickets as non-transferable, and they are allowed to enforce the terms of the contract.)
The whole ID question has been making its way through the Federal courts for a few years now, the case is now called Gilmore v. Gonzalez. The plaintiff (one of the founders of Sun Microsystems, now retired) refused to show ID and also refused to undergo a selectee screening, so he was denied boarding. He tried it on two airlines, SWA and UA, and then he sued, claiming that the requirement violates his constitutional right to travel within the US. The 9th Circuit rejected the claim on the grounds that he doesn't have standing, so he has applied for Cert. to the US Supreme Court. All of the filed documents in the case are available at
http://papersplease.org/gilmore/legal.html
The arguments are interesting -- at least they are if you are a Constitution Geek like me.