Warning: gigantic spoilers ahead for the "Eastwatch" episode of Game of Thrones. Take a look at some of our other articles if you haven't had the chance to watch the episode yet.
Game of Thrones has spent seven seasons so far toying with the question of the rightful claimant to the Iron Throne. Is it Cersei, who schemed and fought and clawed her way to the top? Is it Dany, whose Targaryen forebears ruled the Seven Kingdoms for 300 years? Or is it Gendry, who just returned as the last member of the Baratheon bloodline? In the Season 6 finale, a flashback to Jon Snow's birth at the Tower of Joy in Dorne gave viewers reason to believe that he has a claim to the Iron Throne as well, as we learned that he's the son of Lyanna Stark rather than Ned Stark, and his real father is almost certainly Rhaegar Targaryen. Still, there were more questions than answers, and it was unclear if he had a legitimate claim to the throne.
Well, "Eastwatch" may have just given us the answer we needed. In a scene set in the Citadel, Gilly was reading various facts from a seemingly random scroll to an increasingly frustrated Sam. He was barely even listening, but fans who were paying closer attention got a giant reveal. According to the records she was reading, High Septon Maynard issued an annulment for a "Prince Ragger" and remarried him to somebody at the same time in a secret ceremony in Dorne. Yes, it seems that Gilly has just unwittingly confirmed the fact that Prince Rhaegar Targaryen married Lyanna Stark after he absconded with her, which means that their son was entirely legitimate. It appears that good old Jon Snow is indeed a Targaryen by birth and the person in Westeros with the best claim to the Iron Throne.
Admittedly, we already knew that Jon almost certainly had Targaryen blood thanks to the flashback to the Tower of Joy, but Game of Thrones has gone to great lengths over the years to emphasize that having royal blood is nothing without the royal name to back it up. Jon lacked esteem because he was a Snow and not a Stark, Gendry was going to be sacrificed like an animal because he wasn't a Baratheon, and Robert's other bastards were murdered en masse because they were inconvenient to Joffrey. Even if Jon was Rhaegar's son, it wouldn't have made much of a difference if he was a bastard, especially when Dany is a full-blooded Targaryen.
Documentation at the Citadel proves that the marriage happened and was as official as official could be, as it was conducted by a high septon. The document was found by Gilly, who had no means or motive to plant it to falsify a legitimization for Jon, and it means that the characters won't need to rely on merely a vision from Bran as the Three-Eyed Raven to confirm Jon's status. Gilly couldn't even properly pronounce Rhaegar's name. The document is inarguably legitimate, and it makes any child of Rhaegar and Lyanna legitimate as well.
The document proving marriage between Rhaegar and Lyanna weakens Dany's claim to the throne. The Targaryens were historically on board with legalized polygamy, so Dany's only hope of holding a stronger claim than Jon would have been if Rhaegar had never married Lyanna. If she believes that Jon is her legal nephew and the son of her elder brother, he is ahead of her in the Targaryen line of succession. He is Dany's rightful king by Targaryen standard.
The document proving annulment is the one that could make all the difference to the rest of Westeros. The Targaryens were the only ones who were cool with polygamy, and the other houses of Westeros might not have considered any kids of Rhaegar's legitimate if they were born from a second wife. He was already married to Elia Martell (and had fathered two kids) when he ran off with Lyanna; if not for the annulment, the folks of the Seven Kingdoms might have considered any marriage between Rhaegar and Lyanna to be false and any kids to therefore be bastards. If the people of the Seven Kingdoms assent to return to Targaryen rule, Jon is their rightful king.
All of this said, Jon has never given any hint that he cares in the slightest about who sits on the Iron Throne. He'd probably be perfectly happy to stay up North and let Dany rule the Six Kingdoms in peace, assuming the Great War doesn't result in the deaths of everybody. Even if every single person in Westeros was to agree that he is the rightful heir to the Iron Throne, he might just not want it. He may be a Targaryen by birth, and he may legally deserve the Targaryen name, but Jon is of the North, and his father will always be Ned Stark, no matter who happened to father him after a secret ceremony in Dorne. With the Great War looming, everybody in the Seven Kingdoms should probably be more concerned with finding Azor Ahai than the heir to the Iron Throne.