Anonymous type can be replaced with lambda
This commit is contained in:
committed by
Josh Cummings
parent
05f42a4995
commit
fb39d9c255
+3
-11
@@ -25,9 +25,6 @@ import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.authority.AuthorityUtils;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.security.core.userdetails.UserDetails;
|
||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||
import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
||||
import org.springframework.security.web.authentication.www.DigestAuthenticationEntryPoint;
|
||||
import org.springframework.security.web.authentication.www.DigestAuthenticationFilter;
|
||||
|
||||
@@ -59,13 +56,8 @@ public class SecurityMockMvcRequestPostProcessorsDigestTests {
|
||||
entryPoint.setKey("key");
|
||||
entryPoint.setRealmName("Spring Security");
|
||||
filter = new DigestAuthenticationFilter();
|
||||
filter.setUserDetailsService(new UserDetailsService() {
|
||||
public UserDetails loadUserByUsername(String username)
|
||||
throws UsernameNotFoundException {
|
||||
return new User(username, password, AuthorityUtils
|
||||
.createAuthorityList("ROLE_USER"));
|
||||
}
|
||||
});
|
||||
filter.setUserDetailsService(username -> new User(username, password, AuthorityUtils
|
||||
.createAuthorityList("ROLE_USER")));
|
||||
filter.setAuthenticationEntryPoint(entryPoint);
|
||||
filter.afterPropertiesSet();
|
||||
}
|
||||
@@ -133,4 +125,4 @@ public class SecurityMockMvcRequestPostProcessorsDigestTests {
|
||||
});
|
||||
return username;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user