I'm using expressjs and angularjs for an app. Basically, expressjs just returns one .html that has an angular single-page-application. All routing is done with angularjs, and expressjs just exposes some web services (GET, POST).
So, if I'd do just a regular expressjs app, I'd use passportjs and store user in session on server-side that'd be it. When user tries to access /admin pages, I'd use passport middleware to check if route is allowed and so forth. Plain and simple.
But with angular, all routing is done on client side - even evaluating if user is logged in. Now, of course, a lot has been written about this, but almost all solutions store any kind of token key in localStorage or angular's $cookie. Now I'm wondering - is that safe?
If anyone would ran such an application on a public computer, and forgot to logout, anyone would be able to look at the localStorage or angular's $cookie and get the token, right?
So what is the theoretical process of implementing a safe authentication on client side, using angularjs?