quick formatting work
This commit is contained in:
parent
89d3f72333
commit
a910ebae44
@ -4,7 +4,6 @@ import java.security.Principal;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -39,7 +38,6 @@ public class MyController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private String getUserName(Principal principal) {
|
private String getUserName(Principal principal) {
|
||||||
|
|
||||||
if (principal == null) {
|
if (principal == null) {
|
||||||
return "anonymous";
|
return "anonymous";
|
||||||
} else {
|
} else {
|
||||||
@ -54,7 +52,6 @@ public class MyController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Collection<String> getUserRoles(Principal principal) {
|
private Collection<String> getUserRoles(Principal principal) {
|
||||||
|
|
||||||
if (principal == null) {
|
if (principal == null) {
|
||||||
return Arrays.asList("none");
|
return Arrays.asList("none");
|
||||||
} else {
|
} else {
|
||||||
@ -71,4 +68,3 @@ public class MyController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,36 +16,14 @@ import org.springframework.stereotype.Controller;
|
|||||||
public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure(AuthenticationManagerBuilder auth)
|
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||||
throws Exception {
|
auth.ldapAuthentication().userSearchBase("ou=people").userSearchFilter("(uid={0})").groupSearchBase("ou=groups").groupSearchFilter("member={0}").contextSource().root("dc=baeldung,dc=com").ldif("classpath:users.ldif");
|
||||||
|
|
||||||
auth.ldapAuthentication()
|
|
||||||
.userSearchBase("ou=people")
|
|
||||||
.userSearchFilter("(uid={0})")
|
|
||||||
.groupSearchBase("ou=groups")
|
|
||||||
.groupSearchFilter("member={0}")
|
|
||||||
.contextSource()
|
|
||||||
.root("dc=baeldung,dc=com")
|
|
||||||
.ldif("classpath:users.ldif");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure(HttpSecurity http) throws Exception {
|
protected void configure(HttpSecurity http) throws Exception {
|
||||||
|
http.authorizeRequests().antMatchers("/", "/home").permitAll().anyRequest().authenticated();
|
||||||
http
|
http.formLogin().loginPage("/login").permitAll().and().logout().logoutSuccessUrl("/");
|
||||||
.authorizeRequests()
|
|
||||||
.antMatchers("/", "/home").permitAll()
|
|
||||||
.anyRequest().authenticated();
|
|
||||||
http
|
|
||||||
.formLogin()
|
|
||||||
.loginPage("/login")
|
|
||||||
.permitAll()
|
|
||||||
.and()
|
|
||||||
.logout()
|
|
||||||
.logoutSuccessUrl("/");
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user