From be36ddb61467e38034ea115f8fa4c3c00d6bfdad Mon Sep 17 00:00:00 2001 From: Rob Winch Date: Wed, 9 Mar 2016 16:45:43 -0600 Subject: [PATCH] Some formatting fixes for HttpSecurity Javadoc --- .../annotation/web/builders/HttpSecurity.java | 143 +++++++++++------- 1 file changed, 85 insertions(+), 58 deletions(-) diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/builders/HttpSecurity.java b/config/src/main/java/org/springframework/security/config/annotation/web/builders/HttpSecurity.java index b0418ccec3..0e4ad24140 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/builders/HttpSecurity.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/builders/HttpSecurity.java @@ -88,12 +88,12 @@ import org.springframework.util.Assert; * @Configuration * @EnableWebSecurity * public class FormLoginSecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { * http.authorizeRequests().antMatchers("/**").hasRole("USER").and().formLogin(); * } - * + * * @Override * protected void configure(AuthenticationManagerBuilder auth) throws Exception { * auth.inMemoryAuthentication().withUser("user").password("password").roles("USER"); @@ -144,13 +144,13 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class OpenIDLoginConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) { * http.authorizeRequests().antMatchers("/**").hasRole("USER").and().openidLogin() * .permitAll(); * } - * + * * @Override * protected void configure(AuthenticationManagerBuilder auth) throws Exception { * auth.inMemoryAuthentication() @@ -171,7 +171,7 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class OpenIDLoginConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) { * http.authorizeRequests() @@ -197,7 +197,7 @@ public final class HttpSecurity extends * .type("http://schema.openid.net/namePerson").required(true); * } * } - * + * * public class AutoProvisioningUserDetailsService implements * AuthenticationUserDetailsService<OpenIDAuthenticationToken> { * public UserDetails loadUserDetails(OpenIDAuthenticationToken token) @@ -227,7 +227,7 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class CsrfSecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { * http @@ -253,7 +253,7 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class CsrfSecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { * http @@ -273,7 +273,7 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class CsrfSecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { * http @@ -331,14 +331,14 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class SessionManagementSecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { * http.authorizeRequests().anyRequest().hasRole("USER").and().formLogin() * .permitAll().and().sessionManagement().maximumSessions(1) * .expiredUrl("/login?expired"); * } - * + * * @Override * protected void configure(AuthenticationManagerBuilder auth) throws Exception { * auth.inMemoryAuthentication().withUser("user").password("password").roles("USER"); @@ -388,7 +388,7 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class PortMapperSecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { * http.authorizeRequests().antMatchers("/**").hasRole("USER").and().formLogin() @@ -396,7 +396,7 @@ public final class HttpSecurity extends * // Example portMapper() configuration * .portMapper().http(9090).mapsTo(9443).http(80).mapsTo(443); * } - * + * * @Override * protected void configure(AuthenticationManagerBuilder auth) throws Exception { * auth.inMemoryAuthentication().withUser("user").password("password").roles("USER"); @@ -426,7 +426,7 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class JeeSecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { * http.authorizeRequests().antMatchers("/**").hasRole("USER").and() @@ -449,7 +449,7 @@ public final class HttpSecurity extends * <form-error-page>/login?error</form-error-page> * </form-login-config> * </login-config> - * + * * <security-role> * <role-name>ROLE_USER</role-name> * </security-role> @@ -497,7 +497,7 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class X509SecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { * http.authorizeRequests().antMatchers("/**").hasRole("USER").and() @@ -528,12 +528,12 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class RememberMeSecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(AuthenticationManagerBuilder auth) throws Exception { * auth.inMemoryAuthentication().withUser("user").password("password").roles("USER"); * } - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { * http.authorizeRequests().antMatchers("/**").hasRole("USER").and().formLogin() @@ -564,12 +564,12 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class AuthorizeUrlsSecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { * http.authorizeRequests().antMatchers("/**").hasRole("USER").and().formLogin(); * } - * + * * @Override * protected void configure(AuthenticationManagerBuilder auth) throws Exception { * auth.inMemoryAuthentication().withUser("user").password("password").roles("USER") @@ -586,13 +586,13 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class AuthorizeUrlsSecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { * http.authorizeRequests().antMatchers("/admin/**").hasRole("ADMIN") * .antMatchers("/**").hasRole("USER").and().formLogin(); * } - * + * * @Override * protected void configure(AuthenticationManagerBuilder auth) throws Exception { * auth.inMemoryAuthentication().withUser("user").password("password").roles("USER") @@ -679,7 +679,7 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class CsrfSecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { * http @@ -713,7 +713,7 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class LogoutSecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { * http.authorizeRequests().antMatchers("/**").hasRole("USER").and().formLogin() @@ -722,7 +722,7 @@ public final class HttpSecurity extends * .logout().logout().deleteCookies("remove").invalidateHttpSession(false) * .logoutUrl("/custom-logout").logoutSuccessUrl("/logout-success"); * } - * + * * @Override * protected void configure(AuthenticationManagerBuilder auth) throws Exception { * auth.inMemoryAuthentication().withUser("user").password("password").roles("USER"); @@ -753,7 +753,7 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class AnononymousSecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { * http.authorizeRequests().antMatchers("/**").hasRole("USER").and().formLogin() @@ -761,7 +761,7 @@ public final class HttpSecurity extends * // sample anonymous customization * .anonymous().authorities("ROLE_ANON"); * } - * + * * @Override * protected void configure(AuthenticationManagerBuilder auth) throws Exception { * auth.inMemoryAuthentication().withUser("user").password("password").roles("USER"); @@ -777,7 +777,7 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class AnononymousSecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { * http.authorizeRequests().antMatchers("/**").hasRole("USER").and().formLogin() @@ -785,7 +785,7 @@ public final class HttpSecurity extends * // sample anonymous customization * .anonymous().disabled(); * } - * + * * @Override * protected void configure(AuthenticationManagerBuilder auth) throws Exception { * auth.inMemoryAuthentication().withUser("user").password("password").roles("USER"); @@ -816,12 +816,12 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class FormLoginSecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { * http.authorizeRequests().antMatchers("/**").hasRole("USER").and().formLogin(); * } - * + * * @Override * protected void configure(AuthenticationManagerBuilder auth) throws Exception { * auth.inMemoryAuthentication().withUser("user").password("password").roles("USER"); @@ -835,7 +835,7 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class FormLoginSecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { * http.authorizeRequests().antMatchers("/**").hasRole("USER").and().formLogin() @@ -847,7 +847,7 @@ public final class HttpSecurity extends * // with an HTTP * // post * } - * + * * @Override * protected void configure(AuthenticationManagerBuilder auth) throws Exception { * auth.inMemoryAuthentication().withUser("user").password("password").roles("USER"); @@ -880,13 +880,13 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class ChannelSecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { * http.authorizeRequests().antMatchers("/**").hasRole("USER").and().formLogin() * .and().requiresChannel().anyRequest().requiresSecure(); * } - * + * * @Override * protected void configure(AuthenticationManagerBuilder auth) throws Exception { * auth.inMemoryAuthentication().withUser("user").password("password").roles("USER"); @@ -916,12 +916,12 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class HttpBasicSecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { * http.authorizeRequests().antMatchers("/**").hasRole("USER").and().httpBasic(); * } - * + * * @Override * protected void configure(AuthenticationManagerBuilder auth) throws Exception { * auth.inMemoryAuthentication().withUser("user").password("password").roles("USER"); @@ -953,7 +953,7 @@ public final class HttpSecurity extends /* * (non-Javadoc) - * + * * @see * org.springframework.security.config.annotation.web.HttpBuilder#authenticationProvider * (org.springframework.security.authentication.AuthenticationProvider) @@ -966,7 +966,7 @@ public final class HttpSecurity extends /* * (non-Javadoc) - * + * * @see * org.springframework.security.config.annotation.web.HttpBuilder#userDetailsService * (org.springframework.security.core.userdetails.UserDetailsService) @@ -983,7 +983,7 @@ public final class HttpSecurity extends /* * (non-Javadoc) - * + * * @see * org.springframework.security.config.annotation.web.HttpBuilder#addFilterAfter(javax * .servlet.Filter, java.lang.Class) @@ -995,7 +995,7 @@ public final class HttpSecurity extends /* * (non-Javadoc) - * + * * @see * org.springframework.security.config.annotation.web.HttpBuilder#addFilterBefore( * javax.servlet.Filter, java.lang.Class) @@ -1008,7 +1008,7 @@ public final class HttpSecurity extends /* * (non-Javadoc) - * + * * @see * org.springframework.security.config.annotation.web.HttpBuilder#addFilter(javax. * servlet.Filter) @@ -1048,16 +1048,24 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class RequestMatchersSecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { - * http.requestMatchers().antMatchers("/api/**", "/oauth/**").and() - * .authorizeRequests().antMatchers("/**").hasRole("USER").and().httpBasic(); + * http + * .requestMatchers() + * .antMatchers("/api/**", "/oauth/**") + * .and() + * .authorizeRequests() + * .antMatchers("/**").hasRole("USER") + * .and() + * .httpBasic(); * } - * + * * @Override * protected void configure(AuthenticationManagerBuilder auth) throws Exception { - * auth.inMemoryAuthentication().withUser("user").password("password").roles("USER"); + * auth + * .inMemoryAuthentication() + * .withUser("user").password("password").roles("USER"); * } * } * @@ -1068,16 +1076,25 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class RequestMatchersSecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { - * http.requestMatchers().antMatchers("/api/**").antMatchers("/oauth/**").and() - * .authorizeRequests().antMatchers("/**").hasRole("USER").and().httpBasic(); + * http + * .requestMatchers() + * .antMatchers("/api/**") + * .antMatchers("/oauth/**") + * .and() + * .authorizeRequests() + * .antMatchers("/**").hasRole("USER") + * .and() + * .httpBasic(); * } - * + * * @Override * protected void configure(AuthenticationManagerBuilder auth) throws Exception { - * auth.inMemoryAuthentication().withUser("user").password("password").roles("USER"); + * auth + * .inMemoryAuthentication() + * .withUser("user").password("password").roles("USER"); * } * } * @@ -1088,17 +1105,27 @@ public final class HttpSecurity extends * @Configuration * @EnableWebSecurity * public class RequestMatchersSecurityConfig extends WebSecurityConfigurerAdapter { - * + * * @Override * protected void configure(HttpSecurity http) throws Exception { - * http.requestMatchers().antMatchers("/api/**").and().requestMatchers() - * .antMatchers("/oauth/**").and().authorizeRequests().antMatchers("/**") - * .hasRole("USER").and().httpBasic(); + * http + * .requestMatchers() + * .antMatchers("/api/**") + * .and() + * .requestMatchers() + * .antMatchers("/oauth/**") + * .and() + * .authorizeRequests() + * .antMatchers("/**").hasRole("USER") + * .and() + * .httpBasic(); * } - * + * * @Override * protected void configure(AuthenticationManagerBuilder auth) throws Exception { - * auth.inMemoryAuthentication().withUser("user").password("password").roles("USER"); + * auth + * .inMemoryAuthentication() + * .withUser("user").password("password").roles("USER"); * } * } *