Quellcode durchsuchen

flowable

master
PoffyZhang vor 1 Jahr
Ursprung
Commit
35b9f65a1b
11 geänderte Dateien mit 51 neuen und 30 gelöschten Zeilen
  1. +6
    -6
      pmapi/pom.xml
  2. +2
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/App.java
  3. +18
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConstant.java
  4. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java
  5. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/AuthProperties.java
  6. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/AuthenticationBeanConfig.java
  7. +15
    -14
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/WebSecurityConfig.java
  8. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionConfig.java
  9. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/password/UsernamePasswordAuthSecurityConfig.java
  10. +4
    -0
      pmapi/src/main/resources/security/auth-dev.yml
  11. +0
    -5
      pom.xml

+ 6
- 6
pmapi/pom.xml Datei anzeigen

@@ -14,11 +14,6 @@
</properties>

<dependencies>
<!--Spring boot 安全框架-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
@@ -163,7 +158,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<!-- <scope>test</scope>-->
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
@@ -192,6 +187,10 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<!-- <exclusion>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-security</artifactId>-->
<!-- </exclusion>-->
</exclusions>
</dependency>
<dependency>
@@ -207,6 +206,7 @@
<dependency>
<groupId>com.ningdatech</groupId>
<artifactId>nd-flowable-starter</artifactId>
<scope>true</scope>
</dependency>

<dependency>


+ 2
- 0
pmapi/src/main/java/com/ningdatech/pmapi/App.java Datei anzeigen

@@ -4,6 +4,7 @@ import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@@ -11,6 +12,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
* @author liuxinxin
*/
@SpringBootApplication
@EnableAsync
@MapperScan(App.MAPPER_PACKAGES)
@EnableScheduling
@EnableTransactionManagement


+ 18
- 0
pmapi/src/main/java/com/ningdatech/pmapi/common/constant/CommonConstant.java Datei anzeigen

@@ -0,0 +1,18 @@
package com.ningdatech.pmapi.common.constant;

/**
* @description: 常量
* @author: LiuXinXin
* @date: 2022/5/5 17:31
*/
public class CommonConstant {

public static final String COOKIE_KEY = "ND_JSESSION";

public static final Integer EXPORT_PAGE_NUMBER= 1;

public static final Integer EXPORT_PAGE_SIZE= 100000;
public static final String CALL_STATUS = "status";
public static final String CALL_STATUS_OK_VALUE = "ok";

}

+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/handler/GlobalResponseHandler.java Datei anzeigen

@@ -38,7 +38,8 @@ public class GlobalResponseHandler implements ResponseBodyAdvice<Object> {
if (o instanceof String) {
return JSONUtil.toJsonStr(apiResponse);
}
return ApiResponse.ofSuccess(o);
// return ApiResponse.ofSuccess(o);
return o;
}

private Boolean filter(MethodParameter methodParameter) {


pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/AuthProperties.java → pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/AuthProperties.java Datei anzeigen

@@ -1,4 +1,4 @@
package com.ningdatech.pmapi.user.security.auth.config;
package com.ningdatech.pmapi.user.security.auth;

import cn.hutool.core.collection.CollectionUtil;
import com.ningdatech.basic.factory.PropertySourceFactory;

pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/AuthenticationBeanConfig.java → pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/AuthenticationBeanConfig.java Datei anzeigen

@@ -1,4 +1,4 @@
package com.ningdatech.pmapi.user.security.auth.config;
package com.ningdatech.pmapi.user.security.auth;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

+ 15
- 14
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/WebSecurityConfig.java Datei anzeigen

@@ -3,7 +3,7 @@ package com.ningdatech.pmapi.user.security.auth;
import com.ningdatech.basic.util.NdJsonUtil;
import com.ningdatech.basic.util.StrPool;
import com.ningdatech.pmapi.common.constant.BizConst;
import com.ningdatech.pmapi.user.security.auth.config.AuthProperties;
import com.ningdatech.pmapi.common.constant.CommonConstant;
import com.ningdatech.pmapi.user.security.auth.handler.DefaultExpiredSessionStrategy;
import com.ningdatech.pmapi.user.security.auth.password.UsernamePasswordAuthSecurityConfig;
import org.springframework.beans.factory.annotation.Qualifier;
@@ -46,30 +46,30 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
protected void configure(HttpSecurity http) throws Exception {
assemblerPreAuthUrls(http);
http.formLogin()
.and()
.exceptionHandling()
.authenticationEntryPoint(authenticationEntryPoint())
.loginPage(authProperties.getAuthRequireUrl())
.and().apply(usernamePasswordAuthSecurityConfig)
.and()
.authorizeRequests()
.antMatchers(authProperties.getIgnoreAuthUrlsArray()).permitAll()
.anyRequest()
.authenticated()
.and()
.authorizeRequests().antMatchers(authProperties.getIgnoreAuthUrlsArray()).permitAll().anyRequest()
.authenticated().and()
// 防止固定会话攻击,Spring security的默认配置就是如此:
// 登陆成功之后会创建一个新的会话,然后将旧的session信息复制到新的session中(客户端的sessionId变了)
.sessionManagement().invalidSessionUrl(authProperties.getInvalidSessionUrl()).sessionFixation()
.migrateSession()
// .invalidSessionStrategy(defaultInvalidSessionStrategy)
.maximumSessions(10).maxSessionsPreventsLogin(true).expiredSessionStrategy(defaultExpiredSessionStrategy)
.and().and().logout().logoutUrl(authProperties.getLogoutUrl()).logoutSuccessHandler(logoutSuccessHandler)
.deleteCookies(BizConst.COOKIE_KEY)
.maximumSessions(10)
.maxSessionsPreventsLogin(true)
.expiredSessionStrategy(defaultExpiredSessionStrategy)
.and().and()
.logout().logoutUrl(authProperties.getLogoutUrl()).logoutSuccessHandler(logoutSuccessHandler)
.deleteCookies(CommonConstant.COOKIE_KEY)
// .and()
// .cors().configurationSource(corsConfigurationSource())
.and()
// .csrf().disable();
// 开启csrf验证,需要前端同步传入token
.csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
.ignoringAntMatchers(authProperties.getIgnoreCsrfUrlsArray());


// http.anonymous().authenticationFilter(availableUserAuthenticationFilter);
}

private AuthenticationEntryPoint authenticationEntryPoint() {
@@ -94,4 +94,5 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
}
}


}

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/config/RedisSessionConfig.java Datei anzeigen

@@ -1,4 +1,4 @@
//package com.ningdatech.pmapi.user.security.auth.config;
package com.ningdatech.pmapi.user.security.auth.config;//package com.ningdatech.pmapi.user.security.auth.config;
//
//import com.ningdatech.basic.util.StrPool;
//import org.springframework.beans.factory.annotation.Value;


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/password/UsernamePasswordAuthSecurityConfig.java Datei anzeigen

@@ -1,6 +1,6 @@
package com.ningdatech.pmapi.user.security.auth.password;

import com.ningdatech.pmapi.user.security.auth.config.AuthProperties;
import com.ningdatech.pmapi.user.security.auth.AuthProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.security.authentication.AuthenticationManager;


+ 4
- 0
pmapi/src/main/resources/security/auth-dev.yml Datei anzeigen

@@ -19,6 +19,8 @@ security:
- /ok.html
- /open/api/**
- /oa/**
- /wflow/**
- /sys/**
ignore-csrf-urls:
- /api/v1/user/auth/**
- /v2/api-docs
@@ -33,6 +35,8 @@ security:
- /optLog/**
- /dict/**
- /oa/**
- /wflow/**
- /sys/**
role-map:
"engineer":
"project_manager":


+ 0
- 5
pom.xml Datei anzeigen

@@ -106,11 +106,6 @@
<artifactId>flowable-spring-boot-starter-actuator</artifactId>
<version>6.7.2</version>
</dependency>
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot-starter</artifactId>
<version>1.30.0</version>
</dependency>
<!--KingBase-->
<dependency>
<groupId>com.kingbase8</groupId>


Laden…
Abbrechen
Speichern