升级1.8.0版本,设置登录账号密码

This commit is contained in:
JEECG
2024-08-20 19:45:34 +08:00
parent 843391f845
commit c03c2802b5
9 changed files with 378 additions and 5 deletions

View File

@@ -20,7 +20,7 @@
org.jeecg.modules.JimuReportApplication
- 第四步: 访问项目
- 第四步: 访问项目默认账号admin 密码123456
报表工作台: http://localhost:8085/jmreport/list
@@ -51,7 +51,7 @@ Docker镜像制作
docker-compose up -d
- 第五步:访问报表
- 第五步:访问报表默认账号admin 密码123456
报表工作台: http://localhost:8085/jmreport/list

View File

@@ -12,7 +12,7 @@
<name>jimureport-example</name>
<groupId>org.jeecg</groupId>
<artifactId>jimureport-example</artifactId>
<version>1.7</version>
<version>1.8</version>
<url>http://www.jimureport.com</url>
<description>积木报表集成示例</description>
@@ -45,7 +45,7 @@
</repositories>
<properties>
<jimureport.version>1.7.9</jimureport.version>
<jimureport.version>1.8.0</jimureport.version>
<java.version>1.8</java.version>
<minio.version>8.0.3</minio.version>
<!-- DB驱动 -->
@@ -73,6 +73,12 @@
<groupId>org.jeecgframework.jimureport</groupId>
<artifactId>jimureport-dashboard-spring-boot-starter</artifactId>
<version>1.8.0-beta</version>
<exclusions>
<exclusion>
<groupId>org.jeecgframework.jimureport</groupId>
<artifactId>jimureport-spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- mogodb和redis支持 -->
<dependency>
@@ -98,6 +104,12 @@
<artifactId>spring-boot-starter-freemarker</artifactId>
</dependency>
<!--spring security-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- minio oss-->
<dependency>
<groupId>io.minio</groupId>

View File

@@ -0,0 +1,27 @@
package com.jeecg.modules.jmreport.config;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
/**
* 自定义springsecurity登录成功处理
* [TV360X-1884]jimureport-example集成简单的 spring security设置登录账号密码
* @author chenrui
* @date 2024/8/2 16:26
*/
public class CustomLoginSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler {
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws IOException, ServletException {
HttpSession session = request.getSession();
session.setAttribute("loginFrom", "jimu_example");
super.onAuthenticationSuccess(request, response, authentication);
}
}

View File

@@ -0,0 +1,38 @@
package com.jeecg.modules.jmreport.config;
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.web.SecurityFilterChain;
/**
* spring security 配置
* [TV360X-1884]jimureport-example集成简单的 spring security设置登录账号密码
* @Author chenrui
* @Date 2024-07-23
*/
@Configuration
@EnableWebSecurity
public class SpringSecurityConfig {
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http.csrf().disable()
.authorizeRequests()
.antMatchers("/login/**").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login/login.html")
.loginProcessingUrl("/login")
.successHandler(new CustomLoginSuccessHandler())
.permitAll().and()
.logout()
.invalidateHttpSession(true)
.clearAuthentication(true).permitAll();
return http.build();
}
}

View File

@@ -1,6 +1,7 @@
package com.jeecg.modules.jmreport.testdb;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.jmreport.common.util.OkConvertUtils;
import org.jeecg.modules.jmreport.desreport.model.JmPage;
import org.jeecg.modules.jmreport.api.data.IDataSetFactory;
import org.springframework.stereotype.Component;
@@ -60,7 +61,7 @@ public class TestRpSpringBean implements IDataSetFactory {
JmPage page = new JmPage();
List<Map<String, Object>> ls = new ArrayList<>();
int pageSize = Integer.parseInt(param.get("pageSize").toString());
int pageSize = OkConvertUtils.getInt(param.get("pageSize").toString(),1);
Map<String, Object> obj2 = new HashMap<>();
obj2.put("name", "张三");

View File

@@ -7,6 +7,10 @@ spring:
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
security:
user:
name: "admin"
password: "123456"
#配置freemarker
freemarker:
# 设置模板后缀名

View File

@@ -7,6 +7,10 @@ spring:
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
security:
user:
name: "admin"
password: "123456"
#配置freemarker
freemarker:
# 设置模板后缀名

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long