#
luxiaotao1123
2024-01-27 f36f2ffecba877115ff38f1f6dbd9e338285592c
#
2个文件已修改
2个文件已添加
136 ■■■■■ 已修改文件
zy-asrs-wcs/pom.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/common/Test.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/common/security/SecurityConfig.java 118 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/utils/CodeBuilder.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/pom.xml
@@ -33,6 +33,11 @@
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <!-- okHttp3 -->
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/common/Test.java
New file
@@ -0,0 +1,7 @@
package com.zy.asrs.wcs.common;
/**
 * Created by vincent on 1/27/2024
 */
public class Test {
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/common/security/SecurityConfig.java
New file
@@ -0,0 +1,118 @@
//package com.zy.asrs.wcs.common.security;
//
//import com.zy.acs.manager.common.constant.Constants;
//import com.zy.acs.manager.common.utils.CommonUtil;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.http.HttpMethod;
//import org.springframework.security.access.AccessDeniedException;
//import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
//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.configuration.WebSecurityConfigurerAdapter;
//import org.springframework.security.config.http.SessionCreationPolicy;
//import org.springframework.security.core.AuthenticationException;
//import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
//import org.springframework.security.web.AuthenticationEntryPoint;
//import org.springframework.security.web.access.AccessDeniedHandler;
//import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//import javax.servlet.ServletException;
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.IOException;
//
///**
// * Spring Security配置
// *
// */
//@Configuration
//@EnableWebSecurity
//@EnableGlobalMethodSecurity(prePostEnabled = true)
//public class SecurityConfig extends WebSecurityConfigurerAdapter {
//
//    public static final String[] FILTER_PATH = new String[]{
//            "/test/**",
//            "/rpc/**",
//            "/api/login",
//            "/druid/**",
//            "/swagger-ui.html",
//            "/swagger-resources/**",
//            "/webjars/**",
//            "/v2/api-docs",
//            "/v3/api-docs",
//            "/swagger-ui/**"
//    };
//
//    @Resource
//    private JwtAccessDeniedHandler jwtAccessDeniedHandler;
//    @Resource
//    private JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint;
//    @Resource
//    private JwtAuthenticationFilter jwtAuthenticationFilter;
//
//    @Override
//    protected void configure(HttpSecurity http) throws Exception {
//        http.authorizeRequests()
//                .antMatchers(HttpMethod.OPTIONS, "/**")
//                .permitAll()
//                .antMatchers(HttpMethod.GET, "/api/file/**", "/api/captcha", "/")
//                .permitAll()
//                .antMatchers(FILTER_PATH)
//                .permitAll()
//                .anyRequest()
//                .authenticated()
//                .and()
//                .sessionManagement()
//                .sessionCreationPolicy(SessionCreationPolicy.STATELESS)
//                .and()
//                .csrf()
//                .disable()
//                .cors()
//                .and()
//                .logout()
//                .disable()
//                .headers()
//                .frameOptions()
//                .disable()
//                .and()
//                .exceptionHandling()
//                .accessDeniedHandler(jwtAccessDeniedHandler)
//                .authenticationEntryPoint(jwtAuthenticationEntryPoint)
//                .and()
//                .addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
//    }
//
//    @Bean
//    public BCryptPasswordEncoder bCryptPasswordEncoder() {
//        return new BCryptPasswordEncoder();
//    }
//
//    // 没有访问权限异常处理
//    @Component
//    static class JwtAccessDeniedHandler implements AccessDeniedHandler {
//
//        @Override
//        public void handle(HttpServletRequest request, HttpServletResponse response, AccessDeniedException e)
//                throws IOException, ServletException {
//            CommonUtil.responseError(response, Constants.UNAUTHORIZED_CODE, Constants.UNAUTHORIZED_MSG, e.getMessage());
//        }
//
//    }
//
//    // 没有登录异常处理
//    @Component
//    static class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint {
//
//        @Override
//        public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e)
//                throws IOException, ServletException {
//            CommonUtil.responseError(response, Constants.UNAUTHENTICATED_CODE, Constants.UNAUTHENTICATED_MSG,
//                    e.getMessage());
//        }
//
//    }
//
//}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/utils/CodeBuilder.java
@@ -18,14 +18,14 @@
//        generator.table="sys_host";
        // sqlserver
        generator.sqlOsType = SqlOsType.SQL_SERVER;
        generator.backendPrefixPath = "zy-asrs-common/";
        generator.backendPrefixPath = "zy-asrs-wcs/";
        generator.frontendPrefixPath = "zy-asrs-wcs/";
        generator.url="47.97.1.152:51433;databasename=jkasrs";
        generator.username="sa";
        generator.password="Zoneyung@zy56$";
        generator.table="wcs_crn";
        generator.packagePath="com.zy.asrs.common.wcs";
        generator.table="rcs_host";
        generator.packagePath="com.zy.asrs.wcs.sys";
        generator.build();
    }