mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Merge branch '1.1.x'
This commit is contained in:
commit
6253cc5dc7
@ -69,13 +69,14 @@ public class AuthenticationManagerConfiguration {
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public AuthenticationManager authenticationManager(AuthenticationConfiguration auth) throws Exception {
|
||||
public AuthenticationManager authenticationManager(AuthenticationConfiguration auth)
|
||||
throws Exception {
|
||||
return auth.getAuthenticationManager();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public static BootDefaultingAuthenticationConfigurerAdapter bootDefaultingAuthenticationConfigurerAdapter(SecurityProperties security,
|
||||
List<SecurityPrerequisite> dependencies) {
|
||||
public static BootDefaultingAuthenticationConfigurerAdapter bootDefaultingAuthenticationConfigurerAdapter(
|
||||
SecurityProperties security, List<SecurityPrerequisite> dependencies) {
|
||||
return new BootDefaultingAuthenticationConfigurerAdapter(security);
|
||||
}
|
||||
|
||||
@ -126,7 +127,8 @@ public class AuthenticationManagerConfiguration {
|
||||
* </ul>
|
||||
*/
|
||||
@Order(Ordered.LOWEST_PRECEDENCE - 100)
|
||||
private static class BootDefaultingAuthenticationConfigurerAdapter extends GlobalAuthenticationConfigurerAdapter {
|
||||
private static class BootDefaultingAuthenticationConfigurerAdapter extends
|
||||
GlobalAuthenticationConfigurerAdapter {
|
||||
private final SecurityProperties security;
|
||||
|
||||
@Autowired
|
||||
@ -134,6 +136,7 @@ public class AuthenticationManagerConfiguration {
|
||||
this.security = security;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(AuthenticationManagerBuilder auth) throws Exception {
|
||||
if (auth.isConfigured()) {
|
||||
return;
|
||||
@ -144,12 +147,13 @@ public class AuthenticationManagerConfiguration {
|
||||
logger.info("\n\nUsing default security password: " + user.getPassword()
|
||||
+ "\n");
|
||||
}
|
||||
|
||||
Set<String> roles = new LinkedHashSet<String>(user.getRole());
|
||||
auth
|
||||
.inMemoryAuthentication()
|
||||
.withUser(user.getName())
|
||||
.password(user.getPassword())
|
||||
.roles(roles.toArray(new String[roles.size()]));
|
||||
auth.inMemoryAuthentication().withUser(user.getName())
|
||||
.password(user.getPassword())
|
||||
.roles(roles.toArray(new String[roles.size()]));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user