Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- protected void configure(HttpSecurity http) throws Exception {
- http
- .authorizeRequests()
- .antMatchers("/failure").permitAll()
- .antMatchers("/api/**").permitAll()
- .antMatchers("/war").hasAnyAuthority("test")
- .antMatchers("/users").hasAnyAuthority("admin")
- .antMatchers("/users/**").hasAnyAuthority("admin")
- .anyRequest().authenticated()
- .and()
- .exceptionHandling()
- .authenticationEntryPoint(restAuthenticationEntryPoint)
- .accessDeniedHandler(restAccessDeniedHandler)
- .and()
- .formLogin()
- .loginPage("/login")
- .loginProcessingUrl("/authenticate")
- .successHandler(restAuthenticationSuccessHandler)
- .failureHandler(restAuthenticationFailureHandler)
- .usernameParameter("login")
- .passwordParameter("password")
- .permitAll()
- .and()
- <body>
- <base href="/">
- <button class="btn btn-primary enter-btn" routerLink="/users">Users</button>
- <router-outlet></router-outlet>
- </body>
- const appRoutes: Routes= [
- {
- path:'users',
- component: UserComponent,
- },
- {
- path:'home',
- component: HomeComponent,
- },
- {
- path:'login',
- component: LoginComponent,
- } ,
- {
- path:'registration',
- component: RegistrationComponent,
- }
- ];
- export const appRoutingProviders: any[] = [];
- export const routing: ModuleWithProviders = RouterModule.forRoot(appRoutes);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement