Authenticate and Authorize SPAs Created With Vanilla Javascript

When I mention Authentication and Authorization, what I’m referring to is securing your web contents. Basically a user should not be able to navigate to any page that he’s not authorized to see unless and until he logs in.

I don’t see how this is possible without server side scripts using something like ASP.Net, PHP, etc. Javascript alone cannot provide these features. I have not looked into node.js to see if it can provide such features but if it can It would be great.