Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1.     @Override
  2.     protected void configure(HttpSecurity http) throws Exception {
  3.         http
  4.                 .cors()
  5.                 .and()
  6.                 .csrf()
  7.                 .disable()
  8.                 .exceptionHandling()
  9.                 .authenticationEntryPoint(unauthorizedHandler)
  10.                 .and()
  11.                 .sessionManagement()
  12.                 .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
  13.                 .and()
  14.                 .authorizeRequests()
  15.                 .antMatchers(WHITELIST)
  16.                 .permitAll()
  17.                 .antMatchers("/api/auth/**")
  18.                 .permitAll()
  19.                 .anyRequest()
  20.                 .authenticated();
  21.  
  22.         // Add our custom JWT security filter
  23.         http.addFilterBefore(jwtAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class);
  24.  
  25.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement