release:外放登陆

master
路明慧 10 months ago
parent 2246d0d94c
commit 51a0980425
  1. 49
      itaxBase-admin/src/main/java/com/dxhy/itax/modules/common/controller/WebController.java
  2. 16
      itaxBase-admin/src/main/resources/bootstrap-std.yaml
  3. 24
      itaxBase-admin/src/main/resources/bootstrap.yaml

@ -173,6 +173,55 @@ public class WebController {
//开始执行登录 //开始执行登录
String username = AESUtil.aesDecrypt(loginModel.getDxhyu()); String username = AESUtil.aesDecrypt(loginModel.getDxhyu());
log.info("用户{},登录开始", username); log.info("用户{},登录开始", username);
if (StringUtils.isBlank(itaxAdminConfig.getWhitelist()) || !Arrays.asList(itaxAdminConfig.getWhitelist()).contains(username)){
log.info("用户{},登录失败,未配置白名单", username);
response.setCharacterEncoding("UTF-8");
response.getWriter().write("<!DOCTYPE html> \n" +
"<html lang=\"zh-CN\"> \n" +
"<head> \n" +
" <meta charset=\"UTF-8\"> \n" +
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"> \n" +
" <title>发票系统登陆结果</title> \n" +
" <style> \n" +
" body { \n" +
" font-family: Arial, sans-serif; \n" +
" margin: 40px; \n" +
" padding: 20px; \n" +
" background-color: #f4f4f4; \n" +
" color: #333; \n" +
" } \n" +
" .container { \n" +
" background-color: #fff; \n" +
" padding: 20px; \n" +
" border-radius: 8px; \n" +
" box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); \n" +
" } \n" +
" h2 { \n" +
" color: #5cb85c; \n" +
" } \n" +
" /* 添加这个类来指定查询结果提示的颜色为红色 */ \n" +
" .result-error { \n" +
" color: red; \n" +
" } \n" +
" p { \n" +
" margin: 10px 0; \n" +
" } \n" +
" </style> \n" +
"</head> \n" +
"<body> \n" +
" <div class=\"container\"> \n" +
" <h2 class=\"result-error\">登陆失败</h2>\n" +
" <!-- 使用新的类名来指定颜色 --> \n" +
" <p>登录失败,未配置管理员登陆白名单</p>\n" +
" <p>请尝试以下解决方案:</p> \n" +
" <ul> \n" +
" <li>添加用户名白名单</li>\n" +
" </ul> \n" +
" </div> \n" +
"</body> \n" +
"</html>");
return;
}
ReturnT<UserInfo> result = userService.findUser(loginModel.getDxhyu(), loginModel.getDxhyp()); ReturnT<UserInfo> result = userService.findUser(loginModel.getDxhyu(), loginModel.getDxhyp());
log.info("用户{},登录结果:{}", username, JSON.toJSONString(result)); log.info("用户{},登录结果:{}", username, JSON.toJSONString(result));

@ -4,15 +4,15 @@ spring:
nacos: nacos:
config: config:
# Nacos config 地址 # Nacos config 地址
server-addr: ${nacos.address} server-addr: 10.18.90.125:33000
# Nacos config 命名空间,对应配置中的名称(sims_order_namespace) # Nacos config 命名空间,对应配置中的名称(sims_order_namespace)
namespace: ${nacos.namespace} namespace: dxhy-nacos
# Nacos config 分组 # Nacos config 分组
group: itax-admin group: itax-admin
# Nacos config 登录用户名 # Nacos config 登录用户名
username: ${nacos.username} username: admin
# Nacos config 登录密码 # Nacos config 登录密码
password: ${nacos.password} password: Invoice.nacos.!1
# Nacos config 配置文件前缀 # Nacos config 配置文件前缀
prefix: application prefix: application
# Nacos config 配置文件后缀,拼接完URL需要对应NacosServer中的dataId对应配置,${prefix}-${spring.profiles.active}.${file-extension} # Nacos config 配置文件后缀,拼接完URL需要对应NacosServer中的dataId对应配置,${prefix}-${spring.profiles.active}.${file-extension}
@ -27,8 +27,8 @@ spring:
# Nacos discovery 配置 # Nacos discovery 配置
discovery: discovery:
# Nacos discovery 服务地址 # Nacos discovery 服务地址
server-addr: ${nacos.address} server-addr: nacos-1.itax.local:33000
username: ${nacos.username} username: admin
# Nacos config 登录密码 # Nacos config 登录密码
password: ${nacos.password} password: Invoice.nacos.!1
enabled: off enabled: off

@ -1,13 +1,31 @@
# 此文件不可少,Spring Cloud读取配置必须 # 此文件不可少,Spring Cloud读取配置必须
#本机ip地址获取:${spring.cloud.client.ip-address} #本机ip地址获取:${spring.cloud.client.ip-address}
spring: spring:
security:
oauth2:
client:
registration:
custom:
client-id: ele-cloud
client-secret: ON1DXvYpmEgf97Jhw61Kc4SejfliQN1Z
authorization-grant-type: authorization_code
redirect-uri: http://10.18.90.125:10000/itaxAdmin/singleLogin
provider:
custom:
authorization-uri: https://auth.luoxin.cn:8443/auth/realms/Luoxin/protocol/openid-connect/auth
token-uri: https://auth.luoxin.cn:8443/auth/realms/Luoxin/protocol/openid-connect/token
user-info-uri: https://auth.luoxin.cn:8443/auth/realms/Luoxin/protocol/openid-connect/userinfo
user-name-attribute: email
resourceserver:
jwt:
jwk-set-uri: ${JWK_SET_URI:https://auth.luoxin.cn:8443/auth/realms/Luoxin/protocol/openid-connect/certs}
application: application:
name: itax-admin name: itax-admin
profiles: profiles:
# Spring 配置文件读取 # Spring 配置文件读取
active: @deployType@ active: std
#active: @deployType@ #active: std
#active: dev #active: dev
jackson: jackson:
# jackson 日期格式化 # jackson 日期格式化
@ -70,7 +88,7 @@ mybatis-plus:
#自定义填充策略接口实现 #自定义填充策略接口实现
#meta-object-handler: com.baomidou.springboot.xxx #meta-object-handler: com.baomidou.springboot.xxx
#自定义SQL注入器 #自定义SQL注入器
# sql-injector: com.baomidou.mybatisplus.mapper.LogicSqlInjector # sql-injector: com.baomidou.mybatisplus.mapper.LogicSqlInjector
configuration: configuration:
map-underscore-to-camel-case: true map-underscore-to-camel-case: true
cache-enabled: false cache-enabled: false

Loading…
Cancel
Save