Revize d411f143
Přidáno uživatelem Vojtěch Danišík před asi 4 roky(ů)
src/main/java/vldc/aswi/configuration/AppConfig.java | ||
---|---|---|
6 | 6 |
import org.springframework.context.annotation.Bean; |
7 | 7 |
import org.springframework.context.annotation.ComponentScan; |
8 | 8 |
import org.springframework.context.annotation.Configuration; |
9 |
import org.springframework.http.HttpMethod; |
|
9 | 10 |
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; |
10 | 11 |
import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
11 | 12 |
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; |
12 | 13 |
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; |
13 | 14 |
import org.springframework.security.core.userdetails.UserDetailsService; |
14 | 15 |
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
16 |
import org.springframework.security.crypto.password.DelegatingPasswordEncoder; |
|
17 |
import org.springframework.security.crypto.password.NoOpPasswordEncoder; |
|
15 | 18 |
import org.springframework.security.crypto.password.PasswordEncoder; |
19 |
import org.springframework.security.web.util.matcher.RegexRequestMatcher; |
|
16 | 20 |
import org.springframework.web.servlet.config.annotation.EnableWebMvc; |
17 | 21 |
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; |
18 | 22 |
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
... | ... | |
69 | 73 |
return viewResolver; |
70 | 74 |
} |
71 | 75 |
|
76 |
|
|
72 | 77 |
@Bean |
73 | 78 |
public PasswordEncoder passwordEncoder() { |
74 | 79 |
return new BCryptPasswordEncoder(); |
... | ... | |
76 | 81 |
|
77 | 82 |
@Override |
78 | 83 |
protected void configure(HttpSecurity http) throws Exception { |
79 |
/* |
|
80 | 84 |
http |
81 | 85 |
.authorizeRequests() |
82 | 86 |
.mvcMatchers("/login").permitAll() |
... | ... | |
86 | 90 |
.formLogin() |
87 | 91 |
.loginPage("/login") |
88 | 92 |
.permitAll() |
89 |
.defaultSuccessUrl("/") |
|
93 |
.defaultSuccessUrl("/", true)
|
|
90 | 94 |
.and() |
91 | 95 |
.logout() |
92 | 96 |
.logoutRequestMatcher(new RegexRequestMatcher("/logout", "GET")) |
93 | 97 |
.invalidateHttpSession(true) |
94 | 98 |
.deleteCookies("JSESSIONID") |
95 | 99 |
.permitAll(); |
96 |
*/ |
|
97 | 100 |
} |
98 | 101 |
|
99 | 102 |
@Override |
... | ... | |
108 | 111 |
registry |
109 | 112 |
.addResourceHandler("/css/**") |
110 | 113 |
.addResourceLocations("/css/"); |
111 |
|
|
112 | 114 |
registry |
113 |
.addResourceHandler("/js/**")
|
|
114 |
.addResourceLocations("/js/");
|
|
115 |
.addResourceHandler("/js/**")
|
|
116 |
.addResourceLocations("/js/");
|
|
115 | 117 |
registry |
116 | 118 |
.addResourceHandler("/webfonts/**") |
117 | 119 |
.addResourceLocations("/webfonts/"); |
Také k dispozici: Unified diff
re #8014 Login into app + session for user.