Inlining the validateSession functionality in Application, fixes #312