فهرست منبع

Some formatting fixes for HttpSecurity Javadoc

Rob Winch 9 سال پیش
والد
کامیت
be36ddb614
1فایلهای تغییر یافته به همراه85 افزوده شده و 58 حذف شده
  1. 85 58
      config/src/main/java/org/springframework/security/config/annotation/web/builders/HttpSecurity.java

+ 85 - 58
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");
 	 * 	}
 	 * }
 	 * </pre>
@@ -1068,16 +1076,25 @@ public final class HttpSecurity extends
 	 * &#064;Configuration
 	 * &#064;EnableWebSecurity
 	 * public class RequestMatchersSecurityConfig extends WebSecurityConfigurerAdapter {
-	 * 
+	 *
 	 * 	&#064;Override
 	 * 	protected void configure(HttpSecurity http) throws Exception {
-	 * 		http.requestMatchers().antMatchers(&quot;/api/**&quot;).antMatchers(&quot;/oauth/**&quot;).and()
-	 * 				.authorizeRequests().antMatchers(&quot;/**&quot;).hasRole(&quot;USER&quot;).and().httpBasic();
+	 * 		http
+	 * 			.requestMatchers()
+	 * 				.antMatchers(&quot;/api/**&quot;)
+	 * 				.antMatchers(&quot;/oauth/**&quot;)
+	 * 				.and()
+	 * 			.authorizeRequests()
+	 * 				.antMatchers(&quot;/**&quot;).hasRole(&quot;USER&quot;)
+	 * 				.and()
+	 * 			.httpBasic();
 	 * 	}
-	 * 
+	 *
 	 * 	&#064;Override
 	 * 	protected void configure(AuthenticationManagerBuilder auth) throws Exception {
-	 * 		auth.inMemoryAuthentication().withUser(&quot;user&quot;).password(&quot;password&quot;).roles(&quot;USER&quot;);
+	 * 		auth
+	 * 			.inMemoryAuthentication()
+	 * 				.withUser(&quot;user&quot;).password(&quot;password&quot;).roles(&quot;USER&quot;);
 	 * 	}
 	 * }
 	 * </pre>
@@ -1088,17 +1105,27 @@ public final class HttpSecurity extends
 	 * &#064;Configuration
 	 * &#064;EnableWebSecurity
 	 * public class RequestMatchersSecurityConfig extends WebSecurityConfigurerAdapter {
-	 * 
+	 *
 	 * 	&#064;Override
 	 * 	protected void configure(HttpSecurity http) throws Exception {
-	 * 		http.requestMatchers().antMatchers(&quot;/api/**&quot;).and().requestMatchers()
-	 * 				.antMatchers(&quot;/oauth/**&quot;).and().authorizeRequests().antMatchers(&quot;/**&quot;)
-	 * 				.hasRole(&quot;USER&quot;).and().httpBasic();
+	 * 		http
+	 * 			.requestMatchers()
+	 * 				.antMatchers(&quot;/api/**&quot;)
+	 * 				.and()
+	 *			 .requestMatchers()
+	 * 				.antMatchers(&quot;/oauth/**&quot;)
+	 * 				.and()
+	 * 			.authorizeRequests()
+	 * 				.antMatchers(&quot;/**&quot;).hasRole(&quot;USER&quot;)
+	 * 				.and()
+	 * 			.httpBasic();
 	 * 	}
-	 * 
+	 *
 	 * 	&#064;Override
 	 * 	protected void configure(AuthenticationManagerBuilder auth) throws Exception {
-	 * 		auth.inMemoryAuthentication().withUser(&quot;user&quot;).password(&quot;password&quot;).roles(&quot;USER&quot;);
+	 * 		auth
+	 * 			.inMemoryAuthentication()
+	 * 				.withUser(&quot;user&quot;).password(&quot;password&quot;).roles(&quot;USER&quot;);
 	 * 	}
 	 * }
 	 * </pre>