cleanup and upgrade
This commit is contained in:
@@ -9,7 +9,7 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
|
||||
* Security Configuration - LDAP and HTTP Authorizations.
|
||||
*/
|
||||
@Configuration
|
||||
// @ImportResource({ "classpath:webSecurityConfig.xml" })
|
||||
// @ImportResource({ "classpath:webSecurityConfig.xml" }) //=> uncomment to use equivalent xml config
|
||||
public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
@@ -20,7 +20,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http.authorizeRequests().antMatchers("/", "/home").permitAll().anyRequest().authenticated();
|
||||
http.formLogin().loginPage("/login").permitAll().loginProcessingUrl("/j_spring_security_check").and().logout().logoutSuccessUrl("/");
|
||||
http.formLogin().loginPage("/login").permitAll().and().logout().logoutSuccessUrl("/");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<p th:if="${param.logout}" class="alert">You have been logged out</p>
|
||||
<p th:if="${param.error}" class="alert alert-error">There was an error, please try again</p>
|
||||
<h2>Login with Username and Password</h2>
|
||||
<form name="form" th:action="@{/j_spring_security_check}" action="/login" method="POST">
|
||||
<form name="form" th:action="@{/login}" method="POST">
|
||||
<fieldset>
|
||||
<input type="text" name="username" value="" placeholder="Username" />
|
||||
<input type="password" name="password" placeholder="Password" />
|
||||
|
||||
@@ -13,10 +13,7 @@
|
||||
<intercept-url pattern="/login" access="permitAll"/>
|
||||
<intercept-url pattern="/secure" access="isAuthenticated()"/>
|
||||
|
||||
<form-login login-page='/login' default-target-url="/"
|
||||
authentication-failure-url="/login?error"
|
||||
username-parameter="username"
|
||||
password-parameter="password"/>
|
||||
<form-login login-page='/login' default-target-url="/" authentication-failure-url="/login?error" />
|
||||
<logout logout-success-url="/" />
|
||||
</http>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user