title: Good way to secure multiple Angular 2 components
body: <p>A common recommended way to secure Angular 2 component/routes seems to be to use <code>@CanActivate()</code>, like here:</p>
  
  <p><a href="http://youknowriad.github.io/angular2-cookbooks/stateless-authentication.html" rel="nofollow">http://youknowriad.github.io/angular2-cookbooks/stateless-authentication.html</a></p>
  
  <p>If you have only a few components this works fine, but is there a better way that would centralize all this? </p>
  
  <p>Would having a common base class for each component work? (any examples on how to do this?). Could we have a custom <code>@CanActivate()</code>, something like <code>@ProtectMyApp()</code>? (examples?)</p>
  
  <p>I'm basically trying to prevent having to copy+paste the same <code>@CanActivate()</code> code for each component.</p>
  
  <p>(apologies if these questions do not make sense, still learning Angular)</p>
  
  <p>Thanks</p>