Professional Documents
Culture Documents
java:
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/", "/login").permitAll() // Allow access to welcome and
login pages
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.defaultSuccessUrl("/admin/welcome", true) // Redirect to admin welcome
page
.permitAll()
.and()
.logout()
.permitAll();
}