[JAVA-28947] Update Spring Activiti module to Spring Boot 3 (#16064)
This commit is contained in:
parent
f10bbc57fa
commit
ddb9c4941b
|
@ -10,11 +10,19 @@
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.baeldung</groupId>
|
<groupId>com.baeldung</groupId>
|
||||||
<artifactId>parent-boot-2</artifactId>
|
<artifactId>parent-boot-3</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<relativePath>../parent-boot-2</relativePath>
|
<relativePath>../parent-boot-3</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>alfresco</id>
|
||||||
|
<name>alfresco</name>
|
||||||
|
<url>https://artifacts.alfresco.com/nexus/content/repositories/public/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.activiti</groupId>
|
<groupId>org.activiti</groupId>
|
||||||
|
@ -59,7 +67,7 @@
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<activiti.version>7.1.0.M6</activiti.version>
|
<activiti.version>8.0.0</activiti.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -3,11 +3,11 @@ package com.baeldung.activiti.security.config;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableWebMvc
|
@EnableWebMvc
|
||||||
public class MvcConfig extends WebMvcConfigurerAdapter {
|
public class MvcConfig implements WebMvcConfigurer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addViewControllers(ViewControllerRegistry registry) {
|
public void addViewControllers(ViewControllerRegistry registry) {
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.baeldung.activiti.security.withspring;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
|
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
|
||||||
import org.springframework.security.core.userdetails.User;
|
import org.springframework.security.core.userdetails.User;
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||||
|
@ -14,28 +15,25 @@ public class SecurityConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
|
||||||
http.antMatcher("/**")
|
http.authorizeHttpRequests(auth -> auth
|
||||||
.authorizeRequests()
|
.requestMatchers("/protected-process*")
|
||||||
.antMatchers("/protected-process*")
|
.authenticated()
|
||||||
.authenticated()
|
.anyRequest()
|
||||||
.anyRequest()
|
.permitAll())
|
||||||
.permitAll()
|
.formLogin(login -> login
|
||||||
.and()
|
.loginPage("/login")
|
||||||
.formLogin()
|
.defaultSuccessUrl("/homepage")
|
||||||
.loginPage("/login")
|
.failureUrl("/login?error=true")
|
||||||
.defaultSuccessUrl("/homepage")
|
.permitAll())
|
||||||
.failureUrl("/login?error=true")
|
.csrf(AbstractHttpConfigurer::disable)
|
||||||
.and()
|
.logout(logout -> logout.logoutSuccessUrl("/login"));
|
||||||
.csrf()
|
|
||||||
.disable()
|
|
||||||
.logout()
|
|
||||||
.logoutSuccessUrl("/login");
|
|
||||||
return http.build();
|
return http.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public UserDetailsService userDetailsService() {
|
public UserDetailsService userDetailsService() {
|
||||||
UserDetails user = User.withUsername("user")
|
User.UserBuilder users = User.withDefaultPasswordEncoder();
|
||||||
|
UserDetails user = users.username("user")
|
||||||
.password("{noop}pass")
|
.password("{noop}pass")
|
||||||
.authorities("ROLE_ACTIVITI_USER")
|
.authorities("ROLE_ACTIVITI_USER")
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<html>
|
||||||
|
<head></head>
|
||||||
|
<body>
|
||||||
|
<h1>Home page</h1>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue