The central allegory in the story is probably the disconnect between a comfortable, safe lifestyle, and the desire for adventure and danger that most people feel at some point in their lives. Walter Mitty seems to have a good life; he is not poor or wanting for essentials, he is married, and he seems healthy enough. However, he is not happy; his subconscious wants something more out of life and he finds himself daydreaming about adventurous scenarios in which he is the hero of the hour:
Walter Mitty drove on toward Waterbury in silence, the roaring of the SN202 through the worst storm in twenty years of Navy flying fading in the remote, intimate airways of his mind.
(Thurber, "The Secret Life of Walter Mitty," bnrg.cs.berkeley.edu)
Mitty seems almost unconscious of these daydreams; the only time he acknowledges them is when his wife wakes him in a hotel lobby, when he quietly admonishes his wife: "Does it ever occur to you that I am sometimes thinking?" This is his only pushback against society and its intended role for him; otherwise, he meekly complies with everything people say and do. The allegory, therefore, is of the individualist spirit that resides in all people, and the forces of convention that seek to keep everyone confined to a safe societal role.