source: src/main/java/project/educatum/EducatumApplication.java@ d3cf3a1

Last change on this file since d3cf3a1 was d3cf3a1, checked in by Marija Micevska <marija_micevska@…>, 2 years ago

Initial commit

  • Property mode set to 100644
File size: 1.4 KB
Line 
1package project.educatum;
2
3import org.springframework.boot.SpringApplication;
4import org.springframework.boot.autoconfigure.SpringBootApplication;
5import org.springframework.boot.web.servlet.ServletComponentScan;
6import org.springframework.context.annotation.Bean;
7import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
8import org.springframework.security.crypto.password.PasswordEncoder;
9import org.springframework.security.web.firewall.HttpFirewall;
10import org.springframework.security.web.firewall.HttpStatusRequestRejectedHandler;
11import org.springframework.security.web.firewall.RequestRejectedHandler;
12import org.springframework.security.web.firewall.StrictHttpFirewall;
13
14@SpringBootApplication
15@ServletComponentScan
16public class EducatumApplication {
17
18 public static void main(String[] args) {
19 SpringApplication.run(EducatumApplication.class, args);
20 }
21
22 @Bean
23 PasswordEncoder passwordEncoder() {
24 return new BCryptPasswordEncoder();
25 }
26
27 @Bean
28 public HttpFirewall allowUrlSemicolonHttpFirewall() {
29 StrictHttpFirewall firewall = new StrictHttpFirewall();
30 firewall.setAllowSemicolon(true);
31 return firewall;
32 }
33
34 @Bean
35 RequestRejectedHandler requestRejectedHandler() {
36 // sends an error response with a configurable status code (default is 400 BAD_REQUEST)
37 // we can pass a different value in the constructor
38 return new HttpStatusRequestRejectedHandler();
39 }
40}
Note: See TracBrowser for help on using the repository browser.