You would need to read the specific warranty that is included with the roof. Some warranties will cover 100 percent for the life of the warranty while other warranties will prorate based on when the claim was made. So if you have a five year warranty and the roof leaked in year four, the roofer might be liable for 20 percent of the cost of repair.
A good quality asphalt shingle roof that has been properly installed should last at least 10 or more years. However if the roof has hail, wind or ice damage, that could shorten the life of a roof. And if a roof was improperly installed, the life of the roof will be shortened.