O'Reilly logo

Mastering Web Application Development with AngularJS by Pawel Kozlowski, Peter Bacon Darwin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Securing partial templates

There are some situations where you don't want users to be able to access the partial templates (HTML) for AngularJS routes to which they do not have authorization. Perhaps, the templates contain layout information that implicitly exposes sensitive information.

In this case, a simple solution is to ensure that requests for these partial templates are checked for authorization on the server. First, we should not preload such templates at application startup. And then, we should configure the server to check the current user whenever one of these partial templates is requested, once again returning an HTTP 401 unauthorized error, if unauthorized.

Note

If we are relying on the server to check authorization on each partial ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required