For me this would entirely depend on the context.
If your definition of "username" was a user's first and last name, then "welcome..." would be more polite than "logged in as..."; on the contrary, if your "username" was just something the user used to log in, "logged in as..." would make more sense than "welcome...", as otherwise you're welcoming the user's username and not necessarily their identity.
That said, if a user had been logged in for more than 5 minutes, would you really still want to display "welcome..."?
"Logged in as..." is a more of a reference to the user's account than a greeting to the user.