Advertisement
Guest User

Untitled

a guest
Feb 28th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. @Override
  2. protected void configure(HttpSecurity http) throws Exception {
  3. http
  4. .authorizeRequests()
  5. .antMatchers("/failure").permitAll()
  6. .antMatchers("/api/**").permitAll()
  7. .antMatchers("/war").hasAnyAuthority("test")
  8. .antMatchers("/users").hasAnyAuthority("admin")
  9. .antMatchers("/users/**").hasAnyAuthority("admin")
  10. .anyRequest().authenticated()
  11. .and()
  12. .exceptionHandling()
  13. .authenticationEntryPoint(restAuthenticationEntryPoint)
  14. .accessDeniedHandler(restAccessDeniedHandler)
  15. .and()
  16. .formLogin()
  17. .loginPage("/login")
  18. .loginProcessingUrl("/authenticate")
  19. .successHandler(restAuthenticationSuccessHandler)
  20. .failureHandler(restAuthenticationFailureHandler)
  21. .usernameParameter("login")
  22. .passwordParameter("password")
  23. .permitAll()
  24. .and()
  25.  
  26. <body>
  27. <base href="/">
  28.  
  29. <button class="btn btn-primary enter-btn" routerLink="/users">Users</button>
  30.  
  31. <router-outlet></router-outlet>
  32.  
  33. </body>
  34.  
  35. const appRoutes: Routes= [
  36. {
  37. path:'users',
  38. component: UserComponent,
  39.  
  40. },
  41.  
  42. {
  43. path:'home',
  44. component: HomeComponent,
  45.  
  46.  
  47. },
  48. {
  49. path:'login',
  50. component: LoginComponent,
  51.  
  52. } ,
  53. {
  54. path:'registration',
  55. component: RegistrationComponent,
  56.  
  57. }
  58.  
  59. ];
  60.  
  61.  
  62.  
  63. export const appRoutingProviders: any[] = [];
  64.  
  65. export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement