diff --git a/2025-05/spring-20-SS-start/2.7-style/pom.xml b/2025-05/spring-20-SS-start/2.7-style/pom.xml
new file mode 100644
index 00000000..25baa882
--- /dev/null
+++ b/2025-05/spring-20-SS-start/2.7-style/pom.xml
@@ -0,0 +1,53 @@
+
+
+ 4.0.0
+
+ ru.otus
+ spring-framework-23-ss-start
+ 1.0-SNAPSHOT
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.7.8
+
+
+
+ 17
+ 17
+ 17
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
diff --git a/2025-05/spring-20-SS-start/2.7-style/src/main/java/ru/otus/spring/Main.java b/2025-05/spring-20-SS-start/2.7-style/src/main/java/ru/otus/spring/Main.java
new file mode 100644
index 00000000..95fa70ed
--- /dev/null
+++ b/2025-05/spring-20-SS-start/2.7-style/src/main/java/ru/otus/spring/Main.java
@@ -0,0 +1,12 @@
+package ru.otus.spring;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Main {
+
+ public static void main( String[] args ) {
+ SpringApplication.run( Main.class );
+ }
+}
diff --git a/2025-05/spring-20-SS-start/2.7-style/src/main/java/ru/otus/spring/rest/PagesController.java b/2025-05/spring-20-SS-start/2.7-style/src/main/java/ru/otus/spring/rest/PagesController.java
new file mode 100644
index 00000000..47321812
--- /dev/null
+++ b/2025-05/spring-20-SS-start/2.7-style/src/main/java/ru/otus/spring/rest/PagesController.java
@@ -0,0 +1,28 @@
+package ru.otus.spring.rest;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+
+@Controller
+public class PagesController {
+
+ @GetMapping("/")
+ public String indexPage() {
+ return "index";
+ }
+
+ @GetMapping("/public")
+ public String publicPage() {
+ return "public";
+ }
+
+ @GetMapping("/authenticated")
+ public String authenticatedPage() {
+ return "authenticated";
+ }
+
+ @GetMapping("/success")
+ public String successPage() {
+ return "success";
+ }
+}
diff --git a/2025-05/spring-20-SS-start/2.7-style/src/main/java/ru/otus/spring/security/SecurityConfiguration.java b/2025-05/spring-20-SS-start/2.7-style/src/main/java/ru/otus/spring/security/SecurityConfiguration.java
new file mode 100644
index 00000000..a708cc22
--- /dev/null
+++ b/2025-05/spring-20-SS-start/2.7-style/src/main/java/ru/otus/spring/security/SecurityConfiguration.java
@@ -0,0 +1,49 @@
+package ru.otus.spring.security;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.core.userdetails.User;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.crypto.password.NoOpPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.security.provisioning.InMemoryUserDetailsManager;
+import org.springframework.security.web.SecurityFilterChain;
+
+@Configuration
+@EnableWebSecurity
+public class SecurityConfiguration {
+
+ @Bean
+ public SecurityFilterChain securityFilterChain( HttpSecurity http ) throws Exception {
+ http
+ .csrf().disable()
+ .authorizeHttpRequests( ( authorize ) -> authorize
+ .antMatchers( "/public" ).permitAll()
+ .antMatchers( "/authenticated" ).authenticated()
+ .anyRequest().permitAll()
+ )
+ .httpBasic();
+ return http.build();
+ }
+
+
+ @Bean
+ public PasswordEncoder passwordEncoder() {
+// return new BCryptPasswordEncoder(10);
+ return NoOpPasswordEncoder.getInstance();
+
+ }
+
+ @Bean
+ public InMemoryUserDetailsManager userDetailsService() {
+ UserDetails user = User
+ .builder()
+ .username( "user" )
+ .password( "password" )
+ .roles( "USER" )
+ .build();
+ return new InMemoryUserDetailsManager( user );
+ }
+}
diff --git a/2025-05/spring-20-SS-start/2.7-style/src/main/resources/application.yml b/2025-05/spring-20-SS-start/2.7-style/src/main/resources/application.yml
new file mode 100644
index 00000000..e69de29b
diff --git a/2025-05/spring-20-SS-start/2.7-style/src/main/resources/templates/authenticated.html b/2025-05/spring-20-SS-start/2.7-style/src/main/resources/templates/authenticated.html
new file mode 100644
index 00000000..9f8b0d7e
--- /dev/null
+++ b/2025-05/spring-20-SS-start/2.7-style/src/main/resources/templates/authenticated.html
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+Только для авторизованных
+
+
diff --git a/2025-05/spring-20-SS-start/2.7-style/src/main/resources/templates/index.html b/2025-05/spring-20-SS-start/2.7-style/src/main/resources/templates/index.html
new file mode 100644
index 00000000..f4d11090
--- /dev/null
+++ b/2025-05/spring-20-SS-start/2.7-style/src/main/resources/templates/index.html
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+/public
+
+/authenticated
+
+
diff --git a/2025-05/spring-20-SS-start/2.7-style/src/main/resources/templates/public.html b/2025-05/spring-20-SS-start/2.7-style/src/main/resources/templates/public.html
new file mode 100644
index 00000000..77188469
--- /dev/null
+++ b/2025-05/spring-20-SS-start/2.7-style/src/main/resources/templates/public.html
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+Доступен всем
+
+
diff --git a/2025-05/spring-20-SS-start/2.7-style/src/main/resources/templates/success.html b/2025-05/spring-20-SS-start/2.7-style/src/main/resources/templates/success.html
new file mode 100644
index 00000000..89db5f22
--- /dev/null
+++ b/2025-05/spring-20-SS-start/2.7-style/src/main/resources/templates/success.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Вы успешно вошли
+
+
+Вы успешно вошли
+
+
diff --git a/2025-05/spring-20-SS-start/3.x-style/pom.xml b/2025-05/spring-20-SS-start/3.x-style/pom.xml
new file mode 100644
index 00000000..376b0077
--- /dev/null
+++ b/2025-05/spring-20-SS-start/3.x-style/pom.xml
@@ -0,0 +1,53 @@
+
+
+ 4.0.0
+
+ ru.otus
+ spring-framework-23-ss-start
+ 1.0-SNAPSHOT
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 3.3.6
+
+
+
+ 17
+ 17
+ 17
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
diff --git a/2025-05/spring-20-SS-start/3.x-style/src/main/java/ru/otus/spring/Main.java b/2025-05/spring-20-SS-start/3.x-style/src/main/java/ru/otus/spring/Main.java
new file mode 100644
index 00000000..3a3edb94
--- /dev/null
+++ b/2025-05/spring-20-SS-start/3.x-style/src/main/java/ru/otus/spring/Main.java
@@ -0,0 +1,13 @@
+package ru.otus.spring;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Main {
+
+ public static void main( String[] args ) {
+ SpringApplication.run( Main.class );
+ // http://localhost:8080/
+ }
+}
diff --git a/2025-05/spring-20-SS-start/3.x-style/src/main/java/ru/otus/spring/rest/PagesController.java b/2025-05/spring-20-SS-start/3.x-style/src/main/java/ru/otus/spring/rest/PagesController.java
new file mode 100644
index 00000000..47321812
--- /dev/null
+++ b/2025-05/spring-20-SS-start/3.x-style/src/main/java/ru/otus/spring/rest/PagesController.java
@@ -0,0 +1,28 @@
+package ru.otus.spring.rest;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+
+@Controller
+public class PagesController {
+
+ @GetMapping("/")
+ public String indexPage() {
+ return "index";
+ }
+
+ @GetMapping("/public")
+ public String publicPage() {
+ return "public";
+ }
+
+ @GetMapping("/authenticated")
+ public String authenticatedPage() {
+ return "authenticated";
+ }
+
+ @GetMapping("/success")
+ public String successPage() {
+ return "success";
+ }
+}
diff --git a/2025-05/spring-20-SS-start/3.x-style/src/main/java/ru/otus/spring/security/SecurityConfiguration.java b/2025-05/spring-20-SS-start/3.x-style/src/main/java/ru/otus/spring/security/SecurityConfiguration.java
new file mode 100644
index 00000000..f5150102
--- /dev/null
+++ b/2025-05/spring-20-SS-start/3.x-style/src/main/java/ru/otus/spring/security/SecurityConfiguration.java
@@ -0,0 +1,51 @@
+package ru.otus.spring.security;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.security.config.Customizer;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
+import org.springframework.security.core.userdetails.User;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.crypto.password.NoOpPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
+import org.springframework.security.provisioning.InMemoryUserDetailsManager;
+import org.springframework.security.web.SecurityFilterChain;
+
+@Configuration
+@EnableWebSecurity
+public class SecurityConfiguration {
+
+ @Bean
+ public SecurityFilterChain securityFilterChain( HttpSecurity http ) throws Exception {
+ http
+ .csrf(AbstractHttpConfigurer::disable)
+ .authorizeHttpRequests( ( authorize ) -> authorize
+ .requestMatchers( "/public" ).permitAll()
+ .requestMatchers( "/authenticated" ).authenticated()
+ .anyRequest().permitAll()
+ )
+ .httpBasic(Customizer.withDefaults());
+ return http.build();
+ }
+
+
+ @Bean
+ public PasswordEncoder passwordEncoder() {
+// return new BCryptPasswordEncoder(10);
+ return NoOpPasswordEncoder.getInstance();
+
+ }
+
+ @Bean
+ public InMemoryUserDetailsManager userDetailsService() {
+ UserDetails user = User
+ .builder()
+ .username("user")
+ .password("password")
+ .roles("USER")
+ .build();
+ return new InMemoryUserDetailsManager(user);
+ }
+}
diff --git a/2025-05/spring-20-SS-start/3.x-style/src/main/resources/application.yml b/2025-05/spring-20-SS-start/3.x-style/src/main/resources/application.yml
new file mode 100644
index 00000000..e69de29b
diff --git a/2025-05/spring-20-SS-start/3.x-style/src/main/resources/templates/authenticated.html b/2025-05/spring-20-SS-start/3.x-style/src/main/resources/templates/authenticated.html
new file mode 100644
index 00000000..9f8b0d7e
--- /dev/null
+++ b/2025-05/spring-20-SS-start/3.x-style/src/main/resources/templates/authenticated.html
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+Только для авторизованных
+
+
diff --git a/2025-05/spring-20-SS-start/3.x-style/src/main/resources/templates/index.html b/2025-05/spring-20-SS-start/3.x-style/src/main/resources/templates/index.html
new file mode 100644
index 00000000..f4d11090
--- /dev/null
+++ b/2025-05/spring-20-SS-start/3.x-style/src/main/resources/templates/index.html
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+/public
+
+/authenticated
+
+
diff --git a/2025-05/spring-20-SS-start/3.x-style/src/main/resources/templates/public.html b/2025-05/spring-20-SS-start/3.x-style/src/main/resources/templates/public.html
new file mode 100644
index 00000000..77188469
--- /dev/null
+++ b/2025-05/spring-20-SS-start/3.x-style/src/main/resources/templates/public.html
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+Доступен всем
+
+
diff --git a/2025-05/spring-20-SS-start/3.x-style/src/main/resources/templates/success.html b/2025-05/spring-20-SS-start/3.x-style/src/main/resources/templates/success.html
new file mode 100644
index 00000000..89db5f22
--- /dev/null
+++ b/2025-05/spring-20-SS-start/3.x-style/src/main/resources/templates/success.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Вы успешно вошли
+
+
+Вы успешно вошли
+
+
diff --git a/2025-05/spring-20-SS-start/old-style/pom.xml b/2025-05/spring-20-SS-start/old-style/pom.xml
new file mode 100644
index 00000000..d0b19bbc
--- /dev/null
+++ b/2025-05/spring-20-SS-start/old-style/pom.xml
@@ -0,0 +1,53 @@
+
+
+ 4.0.0
+
+ ru.otus
+ spring-framework-23-spring-security-3x-start
+ 1.0-SNAPSHOT
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.7.8
+
+
+
+ 17
+ 17
+ 17
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-thymeleaf
+
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
diff --git a/2025-05/spring-20-SS-start/old-style/src/main/java/ru/otus/spring/Main.java b/2025-05/spring-20-SS-start/old-style/src/main/java/ru/otus/spring/Main.java
new file mode 100644
index 00000000..95fa70ed
--- /dev/null
+++ b/2025-05/spring-20-SS-start/old-style/src/main/java/ru/otus/spring/Main.java
@@ -0,0 +1,12 @@
+package ru.otus.spring;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Main {
+
+ public static void main( String[] args ) {
+ SpringApplication.run( Main.class );
+ }
+}
diff --git a/2025-05/spring-20-SS-start/old-style/src/main/java/ru/otus/spring/rest/PagesController.java b/2025-05/spring-20-SS-start/old-style/src/main/java/ru/otus/spring/rest/PagesController.java
new file mode 100644
index 00000000..47321812
--- /dev/null
+++ b/2025-05/spring-20-SS-start/old-style/src/main/java/ru/otus/spring/rest/PagesController.java
@@ -0,0 +1,28 @@
+package ru.otus.spring.rest;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+
+@Controller
+public class PagesController {
+
+ @GetMapping("/")
+ public String indexPage() {
+ return "index";
+ }
+
+ @GetMapping("/public")
+ public String publicPage() {
+ return "public";
+ }
+
+ @GetMapping("/authenticated")
+ public String authenticatedPage() {
+ return "authenticated";
+ }
+
+ @GetMapping("/success")
+ public String successPage() {
+ return "success";
+ }
+}
diff --git a/2025-05/spring-20-SS-start/old-style/src/main/java/ru/otus/spring/security/SecurityConfiguration.java b/2025-05/spring-20-SS-start/old-style/src/main/java/ru/otus/spring/security/SecurityConfiguration.java
new file mode 100644
index 00000000..89ef82be
--- /dev/null
+++ b/2025-05/spring-20-SS-start/old-style/src/main/java/ru/otus/spring/security/SecurityConfiguration.java
@@ -0,0 +1,70 @@
+package ru.otus.spring.security;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
+import org.springframework.security.crypto.password.NoOpPasswordEncoder;
+import org.springframework.security.crypto.password.PasswordEncoder;
+
+@EnableWebSecurity
+public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
+
+ @Override
+ public void configure( WebSecurity web ) {
+ web.ignoring()
+ .antMatchers( "/" )
+ .antMatchers( "/static/**" ); // You are asking Spring Security to ignore Ant [pattern='/static/**']. This is not recommended -- please use permitAll via HttpSecurity#authorizeHttpRequests instead.
+ }
+
+ @Override
+ public void configure( HttpSecurity http ) throws Exception {
+ http.csrf().disable()
+ // По умолчанию SecurityContext хранится в сессии. Эта часть вырубает и каждый запросом приходитТ
+// .sessionManagement()
+// .sessionCreationPolicy(SessionCreationPolicy.ALWAYS)
+// .and()
+ .authorizeRequests()
+ .antMatchers( "/public/" ).anonymous()
+ .and()
+ .authorizeRequests()
+ .antMatchers( "/authenticated" ).authenticated()
+// .and()
+// .authorizeRequests().antMatchers("/public").authenticated()
+ .and()
+ .formLogin()
+ .and()
+ .anonymous()
+ .principal( "anonymous" )
+ .and()
+ .rememberMe().key( "Some secret" )
+ ;
+ }
+
+ @Bean
+ public PasswordEncoder passwordEncoder() {
+// return new BCryptPasswordEncoder(10);
+ return NoOpPasswordEncoder.getInstance();
+// return new PasswordEncoder() {
+// @Override
+// public String encode(CharSequence charSequence) {
+// return charSequence.toString();
+// }
+//
+// @Override
+// public boolean matches(CharSequence charSequence, String s) {
+// return charSequence.toString().equals(s);
+// }
+// };
+ }
+
+ @Autowired
+ public void configure( AuthenticationManagerBuilder auth ) throws Exception {
+ auth.inMemoryAuthentication()
+ .withUser( "admin" ).password( "password" ).roles( "ADMIN" )
+ ;
+ }
+}
diff --git a/2025-05/spring-20-SS-start/old-style/src/main/resources/application.yml b/2025-05/spring-20-SS-start/old-style/src/main/resources/application.yml
new file mode 100644
index 00000000..e69de29b
diff --git a/2025-05/spring-20-SS-start/old-style/src/main/resources/templates/authenticated.html b/2025-05/spring-20-SS-start/old-style/src/main/resources/templates/authenticated.html
new file mode 100644
index 00000000..9f8b0d7e
--- /dev/null
+++ b/2025-05/spring-20-SS-start/old-style/src/main/resources/templates/authenticated.html
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+Только для авторизованных
+
+
diff --git a/2025-05/spring-20-SS-start/old-style/src/main/resources/templates/index.html b/2025-05/spring-20-SS-start/old-style/src/main/resources/templates/index.html
new file mode 100644
index 00000000..f4d11090
--- /dev/null
+++ b/2025-05/spring-20-SS-start/old-style/src/main/resources/templates/index.html
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+/public
+
+/authenticated
+
+
diff --git a/2025-05/spring-20-SS-start/old-style/src/main/resources/templates/public.html b/2025-05/spring-20-SS-start/old-style/src/main/resources/templates/public.html
new file mode 100644
index 00000000..77188469
--- /dev/null
+++ b/2025-05/spring-20-SS-start/old-style/src/main/resources/templates/public.html
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+Доступен всем
+
+
diff --git a/2025-05/spring-20-SS-start/old-style/src/main/resources/templates/success.html b/2025-05/spring-20-SS-start/old-style/src/main/resources/templates/success.html
new file mode 100644
index 00000000..89db5f22
--- /dev/null
+++ b/2025-05/spring-20-SS-start/old-style/src/main/resources/templates/success.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Вы успешно вошли
+
+
+Вы успешно вошли
+
+