Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement