change: 配置文件更改为生产环境和开发环境
update: 用户状态判定增加用户锁定和用户禁用状态判定. bugfix: 1 增加用户登录成功后返回用户的禁用状态和锁定状态, 2 数据MAPPER增加对应字段的查询
正在显示
9 个修改的文件
包含
176 行增加
和
12 行删除
config/application_dev.yml
0 → 100755
1 | + | ||
2 | +#上传文件的路径,要带斜杠 | ||
3 | +web: | ||
4 | + upload-path: upload/ | ||
5 | +server: | ||
6 | + port: 8066 | ||
7 | + servlet: | ||
8 | + context-path: ${SERVER_CONTEXTPATH:} | ||
9 | +spring: | ||
10 | + devtools: | ||
11 | + add-properties: false | ||
12 | + profiles: | ||
13 | + active: dev | ||
14 | + mvc: | ||
15 | + #静态资源,设置上传文件的访问, | ||
16 | + static-path-pattern: /** | ||
17 | + zipkin: | ||
18 | + base-url: http://192.168.1.63:9411 | ||
19 | + sleuth: | ||
20 | + sampler: | ||
21 | + probability: 0.1 | ||
22 | + resources: | ||
23 | + static-locations: classpath:/META-INF/resources/,classpath:/static,classpath:/resources/,file:${web.upload-path} | ||
24 | + | ||
25 | + application: | ||
26 | + name: cloud-user-center | ||
27 | + redis: | ||
28 | +# host: 127.0.0.1 | ||
29 | + host: 192.168.1.53 | ||
30 | + port: 6379 | ||
31 | + jackson: | ||
32 | + serialization: | ||
33 | + FAIL_ON_EMPTY_BEANS: false | ||
34 | + #springboot2.0之后会把Date类型字段自动给转成UTC字符串 如:1990-11-26T16:00:00.000+0000,如果想转成时间戳在application.properties配置文件增加以下配置 | ||
35 | + date-format: yyyy-MM-dd HH:mm:ss | ||
36 | + #时区必须要设置 | ||
37 | + time-zone: GMT+8 | ||
38 | + #ALWAYS的意思是即时属性为null,仍然也会输出这个key | ||
39 | + default-property-inclusion: always | ||
40 | + | ||
41 | + cloud: | ||
42 | + #eureka主机名,会在控制页面中显示 | ||
43 | + #DEV环境关闭注册。 | ||
44 | + features: | ||
45 | + enabled: true | ||
46 | + discovery: | ||
47 | + enabled: true | ||
48 | + service-registry: | ||
49 | + auto-registration: | ||
50 | + enabled: true | ||
51 | + | ||
52 | + datasource: | ||
53 | + type: com.alibaba.druid.pool.DruidDataSource | ||
54 | + #oracle | ||
55 | + #driver-class-name=oracle.jdbc.OracleDriver | ||
56 | + #url=jdbc:oracle:thin:@10.50.3.68:1521:CGODW | ||
57 | + #username=CGOETL | ||
58 | + #password=1q2w3e4r | ||
59 | + #spring datasource mysql,注意编码配置,缺少数据库编码配置容易引起中文入库乱码 | ||
60 | + url: jdbc:mysql://118.31.66.166:3306/cloud_user_center?useUnicode=true&characterEncoding=utf8 | ||
61 | + username: 110 | ||
62 | + password: QAHqCJf2kFYCLirM | ||
63 | + driver-class-name: com.mysql.cj.jdbc.Driver | ||
64 | + #配置初始化大小/最小/最大 | ||
65 | + druid: | ||
66 | + initial-size: 1 | ||
67 | + min-idle: 1 | ||
68 | + max-active: 20 | ||
69 | + #获取连接等待超时时间 | ||
70 | + max-wait: 60000 | ||
71 | + #一个连接在池中最小生存的时间 | ||
72 | + min-evictable-idle-time-millis: 300000 | ||
73 | + #间隔多久进行一次检测,检测需要关闭的空闲连接 | ||
74 | + time-between-eviction-runs-millis: 60000 | ||
75 | + #mysql | ||
76 | + validation-query: SELECT 1 FROM DUAL | ||
77 | + #oracle | ||
78 | + #druid.validation-query:SELECT 'x' FROM DUAL | ||
79 | + test-while-idle: true | ||
80 | + test-on-borrow: false | ||
81 | + test-on-return: false | ||
82 | + default-auto-commit: true | ||
83 | +# tomcat: | ||
84 | +# max-wait: 10 | ||
85 | +# max-idle: 10000 | ||
86 | +# min-idle: 5 | ||
87 | +# initial-size: 5 | ||
88 | + | ||
89 | +eureka: | ||
90 | + instance: | ||
91 | + #eureka服务器页面中status的请求路径 | ||
92 | +# status-page-url: http://${eureka.instance.hostname}:${server.port}/index | ||
93 | + prefer-ip-address: true | ||
94 | + instance-id: ${spring.cloud.client.ip-address}:${server.port} | ||
95 | + hostname: ${spring.cloud.client.ip-address} | ||
96 | + lease-renewal-interval-in-seconds: 15 | ||
97 | + lease-expiration-duration-in-seconds: 45 | ||
98 | + health-check-url-path: /actuator/health | ||
99 | + metadata-map: | ||
100 | + user: | ||
101 | + name: "admin" #These two are needed so that the server | ||
102 | + password: "123456" | ||
103 | + client: | ||
104 | + #eureka注册中心服务器地址 | ||
105 | + service-url: | ||
106 | +# defaultZone: http://127.0.0.1:12345/eureka/ | ||
107 | + defaultZone: http://192.168.1.53:12345/eureka/ | ||
108 | + registry-fetch-interval-seconds: 30 | ||
109 | + | ||
110 | + | ||
111 | + | ||
112 | +management: | ||
113 | + endpoints: | ||
114 | + enabled-by-default: true | ||
115 | + web: | ||
116 | + exposure: | ||
117 | + include: "*" | ||
118 | + endpoint: | ||
119 | + health: | ||
120 | + show-details: always | ||
121 | + shutdown: | ||
122 | + enabled: true | ||
123 | + | ||
124 | +mybatis: | ||
125 | + mapper-locations: classpath:mapping/*.xml | ||
126 | + type-aliases-package: com.tianbo.warehouse.model | ||
127 | +pagehelper: | ||
128 | + #auto-dialect: true | ||
129 | + #auto-runtime-dialect: true | ||
130 | + helper-dialect: mysql | ||
131 | + reasonable: true | ||
132 | + | ||
133 | + support-methods-arguments: true | ||
134 | + params: count=countSql | ||
135 | + | ||
136 | +#debug配置,debug或者为true的时候,logback才会记录和写入日志文件 | ||
137 | +trace: false | ||
138 | +debug: false | ||
139 | + | ||
140 | +logging: | ||
141 | + file: | ||
142 | + path: ./logs/ | ||
143 | + name: system.log | ||
144 | + config: config/logback-dev.xml | ||
145 | + #转移到logback配置文件中 | ||
146 | + #level: | ||
147 | + #org.apache.tomcat: info | ||
148 | + #com.tianbo.warehouse.dao: DEBUG | ||
149 | + #org.springframework.security: trace | ||
150 | + #日志配置,输出到文本, | ||
151 | +#Java Web Token 时效时间,单位秒 | ||
152 | +jwt: | ||
153 | + max-alive: 30000 | ||
154 | + | ||
155 | +info: | ||
156 | + version: 2.0 | ||
157 | + description: "统一用户认证中心服务,具备用户认证,接口鉴权|数据鉴权功能." |
@@ -176,15 +176,15 @@ | @@ -176,15 +176,15 @@ | ||
176 | <logger name="org.apache.tomcat" level="info" /> | 176 | <logger name="org.apache.tomcat" level="info" /> |
177 | <root level="INFO"> | 177 | <root level="INFO"> |
178 | <appender-ref ref="CONSOLE" /> | 178 | <appender-ref ref="CONSOLE" /> |
179 | - <appender-ref ref="DEBUG_FILE" /> | ||
180 | - <appender-ref ref="INFO_FILE" /> | ||
181 | - <appender-ref ref="WARN_FILE" /> | ||
182 | - <appender-ref ref="ERROR_FILE" /> | 179 | +<!-- <appender-ref ref="DEBUG_FILE" />--> |
180 | +<!-- <appender-ref ref="INFO_FILE" />--> | ||
181 | +<!-- <appender-ref ref="WARN_FILE" />--> | ||
182 | +<!-- <appender-ref ref="ERROR_FILE" />--> | ||
183 | </root> | 183 | </root> |
184 | </springProfile> | 184 | </springProfile> |
185 | 185 | ||
186 | <!--生产环境:输出到文件--> | 186 | <!--生产环境:输出到文件--> |
187 | - <springProfile name="pro"> | 187 | + <springProfile name="prd"> |
188 | <root level="info"> | 188 | <root level="info"> |
189 | <appender-ref ref="CONSOLE" /> | 189 | <appender-ref ref="CONSOLE" /> |
190 | <appender-ref ref="DEBUG_FILE" /> | 190 | <appender-ref ref="DEBUG_FILE" /> |
@@ -75,7 +75,7 @@ public class AnonymousController { | @@ -75,7 +75,7 @@ public class AnonymousController { | ||
75 | String verifyToken = ""; | 75 | String verifyToken = ""; |
76 | try { | 76 | try { |
77 | verifyToken = UUID.randomUUID().toString(); | 77 | verifyToken = UUID.randomUUID().toString(); |
78 | - redisUtils.set(Token.VERIFY_TOKEN_KEY + verifyToken,String.valueOf(sum),1200); | 78 | + redisUtils.set(Token.VERIFY_TOKEN_KEY + verifyToken,String.valueOf(sum),120); |
79 | ImageIO.write(bi, "jpeg", outputStream); | 79 | ImageIO.write(bi, "jpeg", outputStream); |
80 | map.put("verifyImg","data:image/jpeg;base64,"+encoder.encode(outputStream.toByteArray())); | 80 | map.put("verifyImg","data:image/jpeg;base64,"+encoder.encode(outputStream.toByteArray())); |
81 | } catch (IOException e) { | 81 | } catch (IOException e) { |
@@ -61,7 +61,7 @@ public class HeartBeatController { | @@ -61,7 +61,7 @@ public class HeartBeatController { | ||
61 | * key样式 | 61 | * key样式 |
62 | * accessToken:token | 62 | * accessToken:token |
63 | */ | 63 | */ |
64 | - if (token!=null && !token.isEmpty() && token.startsWith(Token.VERIFY_TOKEN_TYPE)){ | 64 | + if (StringUtils.isNotEmpty(token) && token.startsWith(Token.VERIFY_TOKEN_TYPE)){ |
65 | token = token.substring(Token.VERIFY_TOKEN_TYPE.length()); | 65 | token = token.substring(Token.VERIFY_TOKEN_TYPE.length()); |
66 | String accessToken = token; | 66 | String accessToken = token; |
67 | String userDetailStr = redisUtils.get(accessToken); | 67 | String userDetailStr = redisUtils.get(accessToken); |
@@ -271,11 +271,16 @@ public class USERS implements UserDetails { | @@ -271,11 +271,16 @@ public class USERS implements UserDetails { | ||
271 | /** | 271 | /** |
272 | * | 272 | * |
273 | * @return 账户未锁定 | 273 | * @return 账户未锁定 |
274 | + * 用户状态为0时,为锁定状态 | ||
274 | */ | 275 | */ |
275 | @Override | 276 | @Override |
276 | public boolean isAccountNonLocked(){ | 277 | public boolean isAccountNonLocked(){ |
277 | - if (state){ | ||
278 | - return true; | 278 | + if (this.userStatus != null){ |
279 | + if(this.userStatus == 0){ | ||
280 | + return false; | ||
281 | + }else { | ||
282 | + return true; | ||
283 | + } | ||
279 | }else { | 284 | }else { |
280 | return false; | 285 | return false; |
281 | } | 286 | } |
@@ -72,6 +72,8 @@ public class MyAuthenticationSuccessHandler extends SavedRequestAwareAuthenticat | @@ -72,6 +72,8 @@ public class MyAuthenticationSuccessHandler extends SavedRequestAwareAuthenticat | ||
72 | loginedUser.setCompanyId(user.getCompanyId()); | 72 | loginedUser.setCompanyId(user.getCompanyId()); |
73 | loginedUser.setCompanyName(user.getCompanyName()); | 73 | loginedUser.setCompanyName(user.getCompanyName()); |
74 | loginedUser.setCompanyInfo(user.getCompanyInfo()); | 74 | loginedUser.setCompanyInfo(user.getCompanyInfo()); |
75 | + loginedUser.setUserStatus(user.getUserStatus()); | ||
76 | + loginedUser.setState(user.getState()); | ||
75 | 77 | ||
76 | 78 | ||
77 | //设置用户的TOKEN的有效时间,时间配置在配置文件中设置 | 79 | //设置用户的TOKEN的有效时间,时间配置在配置文件中设置 |
@@ -57,7 +57,7 @@ public class SM3EncryptUtil { | @@ -57,7 +57,7 @@ public class SM3EncryptUtil { | ||
57 | public static void main(String[] args) { | 57 | public static void main(String[] args) { |
58 | Security.addProvider(new BouncyCastleProvider()); | 58 | Security.addProvider(new BouncyCastleProvider()); |
59 | try { | 59 | try { |
60 | - String pwdDigest = passwordSm3("vmvnv1v2VV"); | 60 | + String pwdDigest = passwordSm3("vmvnv1v2"); |
61 | System.out.println(pwdDigest); | 61 | System.out.println(pwdDigest); |
62 | } catch (Exception e) { | 62 | } catch (Exception e) { |
63 | e.printStackTrace(); | 63 | e.printStackTrace(); |
@@ -129,7 +129,7 @@ | @@ -129,7 +129,7 @@ | ||
129 | <select id="selectByUsernameWithRoleAndPerm" resultMap="WithRoleAndPermResultMap" parameterType="java.lang.String" > | 129 | <select id="selectByUsernameWithRoleAndPerm" resultMap="WithRoleAndPermResultMap" parameterType="java.lang.String" > |
130 | select | 130 | select |
131 | u.user_id, username, password, birthday, sex, address, state, mobilePhone, creatTime, | 131 | u.user_id, username, password, birthday, sex, address, state, mobilePhone, creatTime, |
132 | - updateTime, userFace, realName, email, age,company_id, | 132 | + updateTime, userFace, realName, email, age,company_id,user_status, |
133 | 133 | ||
134 | r.role_id, role_name, role_sign, r.description as rdescription, `type`, parentId, rsort, customs_reg_code, | 134 | r.role_id, role_name, role_sign, r.description as rdescription, `type`, parentId, rsort, customs_reg_code, |
135 | business_license, departmentId, mq_code, | 135 | business_license, departmentId, mq_code, |
-
请 注册 或 登录 后发表评论