Skip to content

Commit 64e94f3

Browse files
committed
Correct javadoc syntax and apply code formatting
1 parent 9d0e50c commit 64e94f3

File tree

5 files changed

+39
-29
lines changed

5 files changed

+39
-29
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/BootGlobalAuthenticationConfiguration.java

+15-7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.apache.commons.logging.Log;
2121
import org.apache.commons.logging.LogFactory;
2222
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
23+
import org.springframework.boot.autoconfigure.SpringBootApplication;
2324
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
2425
import org.springframework.context.ApplicationContext;
2526
import org.springframework.context.annotation.Bean;
@@ -29,39 +30,46 @@
2930
import org.springframework.security.config.annotation.authentication.configurers.GlobalAuthenticationConfigurerAdapter;
3031

3132
/**
32-
* This works with the {@link AuthenticationConfiguration} to ensure that users are able to use:
33+
* This works with the {@link AuthenticationConfiguration} to ensure that users are able
34+
* to use:
3335
*
3436
* <pre>
3537
* public void configureGlobal(AuthenticationManagerBuilder auth) {
3638
* ...
3739
* }
3840
* </pre>
3941
*
40-
* within their classes annotated with {{@EnableAutoConfiguration}} or use {{@SpringBootApplication}}.
42+
* within their classes annotated with {@link EnableAutoConfiguration} or
43+
* {@link SpringBootApplication}.
4144
*
4245
* @author Rob Winch
46+
* @since 1.2.2
4347
*/
4448
@Configuration
4549
@ConditionalOnClass(GlobalAuthenticationConfigurerAdapter.class)
4650
public class BootGlobalAuthenticationConfiguration {
4751

4852
@Bean
49-
public static BootGlobalAuthenticationConfigurationAdapter bootGlobalAuthenticationConfigurationAdapter(ApplicationContext context) {
53+
public static BootGlobalAuthenticationConfigurationAdapter bootGlobalAuthenticationConfigurationAdapter(
54+
ApplicationContext context) {
5055
return new BootGlobalAuthenticationConfigurationAdapter(context);
5156
}
5257

53-
private static class BootGlobalAuthenticationConfigurationAdapter extends GlobalAuthenticationConfigurerAdapter {
58+
private static class BootGlobalAuthenticationConfigurationAdapter extends
59+
GlobalAuthenticationConfigurerAdapter {
5460
private final ApplicationContext context;
55-
private static final Log logger = LogFactory.getLog(BootGlobalAuthenticationConfiguration.class);
61+
private static final Log logger = LogFactory
62+
.getLog(BootGlobalAuthenticationConfiguration.class);
5663

5764
public BootGlobalAuthenticationConfigurationAdapter(ApplicationContext context) {
5865
this.context = context;
5966
}
6067

6168
@Override
6269
public void init(AuthenticationManagerBuilder auth) {
63-
Map<String, Object> beansWithAnnotation = context.getBeansWithAnnotation(EnableAutoConfiguration.class);
64-
if(logger.isDebugEnabled()) {
70+
Map<String, Object> beansWithAnnotation = this.context
71+
.getBeansWithAnnotation(EnableAutoConfiguration.class);
72+
if (logger.isDebugEnabled()) {
6573
logger.debug("Eagerly initializing " + beansWithAnnotation);
6674
}
6775
}

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfiguration.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
@EnableConfigurationProperties
5151
@Import({ SpringBootWebSecurityConfiguration.class,
5252
AuthenticationManagerConfiguration.class,
53-
BootGlobalAuthenticationConfiguration.class})
53+
BootGlobalAuthenticationConfiguration.class })
5454
public class SecurityAutoConfiguration {
5555

5656
@Bean

spring-boot-security-tests/spring-boot-security-tests-web-helloworld/pom.xml

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
<name>Pivotal Software, Inc.</name>
1616
<url>http://www.spring.io</url>
1717
</organization>
18+
<properties>
19+
<main.basedir>${basedir}/../..</main.basedir>
20+
</properties>
1821
<dependencies>
1922
<dependency>
2023
<groupId>org.springframework.boot</groupId>

spring-boot-security-tests/spring-boot-security-tests-web-helloworld/src/main/java/sample/HelloWebSecurityApplication.java

+3-7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package sample;
1718

1819
import org.springframework.beans.factory.annotation.Autowired;
@@ -24,13 +25,8 @@
2425
public class HelloWebSecurityApplication {
2526

2627
@Autowired
27-
public void configureGlobal(AuthenticationManagerBuilder auth)
28-
throws Exception {
29-
// @formatter:off
30-
auth
31-
.inMemoryAuthentication()
32-
.withUser("user").password("password").roles("USER");
33-
// @formatter:on
28+
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
29+
auth.inMemoryAuthentication().withUser("user").password("password").roles("USER");
3430
}
3531

3632
public static void main(String[] args) {

spring-boot-security-tests/spring-boot-security-tests-web-helloworld/src/test/java/sample/HelloWebSecurityApplicationTests.java

+17-14
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package sample;
1718

1819
import javax.servlet.http.HttpServletResponse;
@@ -30,43 +31,45 @@
3031
import org.springframework.security.web.FilterChainProxy;
3132
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
3233

33-
import static org.hamcrest.Matchers.*;
34+
import static org.hamcrest.Matchers.equalTo;
3435
import static org.junit.Assert.assertThat;
3536

3637
@RunWith(SpringJUnit4ClassRunner.class)
3738
@SpringApplicationConfiguration(classes = HelloWebSecurityApplication.class)
3839
@WebIntegrationTest(randomPort = true)
3940
public class HelloWebSecurityApplicationTests {
41+
4042
@Autowired
41-
FilterChainProxy springSecurityFilterChain;
43+
private FilterChainProxy springSecurityFilterChain;
4244

43-
MockHttpServletRequest request;
45+
private MockHttpServletRequest request;
4446

45-
MockHttpServletResponse response;
47+
private MockHttpServletResponse response;
4648

47-
MockFilterChain chain;
49+
private MockFilterChain chain;
4850

4951
@Before
5052
public void setup() {
51-
request = new MockHttpServletRequest();
52-
response = new MockHttpServletResponse();
53-
chain = new MockFilterChain();
53+
this.request = new MockHttpServletRequest();
54+
this.response = new MockHttpServletResponse();
55+
this.chain = new MockFilterChain();
5456
}
5557

5658
@Test
5759
public void requiresAuthentication() throws Exception {
58-
springSecurityFilterChain.doFilter(request, response, chain);
60+
this.springSecurityFilterChain.doFilter(this.request, this.response, this.chain);
5961

60-
assertThat(response.getStatus(), equalTo(HttpServletResponse.SC_UNAUTHORIZED));
62+
assertThat(this.response.getStatus(),
63+
equalTo(HttpServletResponse.SC_UNAUTHORIZED));
6164
}
6265

63-
6466
@Test
6567
public void userAuthenticates() throws Exception {
66-
request.addHeader("Authorization", "Basic " + new String(Base64.encode("user:password".getBytes("UTF-8"))));
68+
this.request.addHeader("Authorization",
69+
"Basic " + new String(Base64.encode("user:password".getBytes("UTF-8"))));
6770

68-
springSecurityFilterChain.doFilter(request, response, chain);
71+
this.springSecurityFilterChain.doFilter(this.request, this.response, this.chain);
6972

70-
assertThat(response.getStatus(), equalTo(HttpServletResponse.SC_OK));
73+
assertThat(this.response.getStatus(), equalTo(HttpServletResponse.SC_OK));
7174
}
7275
}

0 commit comments

Comments
 (0)