|
@@ -1611,14 +1611,18 @@ public final class HttpSecurity extends
|
|
* <pre>
|
|
* <pre>
|
|
* @Configuration
|
|
* @Configuration
|
|
* @EnableWebSecurity
|
|
* @EnableWebSecurity
|
|
- * public class AnononymousSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
|
|
|
|
+ * public class AnonymousSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
*
|
|
*
|
|
* @Override
|
|
* @Override
|
|
* protected void configure(HttpSecurity http) throws Exception {
|
|
* protected void configure(HttpSecurity http) throws Exception {
|
|
- * http.authorizeRequests().antMatchers("/**").hasRole("USER").and().formLogin()
|
|
|
|
|
|
+ * http
|
|
|
|
+ * .authorizeRequests()
|
|
|
|
+ * .antMatchers("/**").hasRole("USER")
|
|
* .and()
|
|
* .and()
|
|
- * // sample anonymous customization
|
|
|
|
- * .anonymous().authorities("ROLE_ANON");
|
|
|
|
|
|
+ * .formLogin()
|
|
|
|
+ * .and()
|
|
|
|
+ * // sample anonymous customization
|
|
|
|
+ * .anonymous().authorities("ROLE_ANON");
|
|
* }
|
|
* }
|
|
*
|
|
*
|
|
* @Override
|
|
* @Override
|
|
@@ -1635,14 +1639,18 @@ public final class HttpSecurity extends
|
|
* <pre>
|
|
* <pre>
|
|
* @Configuration
|
|
* @Configuration
|
|
* @EnableWebSecurity
|
|
* @EnableWebSecurity
|
|
- * public class AnononymousSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
|
|
|
|
+ * public class AnonymousSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
*
|
|
*
|
|
* @Override
|
|
* @Override
|
|
* protected void configure(HttpSecurity http) throws Exception {
|
|
* protected void configure(HttpSecurity http) throws Exception {
|
|
- * http.authorizeRequests().antMatchers("/**").hasRole("USER").and().formLogin()
|
|
|
|
|
|
+ * http
|
|
|
|
+ * .authorizeRequests()
|
|
|
|
+ * .antMatchers("/**").hasRole("USER")
|
|
|
|
+ * .and()
|
|
|
|
+ * .formLogin()
|
|
* .and()
|
|
* .and()
|
|
- * // sample anonymous customization
|
|
|
|
- * .anonymous().disabled();
|
|
|
|
|
|
+ * // sample anonymous customization
|
|
|
|
+ * .anonymous().disable();
|
|
* }
|
|
* }
|
|
*
|
|
*
|
|
* @Override
|
|
* @Override
|
|
@@ -1674,7 +1682,7 @@ public final class HttpSecurity extends
|
|
* <pre>
|
|
* <pre>
|
|
* @Configuration
|
|
* @Configuration
|
|
* @EnableWebSecurity
|
|
* @EnableWebSecurity
|
|
- * public class AnononymousSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
|
|
|
|
+ * public class AnonymousSecurityConfig extends WebSecurityConfigurerAdapter {
|
|
*
|
|
*
|
|
* @Override
|
|
* @Override
|
|
* protected void configure(HttpSecurity http) throws Exception {
|
|
* protected void configure(HttpSecurity http) throws Exception {
|
|
@@ -1712,9 +1720,14 @@ public final class HttpSecurity extends
|
|
* .formLogin(withDefaults())
|
|
* .formLogin(withDefaults())
|
|
* // sample anonymous customization
|
|
* // sample anonymous customization
|
|
* .anonymous(anonymous ->
|
|
* .anonymous(anonymous ->
|
|
- * anonymous.disabled()
|
|
|
|
|
|
+ * anonymous.disable()
|
|
* );
|
|
* );
|
|
* }
|
|
* }
|
|
|
|
+ *
|
|
|
|
+ * @Override
|
|
|
|
+ * protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
|
|
|
+ * auth.inMemoryAuthentication().withUser("user").password("password").roles("USER");
|
|
|
|
+ * }
|
|
* }
|
|
* }
|
|
* </pre>
|
|
* </pre>
|
|
*
|
|
*
|