Fix class and variable names

This commit is contained in:
Ruslan Stelmachenko 2019-11-21 22:52:55 +02:00 committed by Eleftheria Stein-Kousathana
parent 8ebc7ca0ea
commit c38e57fa42
2 changed files with 10 additions and 11 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2015 the original author or authors. * Copyright 2002-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -19,7 +19,6 @@ import org.springframework.context.ApplicationContext;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.security.authentication.AuthenticationProvider; import org.springframework.security.authentication.AuthenticationProvider;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.crypto.password.PasswordEncoder;
/** /**
* Lazily initializes the global authentication with an {@link AuthenticationProvider} if it is * Lazily initializes the global authentication with an {@link AuthenticationProvider} if it is
@ -47,10 +46,10 @@ class InitializeAuthenticationProviderBeanManagerConfigurer
@Override @Override
public void init(AuthenticationManagerBuilder auth) throws Exception { public void init(AuthenticationManagerBuilder auth) throws Exception {
auth.apply(new InitializeUserDetailsManagerConfigurer()); auth.apply(new InitializeAuthenticationProviderManagerConfigurer());
} }
class InitializeUserDetailsManagerConfigurer class InitializeAuthenticationProviderManagerConfigurer
extends GlobalAuthenticationConfigurerAdapter { extends GlobalAuthenticationConfigurerAdapter {
@Override @Override
public void configure(AuthenticationManagerBuilder auth) { public void configure(AuthenticationManagerBuilder auth) {
@ -68,17 +67,17 @@ class InitializeAuthenticationProviderBeanManagerConfigurer
} }
/** /**
* @return * @return a bean of the requested class if there's just a single registered component, null otherwise.
*/ */
private <T> T getBeanOrNull(Class<T> type) { private <T> T getBeanOrNull(Class<T> type) {
String[] userDetailsBeanNames = InitializeAuthenticationProviderBeanManagerConfigurer.this.context String[] beanNames = InitializeAuthenticationProviderBeanManagerConfigurer.this.context
.getBeanNamesForType(type); .getBeanNamesForType(type);
if (userDetailsBeanNames.length != 1) { if (beanNames.length != 1) {
return null; return null;
} }
return InitializeAuthenticationProviderBeanManagerConfigurer.this.context return InitializeAuthenticationProviderBeanManagerConfigurer.this.context
.getBean(userDetailsBeanNames[0], type); .getBean(beanNames[0], type);
} }
} }
} }

View File

@ -85,14 +85,14 @@ class InitializeUserDetailsBeanManagerConfigurer
* @return a bean of the requested class if there's just a single registered component, null otherwise. * @return a bean of the requested class if there's just a single registered component, null otherwise.
*/ */
private <T> T getBeanOrNull(Class<T> type) { private <T> T getBeanOrNull(Class<T> type) {
String[] userDetailsBeanNames = InitializeUserDetailsBeanManagerConfigurer.this.context String[] beanNames = InitializeUserDetailsBeanManagerConfigurer.this.context
.getBeanNamesForType(type); .getBeanNamesForType(type);
if (userDetailsBeanNames.length != 1) { if (beanNames.length != 1) {
return null; return null;
} }
return InitializeUserDetailsBeanManagerConfigurer.this.context return InitializeUserDetailsBeanManagerConfigurer.this.context
.getBean(userDetailsBeanNames[0], type); .getBean(beanNames[0], type);
} }
} }
} }