mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 17:38:48 +08:00
sso server saas 登录
This commit is contained in:
parent
efc6dc612c
commit
504d80a022
@ -41,10 +41,13 @@ public interface CacheNames {
|
|||||||
String SYS_CLIENT = GlobalConstants.GLOBAL_REDIS_KEY + "sys_client#30d";
|
String SYS_CLIENT = GlobalConstants.GLOBAL_REDIS_KEY + "sys_client#30d";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户端
|
* saas客户端
|
||||||
*/
|
*/
|
||||||
String SYS_SAAS_CLIENT = GlobalConstants.GLOBAL_REDIS_KEY + "sys_saas_client#30d";
|
String SYS_SAAS_CLIENT = GlobalConstants.GLOBAL_REDIS_KEY + "sys_saas_client#30d";
|
||||||
|
/**
|
||||||
|
* saas部门
|
||||||
|
*/
|
||||||
|
String SYS_SAAS_DEPT = "sys_saas_dept#30d";
|
||||||
/**
|
/**
|
||||||
* 用户账户
|
* 用户账户
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -165,7 +165,7 @@ public class SsoServerController {
|
|||||||
}
|
}
|
||||||
// 已登录情况下,构建 redirectUrl
|
// 已登录情况下,构建 redirectUrl
|
||||||
redirect = SaFoxUtil.decoderUrl(redirect);
|
redirect = SaFoxUtil.decoderUrl(redirect);
|
||||||
if (SaSsoConsts.MODE_SIMPLE.equals(mode)) {
|
if (SaSsoConsts.MODE_SIMPLE.equals(mode)) {
|
||||||
// 模式一
|
// 模式一
|
||||||
SaSsoUtil.checkRedirectUrl(redirect);
|
SaSsoUtil.checkRedirectUrl(redirect);
|
||||||
return SaResult.data(redirect);
|
return SaResult.data(redirect);
|
||||||
|
|||||||
@ -17,13 +17,13 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
public class UserPasswordProperties {
|
public class UserPasswordProperties {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 密码最大错误次数
|
* 密码最大错误次数,默认5次
|
||||||
*/
|
*/
|
||||||
private Integer maxRetryCount;
|
private Integer maxRetryCount = 5;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 密码锁定时间(默认10分钟)
|
* 密码锁定时间(默认10分钟)
|
||||||
*/
|
*/
|
||||||
private Integer lockTime;
|
private Integer lockTime = 10;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,10 @@ spring:
|
|||||||
|
|
||||||
# Sa-Token配置
|
# Sa-Token配置
|
||||||
sa-token:
|
sa-token:
|
||||||
|
# 允许动态设置 token 有效期
|
||||||
|
dynamic-active-timeout: true
|
||||||
|
# 允许从 请求参数 读取 token
|
||||||
|
is-read-body: true
|
||||||
sign:
|
sign:
|
||||||
# API 接口签名秘钥 (随便乱摁几个字母即可)
|
# API 接口签名秘钥 (随便乱摁几个字母即可)
|
||||||
secret-key: kQwIOrYbtXmSDkwEiFngrKidMcdrgKor
|
secret-key: kQwIOrYbtXmSDkwEiFngrKidMcdrgKor
|
||||||
|
|||||||
@ -1,137 +1,137 @@
|
|||||||
package org.dromara.system.saas.controller.system;
|
//package org.dromara.system.saas.controller.system;
|
||||||
|
//
|
||||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
//import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
import org.dromara.common.core.domain.R;
|
//import org.dromara.common.core.domain.R;
|
||||||
import org.dromara.common.excel.utils.ExcelUtil;
|
//import org.dromara.common.excel.utils.ExcelUtil;
|
||||||
import org.dromara.common.log.annotation.Log;
|
//import org.dromara.common.log.annotation.Log;
|
||||||
import org.dromara.common.log.enums.BusinessType;
|
//import org.dromara.common.log.enums.BusinessType;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
//import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
//import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.common.web.core.BaseController;
|
//import org.dromara.common.web.core.BaseController;
|
||||||
import org.dromara.system.saas.domain.bo.SysSaasConfigBo;
|
//import org.dromara.system.saas.domain.bo.SysSaasConfigBo;
|
||||||
import org.dromara.system.saas.domain.vo.SysSaasConfigVo;
|
//import org.dromara.system.saas.domain.vo.SysSaasConfigVo;
|
||||||
import org.dromara.system.saas.service.ISysSaasConfigService;
|
//import org.dromara.system.saas.service.ISysSaasConfigService;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
//import jakarta.servlet.http.HttpServletResponse;
|
||||||
import lombok.RequiredArgsConstructor;
|
//import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.validation.annotation.Validated;
|
//import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
//import org.springframework.web.bind.annotation.*;
|
||||||
|
//
|
||||||
import java.util.List;
|
//import java.util.List;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* 参数配置 信息操作处理
|
// * 参数配置 信息操作处理
|
||||||
*
|
// *
|
||||||
* @author Lion Li
|
// * @author Lion Li
|
||||||
*/
|
// */
|
||||||
@Validated
|
//@Validated
|
||||||
@RequiredArgsConstructor
|
//@RequiredArgsConstructor
|
||||||
@RestController
|
//@RestController
|
||||||
@RequestMapping("/system/saasConfig")
|
//@RequestMapping("/system/saasConfig")
|
||||||
public class SysSaasConfigController extends BaseController {
|
//public class SysSaasConfigController extends BaseController {
|
||||||
|
//
|
||||||
private final ISysSaasConfigService configService;
|
// private final ISysSaasConfigService configService;
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 获取参数配置列表
|
// * 获取参数配置列表
|
||||||
*/
|
// */
|
||||||
@SaCheckPermission("system:config:list")
|
// @SaCheckPermission("system:config:list")
|
||||||
@GetMapping("/list")
|
// @GetMapping("/list")
|
||||||
public TableDataInfo<SysSaasConfigVo> list(SysSaasConfigBo config, PageQuery pageQuery) {
|
// public TableDataInfo<SysSaasConfigVo> list(SysSaasConfigBo config, PageQuery pageQuery) {
|
||||||
return configService.selectPageConfigList(config, pageQuery);
|
// return configService.selectPageConfigList(config, pageQuery);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 导出参数配置列表
|
// * 导出参数配置列表
|
||||||
*/
|
// */
|
||||||
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
// @Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
||||||
@SaCheckPermission("system:config:export")
|
// @SaCheckPermission("system:config:export")
|
||||||
@PostMapping("/export")
|
// @PostMapping("/export")
|
||||||
public void export(SysSaasConfigBo config, HttpServletResponse response) {
|
// public void export(SysSaasConfigBo config, HttpServletResponse response) {
|
||||||
List<SysSaasConfigVo> list = configService.selectConfigList(config);
|
// List<SysSaasConfigVo> list = configService.selectConfigList(config);
|
||||||
ExcelUtil.exportExcel(list, "参数数据", SysSaasConfigVo.class, response);
|
// ExcelUtil.exportExcel(list, "参数数据", SysSaasConfigVo.class, response);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 根据参数编号获取详细信息
|
// * 根据参数编号获取详细信息
|
||||||
*
|
// *
|
||||||
* @param configId 参数ID
|
// * @param configId 参数ID
|
||||||
*/
|
// */
|
||||||
@SaCheckPermission("system:config:query")
|
// @SaCheckPermission("system:config:query")
|
||||||
@GetMapping(value = "/{configId}")
|
// @GetMapping(value = "/{configId}")
|
||||||
public R<SysSaasConfigVo> getInfo(@PathVariable Long configId) {
|
// public R<SysSaasConfigVo> getInfo(@PathVariable Long configId) {
|
||||||
return R.ok(configService.selectConfigById(configId));
|
// return R.ok(configService.selectConfigById(configId));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 根据参数键名查询参数值
|
// * 根据参数键名查询参数值
|
||||||
*
|
// *
|
||||||
* @param configKey 参数Key
|
// * @param configKey 参数Key
|
||||||
*/
|
// */
|
||||||
@GetMapping(value = "/configKey/{configKey}")
|
// @GetMapping(value = "/configKey/{configKey}")
|
||||||
public R<String> getConfigKey(@PathVariable String configKey) {
|
// public R<String> getConfigKey(@PathVariable String configKey) {
|
||||||
return R.ok("操作成功", configService.selectConfigByKey(configKey));
|
// return R.ok("操作成功", configService.selectConfigByKey(configKey));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 新增参数配置
|
// * 新增参数配置
|
||||||
*/
|
// */
|
||||||
@SaCheckPermission("system:config:add")
|
// @SaCheckPermission("system:config:add")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
// @Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
// @PostMapping
|
||||||
public R<Void> add(@Validated @RequestBody SysSaasConfigBo config) {
|
// public R<Void> add(@Validated @RequestBody SysSaasConfigBo config) {
|
||||||
if (!configService.checkConfigKeyUnique(config)) {
|
// if (!configService.checkConfigKeyUnique(config)) {
|
||||||
return R.fail("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
// return R.fail("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
}
|
// }
|
||||||
configService.insertConfig(config);
|
// configService.insertConfig(config);
|
||||||
return R.ok();
|
// return R.ok();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 修改参数配置
|
// * 修改参数配置
|
||||||
*/
|
// */
|
||||||
@SaCheckPermission("system:config:edit")
|
// @SaCheckPermission("system:config:edit")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
// @Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
// @PutMapping
|
||||||
public R<Void> edit(@Validated @RequestBody SysSaasConfigBo config) {
|
// public R<Void> edit(@Validated @RequestBody SysSaasConfigBo config) {
|
||||||
if (!configService.checkConfigKeyUnique(config)) {
|
// if (!configService.checkConfigKeyUnique(config)) {
|
||||||
return R.fail("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
// return R.fail("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
}
|
// }
|
||||||
configService.updateConfig(config);
|
// configService.updateConfig(config);
|
||||||
return R.ok();
|
// return R.ok();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 根据参数键名修改参数配置
|
// * 根据参数键名修改参数配置
|
||||||
*/
|
// */
|
||||||
@SaCheckPermission("system:config:edit")
|
// @SaCheckPermission("system:config:edit")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
// @Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping("/updateByKey")
|
// @PutMapping("/updateByKey")
|
||||||
public R<Void> updateByKey(@RequestBody SysSaasConfigBo config) {
|
// public R<Void> updateByKey(@RequestBody SysSaasConfigBo config) {
|
||||||
configService.updateConfig(config);
|
// configService.updateConfig(config);
|
||||||
return R.ok();
|
// return R.ok();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 删除参数配置
|
// * 删除参数配置
|
||||||
*
|
// *
|
||||||
* @param configIds 参数ID串
|
// * @param configIds 参数ID串
|
||||||
*/
|
// */
|
||||||
@SaCheckPermission("system:config:remove")
|
// @SaCheckPermission("system:config:remove")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
// @Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{configIds}")
|
// @DeleteMapping("/{configIds}")
|
||||||
public R<Void> remove(@PathVariable Long[] configIds) {
|
// public R<Void> remove(@PathVariable Long[] configIds) {
|
||||||
configService.deleteConfigByIds(configIds);
|
// configService.deleteConfigByIds(configIds);
|
||||||
return R.ok();
|
// return R.ok();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 刷新参数缓存
|
// * 刷新参数缓存
|
||||||
*/
|
// */
|
||||||
@SaCheckPermission("system:config:remove")
|
// @SaCheckPermission("system:config:remove")
|
||||||
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
// @Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
||||||
@DeleteMapping("/refreshCache")
|
// @DeleteMapping("/refreshCache")
|
||||||
public R<Void> refreshCache() {
|
// public R<Void> refreshCache() {
|
||||||
configService.resetConfigCache();
|
// configService.resetConfigCache();
|
||||||
return R.ok();
|
// return R.ok();
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
@ -8,14 +8,14 @@ import lombok.EqualsAndHashCode;
|
|||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 授权管理对象 sys2_client
|
* 授权管理对象 sys_saas_client
|
||||||
*
|
*
|
||||||
* @author Michelle.Chung
|
* @author Michelle.Chung
|
||||||
* @date 2023-05-15
|
* @date 2023-05-15
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("sys2_client")
|
@TableName("sys_saas_client")
|
||||||
public class SysSaasClient extends BaseEntity {
|
public class SysSaasClient extends BaseEntity {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import jakarta.validation.constraints.*;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 授权管理业务对象 sys2_client
|
* 授权管理业务对象 sys_saas_client
|
||||||
*
|
*
|
||||||
* @author Michelle.Chung
|
* @author Michelle.Chung
|
||||||
* @date 2023-05-15
|
* @date 2023-05-15
|
||||||
|
|||||||
@ -24,11 +24,6 @@ import org.dromara.system.saas.domain.SysSaasUser;
|
|||||||
@AutoMapper(target = SysSaasUser.class, reverseConvertGenerate = false)
|
@AutoMapper(target = SysSaasUser.class, reverseConvertGenerate = false)
|
||||||
public class SysSaasUserBo extends BaseEntity {
|
public class SysSaasUserBo extends BaseEntity {
|
||||||
|
|
||||||
/**
|
|
||||||
* 应用id
|
|
||||||
*/
|
|
||||||
@NotBlank(message = "不能为空")
|
|
||||||
private Long applicationId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户ID
|
* 用户ID
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import java.util.List;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 授权管理视图对象 sys2_client
|
* 授权管理视图对象 sys_saas_client
|
||||||
*
|
*
|
||||||
* @author Michelle.Chung
|
* @author Michelle.Chung
|
||||||
* @date 2023-05-15
|
* @date 2023-05-15
|
||||||
|
|||||||
@ -127,7 +127,7 @@ public class SysSaasDeptServiceImpl implements ISysSaasDeptService, SaasDeptServ
|
|||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @return 部门信息
|
* @return 部门信息
|
||||||
*/
|
*/
|
||||||
@Cacheable(cacheNames = CacheNames.SYS_DEPT, key = "#deptId")
|
@Cacheable(cacheNames = CacheNames.SYS_SAAS_DEPT, key = "#deptId")
|
||||||
@Override
|
@Override
|
||||||
public SysSaasDeptVo selectDeptById(Long deptId) {
|
public SysSaasDeptVo selectDeptById(Long deptId) {
|
||||||
SysSaasDeptVo dept = baseMapper.selectVoById(deptId);
|
SysSaasDeptVo dept = baseMapper.selectVoById(deptId);
|
||||||
@ -260,7 +260,7 @@ public class SysSaasDeptServiceImpl implements ISysSaasDeptService, SaasDeptServ
|
|||||||
* @param bo 部门信息
|
* @param bo 部门信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@CacheEvict(cacheNames = CacheNames.SYS_DEPT, key = "#bo.deptId")
|
@CacheEvict(cacheNames = CacheNames.SYS_SAAS_DEPT, key = "#bo.deptId")
|
||||||
@Override
|
@Override
|
||||||
public int updateDept(SysSaasDeptBo bo) {
|
public int updateDept(SysSaasDeptBo bo) {
|
||||||
SysSaasDept dept = MapstructUtils.convert(bo, SysSaasDept.class);
|
SysSaasDept dept = MapstructUtils.convert(bo, SysSaasDept.class);
|
||||||
@ -317,7 +317,7 @@ public class SysSaasDeptServiceImpl implements ISysSaasDeptService, SaasDeptServ
|
|||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(list)) {
|
if (CollUtil.isNotEmpty(list)) {
|
||||||
if (baseMapper.updateBatchById(list)) {
|
if (baseMapper.updateBatchById(list)) {
|
||||||
list.forEach(dept -> CacheUtils.evict(CacheNames.SYS_DEPT, dept.getDeptId()));
|
list.forEach(dept -> CacheUtils.evict(CacheNames.SYS_SAAS_DEPT, dept.getDeptId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -328,7 +328,7 @@ public class SysSaasDeptServiceImpl implements ISysSaasDeptService, SaasDeptServ
|
|||||||
* @param deptId 部门ID
|
* @param deptId 部门ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@CacheEvict(cacheNames = CacheNames.SYS_DEPT, key = "#deptId")
|
@CacheEvict(cacheNames = CacheNames.SYS_SAAS_DEPT, key = "#deptId")
|
||||||
@Override
|
@Override
|
||||||
public int deleteDeptById(Long deptId) {
|
public int deleteDeptById(Long deptId) {
|
||||||
return baseMapper.deleteById(deptId);
|
return baseMapper.deleteById(deptId);
|
||||||
|
|||||||
@ -819,7 +819,7 @@ insert into sys2_oss_config values (5, '000000', 'image', 'ruoyi', '
|
|||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- 系统授权表
|
-- 系统授权表
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
create table sys2_client (
|
create table sys_saas_client (
|
||||||
id bigint(20) not null comment 'id',
|
id bigint(20) not null comment 'id',
|
||||||
client_id varchar(64) default null comment '客户端id',
|
client_id varchar(64) default null comment '客户端id',
|
||||||
client_key varchar(32) default null comment '客户端key',
|
client_key varchar(32) default null comment '客户端key',
|
||||||
@ -837,6 +837,3 @@ create table sys2_client (
|
|||||||
update_time datetime default null comment '更新时间',
|
update_time datetime default null comment '更新时间',
|
||||||
primary key (id)
|
primary key (id)
|
||||||
) engine=innodb comment='系统授权表';
|
) engine=innodb comment='系统授权表';
|
||||||
|
|
||||||
insert into sys2_client values (1, 'e5cd7e4891bf95d1d19206ce24a7b32e', 'pc', 'pc123', 'password,social', 'pc', 1800, 604800, 0, 0, 103, 1, sysdate(), 1, sysdate());
|
|
||||||
insert into sys2_client values (2, '428a8310cd442757ae699df5d894f051', 'app', 'app123', 'password,sms,social', 'android', 1800, 604800, 0, 0, 103, 1, sysdate(), 1, sysdate());
|
|
||||||
Loading…
Reference in New Issue
Block a user