added rerouting based on authentication