SHARE
TWEET

Untitled

a guest Jun 27th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Override
  2. protected void configure(HttpSecurity http) throws Exception {
  3.     // http.cors().and().csrf().disable().authorizeRequests()
  4.     http.csrf().disable().httpBasic().and().authorizeRequests().antMatchers(HttpMethod.POST, SIGN_UP_URL)
  5.             .permitAll().anyRequest().authenticated().and()
  6.             .addFilter(new JWTAuthenticationFilter(authenticationManager()))
  7.             .addFilter(new JWTAuthorizationFilter(authenticationManager())).sessionManagement()
  8.             .sessionCreationPolicy(SessionCreationPolicy.STATELESS);
  9. }
  10.  
  11. @Override
  12. public void configure(AuthenticationManagerBuilder auth) throws Exception {
  13.     auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder);
  14. }
  15.  
  16. @Bean
  17. CorsConfigurationSource corsConfigurationSource() {
  18.     final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
  19.     source.registerCorsConfiguration("/**", new CorsConfiguration().applyPermitDefaultValues());
  20.     return source;
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top