@@ -0,0 +1,19 @@ | |||
package com.tuoheng.common; | |||
import lombok.Data; | |||
/** | |||
* 查询对象基类 | |||
*/ | |||
@Data | |||
public class BaseQuery { | |||
/** | |||
* 页码 | |||
*/ | |||
private Integer page; | |||
/** | |||
* 每页数 | |||
*/ | |||
private Integer limit; | |||
} |
@@ -1,6 +1,6 @@ | |||
package com.tuoheng.controller; | |||
import com.tuoheng.model.service.PlatformService; | |||
import com.tuoheng.service.PlatformService; | |||
import com.tuoheng.until.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; |
@@ -3,7 +3,7 @@ package com.tuoheng.controller; | |||
import com.tuoheng.model.dto.LoginUser; | |||
import com.tuoheng.model.dto.OidcTenantDto; | |||
import com.tuoheng.model.param.CreateClientTenantDto; | |||
import com.tuoheng.model.param.CreateClientUserDto; | |||
import com.tuoheng.model.query.TenantQuery; | |||
import com.tuoheng.service.ClientUserSevice; | |||
import com.tuoheng.service.CurrentUser; | |||
import com.tuoheng.until.JsonResult; | |||
@@ -45,8 +45,8 @@ public class TenantController { | |||
* @return | |||
*/ | |||
@GetMapping("/list") | |||
public JsonResult list(){ | |||
return clientUserSevice.findTenants(); | |||
public JsonResult list(TenantQuery query){ | |||
return clientUserSevice.findTenants(query); | |||
} | |||
} |
@@ -2,6 +2,7 @@ package com.tuoheng.mapper; | |||
import com.tuoheng.model.po.AuthoritiesPo; | |||
import org.apache.ibatis.annotations.Mapper; | |||
import org.apache.ibatis.annotations.Param; | |||
import java.util.List; | |||
@@ -15,4 +16,6 @@ public interface AuthoritiesMapper { | |||
int batchInsert(List<AuthoritiesPo> list); | |||
List<AuthoritiesPo> selectByUserId(@Param("userId") Long userId); | |||
} |
@@ -2,6 +2,7 @@ package com.tuoheng.mapper; | |||
import com.tuoheng.model.po.UserPo; | |||
import org.apache.ibatis.annotations.Mapper; | |||
import org.apache.ibatis.annotations.Param; | |||
/** | |||
* @author chenjiandong | |||
@@ -19,4 +20,6 @@ public interface ClientUserMapper { | |||
int updatePass(UserPo userPo); | |||
UserPo selectByUserId(@Param("userId") Long userId); | |||
} |
@@ -0,0 +1,20 @@ | |||
package com.tuoheng.mapper; | |||
import com.tuoheng.model.dto.Oauth2RegisteredClient; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import org.apache.ibatis.annotations.Mapper; | |||
/** | |||
* @author 小影 | |||
* @description 针对表【oauth2_registered_client】的数据库操作Mapper | |||
* @createDate 2023-01-10 15:10:32 | |||
* @Entity com.tuoheng.model.dto.Oauth2RegisteredClient | |||
*/ | |||
@Mapper | |||
public interface Oauth2RegisteredClientMapper extends BaseMapper<Oauth2RegisteredClient> { | |||
} | |||
@@ -1,11 +1,16 @@ | |||
package com.tuoheng.mapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.tuoheng.model.dto.TTenant; | |||
import com.tuoheng.model.po.TenantPo; | |||
import com.tuoheng.model.query.TenantQuery; | |||
import com.tuoheng.model.vo.TenantVo; | |||
import org.apache.ibatis.annotations.Mapper; | |||
import org.apache.ibatis.annotations.Param; | |||
import org.apache.ibatis.annotations.Select; | |||
import java.util.List; | |||
/** | |||
* @author chenjiandong | |||
* @description: TODO | |||
@@ -17,4 +22,6 @@ public interface TenantMapper { | |||
int insertTenant(TenantPo tenantPo); | |||
TTenant getByCode(@Param("code") String code); | |||
IPage<TenantPo> findList(@Param("page") IPage<TenantVo> page, TenantQuery query); | |||
} |
@@ -0,0 +1,81 @@ | |||
package com.tuoheng.model.dto; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import java.io.Serializable; | |||
import java.util.Date; | |||
import lombok.Data; | |||
/** | |||
* | |||
* @TableName oauth2_registered_client | |||
*/ | |||
@TableName(value ="oauth2_registered_client") | |||
@Data | |||
public class Oauth2RegisteredClient implements Serializable { | |||
/** | |||
* | |||
*/ | |||
@TableId | |||
private String id; | |||
/** | |||
* | |||
*/ | |||
private String clientId; | |||
/** | |||
* | |||
*/ | |||
private Date clientIdIssuedAt; | |||
/** | |||
* | |||
*/ | |||
private String clientSecret; | |||
/** | |||
* | |||
*/ | |||
private Date clientSecretExpiresAt; | |||
/** | |||
* | |||
*/ | |||
private String clientName; | |||
/** | |||
* | |||
*/ | |||
private String clientAuthenticationMethods; | |||
/** | |||
* | |||
*/ | |||
private String authorizationGrantTypes; | |||
/** | |||
* | |||
*/ | |||
private String redirectUris; | |||
/** | |||
* | |||
*/ | |||
private String scopes; | |||
/** | |||
* | |||
*/ | |||
private String clientSettings; | |||
/** | |||
* | |||
*/ | |||
private String tokenSettings; | |||
@TableField(exist = false) | |||
private static final long serialVersionUID = 1L; | |||
} |
@@ -0,0 +1,16 @@ | |||
package com.tuoheng.model.query; | |||
import com.tuoheng.common.BaseQuery; | |||
import lombok.Data; | |||
/** | |||
* @Author xiaoying | |||
* @Date 2023/1/10 14:34 | |||
*/ | |||
@Data | |||
public class TenantQuery extends BaseQuery { | |||
/** | |||
* 租户名称 | |||
*/ | |||
private String name; | |||
} |
@@ -0,0 +1,21 @@ | |||
package com.tuoheng.model.vo; | |||
import lombok.Data; | |||
/** | |||
* 各业务系统的clientId及名称返回实体类 | |||
* @Author xiaoying | |||
* @Date 2023/1/10 14:45 | |||
*/ | |||
@Data | |||
public class BusinessSystemVo { | |||
/** | |||
* 系统标识 | |||
*/ | |||
private String clientId; | |||
/** | |||
* 系统名称 | |||
*/ | |||
private String name; | |||
} |
@@ -0,0 +1,31 @@ | |||
package com.tuoheng.model.vo; | |||
import lombok.Data; | |||
import java.util.List; | |||
/** | |||
* 租户列表展示返回类 | |||
* @Author xiaoying | |||
* @Date 2023/1/10 14:39 | |||
*/ | |||
@Data | |||
public class TenantVo { | |||
/** | |||
* 租户名称 | |||
*/ | |||
private String name; | |||
/** | |||
* 租户code | |||
*/ | |||
private String code; | |||
/** | |||
* 用户名 | |||
*/ | |||
private String username; | |||
/** | |||
* 租户绑定的业务系统等 | |||
*/ | |||
private List<BusinessSystemVo> list; | |||
} |
@@ -6,6 +6,7 @@ import com.tuoheng.model.param.CreateClientTenantDto; | |||
import com.tuoheng.model.param.CreateClientUserDto; | |||
import com.tuoheng.model.param.UpdateUserClientRoleDto; | |||
import com.tuoheng.model.param.UpdateUserPassDto; | |||
import com.tuoheng.model.query.TenantQuery; | |||
import com.tuoheng.until.JsonResult; | |||
/** | |||
@@ -32,6 +33,6 @@ public interface ClientUserSevice { | |||
*/ | |||
JsonResult addTenant(OidcTenantDto dto,LoginUser loginUser); | |||
JsonResult findTenants(); | |||
JsonResult findTenants(TenantQuery query); | |||
} |
@@ -0,0 +1,13 @@ | |||
package com.tuoheng.service; | |||
import com.tuoheng.model.dto.Oauth2RegisteredClient; | |||
import com.baomidou.mybatisplus.extension.service.IService; | |||
/** | |||
* @author 小影 | |||
* @description 针对表【oauth2_registered_client】的数据库操作Service | |||
* @createDate 2023-01-10 15:10:32 | |||
*/ | |||
public interface Oauth2RegisteredClientService extends IService<Oauth2RegisteredClient> { | |||
} |
@@ -1,4 +1,4 @@ | |||
package com.tuoheng.model.service; | |||
package com.tuoheng.service; | |||
import com.tuoheng.model.dto.Platform; | |||
import com.baomidou.mybatisplus.extension.service.IService; |
@@ -1,23 +1,25 @@ | |||
package com.tuoheng.service.impl; | |||
import cn.hutool.core.util.ObjectUtil; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.api.R; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.common.ServiceException; | |||
import com.tuoheng.constant.HhzUrlConstant; | |||
import com.tuoheng.mapper.*; | |||
import com.tuoheng.model.dto.LoginUser; | |||
import com.tuoheng.model.dto.OidcTenantDto; | |||
import com.tuoheng.model.dto.Platform; | |||
import com.tuoheng.model.dto.TTenant; | |||
import com.tuoheng.model.dto.*; | |||
import com.tuoheng.model.param.*; | |||
import com.tuoheng.model.po.AuthoritiesPo; | |||
import com.tuoheng.model.po.ClientUserRolePo; | |||
import com.tuoheng.model.po.TenantPo; | |||
import com.tuoheng.model.po.UserPo; | |||
import com.tuoheng.model.query.TenantQuery; | |||
import com.tuoheng.model.vo.BusinessSystemVo; | |||
import com.tuoheng.model.vo.TenantVo; | |||
import com.tuoheng.service.ClientUserSevice; | |||
import com.tuoheng.until.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.http.*; | |||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | |||
@@ -54,6 +56,8 @@ public class ClientUserServiceImpl implements ClientUserSevice { | |||
@Autowired | |||
private PlatformMapper platformMapper; | |||
@Autowired | |||
private Oauth2RegisteredClientMapper oauth2RegisteredClientMapper; | |||
@Override | |||
@Transactional(readOnly = true) | |||
@@ -240,13 +244,45 @@ public class ClientUserServiceImpl implements ClientUserSevice { | |||
/** | |||
* 查询租户以及该租户对应绑定的系统等 | |||
* | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult findTenants() { | |||
return null; | |||
} | |||
public JsonResult findTenants(TenantQuery query) { | |||
if (ObjectUtil.isNull(query.getPage()) || ObjectUtil.isNull(query.getLimit())) { | |||
return JsonResult.error("分页参数不能为空"); | |||
} | |||
IPage<TenantVo> page = new Page<>(query.getPage(), query.getLimit()); | |||
IPage<TenantPo> tenantList = tenantMapper.findList(page, query); | |||
List<TenantPo> records = tenantList.getRecords(); | |||
List<TenantVo> list = new ArrayList<>(); | |||
for (TenantPo tenantPo : records) { | |||
TenantVo vo = new TenantVo(); | |||
vo.setCode(tenantPo.getCode()); | |||
vo.setName(tenantPo.getName()); | |||
Long userId = tenantPo.getUserId(); | |||
List<AuthoritiesPo> poList = authoritiesMapper.selectByUserId(userId); | |||
UserPo userPo = clientUserMapper.selectByUserId(userId); | |||
if (null != userPo) { | |||
vo.setUsername(userPo.getUsername()); | |||
} | |||
List<BusinessSystemVo> businessSystemVoList = new ArrayList<>(); | |||
for (AuthoritiesPo authoritiesPo : poList) { | |||
BusinessSystemVo businessSystemVo = new BusinessSystemVo(); | |||
Oauth2RegisteredClient oauth2RegisteredClient = oauth2RegisteredClientMapper.selectOne(Wrappers.<Oauth2RegisteredClient>lambdaQuery() | |||
.eq(Oauth2RegisteredClient::getClientId, authoritiesPo.getAuthority())); | |||
businessSystemVo.setClientId(authoritiesPo.getAuthority()); | |||
businessSystemVo.setName(oauth2RegisteredClient.getClientName()); | |||
businessSystemVoList.add(businessSystemVo); | |||
} | |||
vo.setList(businessSystemVoList); | |||
list.add(vo); | |||
} | |||
page.setRecords(list); | |||
page.setTotal(list.size()); | |||
return JsonResult.success(page); | |||
} | |||
private JsonResult getResult(OidcTenantDto dto, String code, LoginUser loginUser) { |
@@ -0,0 +1,22 @@ | |||
package com.tuoheng.service.impl; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.tuoheng.model.dto.Oauth2RegisteredClient; | |||
import com.tuoheng.service.Oauth2RegisteredClientService; | |||
import com.tuoheng.mapper.Oauth2RegisteredClientMapper; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* @author 小影 | |||
* @description 针对表【oauth2_registered_client】的数据库操作Service实现 | |||
* @createDate 2023-01-10 15:10:32 | |||
*/ | |||
@Service | |||
public class Oauth2RegisteredClientServiceImpl extends ServiceImpl<Oauth2RegisteredClientMapper, Oauth2RegisteredClient> | |||
implements Oauth2RegisteredClientService{ | |||
} | |||
@@ -3,7 +3,7 @@ package com.tuoheng.service.impl; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||
import com.tuoheng.model.dto.Platform; | |||
import com.tuoheng.model.service.PlatformService; | |||
import com.tuoheng.service.PlatformService; | |||
import com.tuoheng.mapper.PlatformMapper; | |||
import com.tuoheng.until.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; |
@@ -5,9 +5,14 @@ | |||
<insert id="batchInsert" parameterType="java.util.List"> | |||
insert into authorities (user_id, username, authority, create_user) | |||
VALUES | |||
<foreach collection ="list" item="it" separator =","> | |||
<foreach collection="list" item="it" separator=","> | |||
(#{it.userId}, #{it.username}, #{it.authority}, #{it.createUser}) | |||
</foreach > | |||
</foreach> | |||
</insert> | |||
<select id="selectByUserId" resultType="com.tuoheng.model.po.AuthoritiesPo"> | |||
SELECT id, user_id, username, authority | |||
FROM authorities | |||
WHERE user_id = #{userId} | |||
</select> | |||
</mapper> |
@@ -8,20 +8,35 @@ | |||
</insert> | |||
<select id="judgeCreateByUserName" parameterType="java.lang.String" resultType="int"> | |||
select count(1) from users where username = #{username} | |||
select count(1) | |||
from users | |||
where username = #{username} | |||
</select> | |||
<select id="getUserByUserName" parameterType="java.lang.String" resultType="com.tuoheng.model.po.UserPo"> | |||
select * from users where username = #{username} | |||
select * | |||
from users | |||
where username = #{username} | |||
</select> | |||
<select id="selectByUserId" resultType="com.tuoheng.model.po.UserPo"> | |||
SELECT id, | |||
username, | |||
`password`, | |||
enabled, | |||
tenant_id, | |||
is_tenant | |||
FROM users | |||
WHERE id = #{userId} | |||
and enabled = 1 | |||
</select> | |||
<update id="updatePass" parameterType="com.tuoheng.model.po.UserPo"> | |||
update users | |||
<set> | |||
<if test="password != null and password != ''" > | |||
<if test="password != null and password != ''"> | |||
password = #{password}, | |||
</if> | |||
<if test="updateUser != null" > | |||
<if test="updateUser != null"> | |||
update_user = #{updateUser}, | |||
</if> | |||
</set> |
@@ -0,0 +1,28 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.mapper.Oauth2RegisteredClientMapper"> | |||
<resultMap id="BaseResultMap" type="com.tuoheng.model.dto.Oauth2RegisteredClient"> | |||
<id property="id" column="id" jdbcType="VARCHAR"/> | |||
<result property="clientId" column="client_id" jdbcType="VARCHAR"/> | |||
<result property="clientIdIssuedAt" column="client_id_issued_at" jdbcType="TIMESTAMP"/> | |||
<result property="clientSecret" column="client_secret" jdbcType="VARCHAR"/> | |||
<result property="clientSecretExpiresAt" column="client_secret_expires_at" jdbcType="TIMESTAMP"/> | |||
<result property="clientName" column="client_name" jdbcType="VARCHAR"/> | |||
<result property="clientAuthenticationMethods" column="client_authentication_methods" jdbcType="VARCHAR"/> | |||
<result property="authorizationGrantTypes" column="authorization_grant_types" jdbcType="VARCHAR"/> | |||
<result property="redirectUris" column="redirect_uris" jdbcType="VARCHAR"/> | |||
<result property="scopes" column="scopes" jdbcType="VARCHAR"/> | |||
<result property="clientSettings" column="client_settings" jdbcType="VARCHAR"/> | |||
<result property="tokenSettings" column="token_settings" jdbcType="VARCHAR"/> | |||
</resultMap> | |||
<sql id="Base_Column_List"> | |||
id,client_id,client_id_issued_at, | |||
client_secret,client_secret_expires_at,client_name, | |||
client_authentication_methods,authorization_grant_types,redirect_uris, | |||
scopes,client_settings,token_settings | |||
</sql> | |||
</mapper> |
@@ -12,4 +12,13 @@ | |||
from tuoheng_oidc.t_tenant | |||
where code = #{code} | |||
</select> | |||
<select id="findList" resultType="com.tuoheng.model.po.TenantPo"> | |||
SELECT id, user_id, remark,enabled, code, name | |||
FROM t_tenant | |||
WHERE enabled = 1 | |||
<if test="query.name != null and query.name != ''"> | |||
and name LIKE concat('%',#{query.name},'%') | |||
</if> | |||
ORDER BY create_time desc | |||
</select> | |||
</mapper> |
@@ -0,0 +1,68 @@ | |||
spring: | |||
# 注册中心consul地址 | |||
cloud: | |||
consul: | |||
host: 192.168.11.13 # consul 所在服务地址 | |||
port: 8500 # consul 服务端口 | |||
discovery: | |||
## consul ip地址 | |||
hostname: 192.168.11.13 | |||
# 注册到consul的服务名称 | |||
service-name: ${spring.application.name} # 服务提供者名称 | |||
instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${server.port} #实例ID | |||
heartbeat: | |||
enabled: true | |||
prefer-ip-address: true | |||
health-check-path: /actuator/health #健康检查 | |||
health-check-interval: 10s | |||
# 配置数据源 | |||
datasource: | |||
# 使用阿里的Druid连接池 | |||
type: com.alibaba.druid.pool.DruidDataSource | |||
driver-class-name: com.mysql.cj.jdbc.Driver | |||
# 填写你数据库的url、登录名、密码和数据库名 | |||
url: jdbc:mysql://192.168.11.13:3306/tuoheng_oidc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||
username: root | |||
password: idontcare | |||
druid: | |||
# 连接池的配置信息 | |||
# 初始连接数 | |||
initialSize: 5 | |||
# 最小连接池数量 | |||
minIdle: 5 | |||
# 最大连接池数量 | |||
maxActive: 20 | |||
# 配置获取连接等待超时的时间 | |||
maxWait: 60000 | |||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 | |||
timeBetweenEvictionRunsMillis: 60000 | |||
# 配置一个连接在池中最小生存的时间,单位是毫秒 | |||
minEvictableIdleTimeMillis: 300000 | |||
# 配置一个连接在池中最大生存的时间,单位是毫秒 | |||
maxEvictableIdleTimeMillis: 900000 | |||
# 配置检测连接是否有效 | |||
validationQuery: SELECT 1 FROM DUAL | |||
testWhileIdle: true | |||
testOnBorrow: false | |||
testOnReturn: false | |||
# Redis数据源 | |||
redis: | |||
# 缓存库默认索引0 | |||
database: 0 | |||
# Redis服务器地址 | |||
host: 192.168.11.13 | |||
# Redis服务器连接端口 | |||
port: 6379 | |||
# Redis服务器连接密码(默认为空) | |||
password: | |||
# 连接超时时间(毫秒) | |||
timeout: 6000 | |||
# 默认的数据过期时间,主要用于shiro权限管理 | |||
expire: 2592000 | |||
jedis: | |||
pool: | |||
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制) | |||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) | |||
max-idle: 10 # 连接池中的最大空闲连接 | |||
min-idle: 1 # 连接池中的最小空闲连接 |
@@ -0,0 +1,68 @@ | |||
spring: | |||
# 注册中心consul地址 | |||
cloud: | |||
consul: | |||
host: 192.168.11.13 # consul 所在服务地址 | |||
port: 8500 # consul 服务端口 | |||
discovery: | |||
## consul ip地址 | |||
hostname: 192.168.11.13 | |||
# 注册到consul的服务名称 | |||
service-name: ${spring.application.name} # 服务提供者名称 | |||
instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${server.port} #实例ID | |||
heartbeat: | |||
enabled: true | |||
prefer-ip-address: true | |||
health-check-path: /actuator/health #健康检查 | |||
health-check-interval: 10s | |||
# 配置数据源 | |||
datasource: | |||
# 使用阿里的Druid连接池 | |||
type: com.alibaba.druid.pool.DruidDataSource | |||
driver-class-name: com.mysql.cj.jdbc.Driver | |||
# 填写你数据库的url、登录名、密码和数据库名 | |||
url: jdbc:mysql://192.168.11.13:3306/tuoheng_oidc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||
username: root | |||
password: idontcare | |||
druid: | |||
# 连接池的配置信息 | |||
# 初始连接数 | |||
initialSize: 5 | |||
# 最小连接池数量 | |||
minIdle: 5 | |||
# 最大连接池数量 | |||
maxActive: 20 | |||
# 配置获取连接等待超时的时间 | |||
maxWait: 60000 | |||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 | |||
timeBetweenEvictionRunsMillis: 60000 | |||
# 配置一个连接在池中最小生存的时间,单位是毫秒 | |||
minEvictableIdleTimeMillis: 300000 | |||
# 配置一个连接在池中最大生存的时间,单位是毫秒 | |||
maxEvictableIdleTimeMillis: 900000 | |||
# 配置检测连接是否有效 | |||
validationQuery: SELECT 1 FROM DUAL | |||
testWhileIdle: true | |||
testOnBorrow: false | |||
testOnReturn: false | |||
# Redis数据源 | |||
redis: | |||
# 缓存库默认索引0 | |||
database: 0 | |||
# Redis服务器地址 | |||
host: 192.168.11.13 | |||
# Redis服务器连接端口 | |||
port: 6379 | |||
# Redis服务器连接密码(默认为空) | |||
password: | |||
# 连接超时时间(毫秒) | |||
timeout: 6000 | |||
# 默认的数据过期时间,主要用于shiro权限管理 | |||
expire: 2592000 | |||
jedis: | |||
pool: | |||
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制) | |||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) | |||
max-idle: 10 # 连接池中的最大空闲连接 | |||
min-idle: 1 # 连接池中的最小空闲连接 |
@@ -0,0 +1,67 @@ | |||
spring: | |||
# 注册中心consul地址 | |||
cloud: | |||
consul: | |||
host: 127.0.0.1 # consul 所在服务地址 | |||
port: 8500 # consul 服务端口 | |||
discovery: | |||
## consul ip地址 | |||
hostname: 127.0.0.1 | |||
# 注册到consul的服务名称 | |||
service-name: ${spring.application.name} # 服务提供者名称 | |||
instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${server.port} #实例ID | |||
heartbeat: | |||
enabled: true | |||
prefer-ip-address: true | |||
health-check-path: /actuator/health #健康检查 | |||
health-check-interval: 10s | |||
# 配置数据源 | |||
datasource: | |||
# 使用阿里的Druid连接池 | |||
type: com.alibaba.druid.pool.DruidDataSource | |||
driver-class-name: com.mysql.cj.jdbc.Driver | |||
# 填写你数据库的url、登录名、密码和数据库名 | |||
url: jdbc:mysql://192.168.11.13:3306/tuoheng_oidc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||
username: root | |||
password: idontcare | |||
druid: | |||
# 连接池的配置信息 | |||
# 初始连接数 | |||
initialSize: 5 | |||
# 最小连接池数量 | |||
minIdle: 5 | |||
# 最大连接池数量 | |||
maxActive: 20 | |||
# 配置获取连接等待超时的时间 | |||
maxWait: 60000 | |||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 | |||
timeBetweenEvictionRunsMillis: 60000 | |||
# 配置一个连接在池中最小生存的时间,单位是毫秒 | |||
minEvictableIdleTimeMillis: 300000 | |||
# 配置一个连接在池中最大生存的时间,单位是毫秒 | |||
maxEvictableIdleTimeMillis: 900000 | |||
# 配置检测连接是否有效 | |||
validationQuery: SELECT 1 FROM DUAL | |||
testWhileIdle: true | |||
testOnBorrow: false | |||
testOnReturn: false | |||
# Redis数据源 | |||
redis: | |||
# 缓存库默认索引0 | |||
database: 0 | |||
# Redis服务器地址 | |||
host: 192.168.11.13 | |||
# Redis服务器连接端口 | |||
port: 6379 | |||
# Redis服务器连接密码(默认为空) | |||
password: | |||
# 连接超时时间(毫秒) | |||
timeout: 6000 | |||
# 默认的数据过期时间,主要用于shiro权限管理 | |||
expire: 2592000 | |||
jedis: | |||
pool: | |||
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制) | |||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) | |||
max-idle: 10 # 连接池中的最大空闲连接 | |||
min-idle: 1 # 连接池中的最小空闲连接 |
@@ -0,0 +1,67 @@ | |||
spring: | |||
# 注册中心consul地址 | |||
cloud: | |||
consul: | |||
host: 172.16.5.12 # consul 所在服务地址 | |||
port: 8500 # consul 服务端口 | |||
discovery: | |||
## consul ip地址 | |||
hostname: 172.16.5.12 | |||
# 注册到consul的服务名称 | |||
service-name: ${spring.application.name} # 服务提供者名称 | |||
instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${server.port} #实例ID | |||
heartbeat: | |||
enabled: true | |||
prefer-ip-address: true | |||
health-check-path: /actuator/health #健康检查 | |||
health-check-interval: 10s | |||
# 配置数据源 | |||
datasource: | |||
# 使用阿里的Druid连接池 | |||
type: com.alibaba.druid.pool.DruidDataSource | |||
driver-class-name: com.mysql.cj.jdbc.Driver | |||
# 填写你数据库的url、登录名、密码和数据库名 | |||
url: jdbc:mysql://rm-uf6x76i111rb1eo48.mysql.rds.aliyuncs.com:3306/tuoheng_oidc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||
username: root | |||
password: TH22#2022 | |||
druid: | |||
# 连接池的配置信息 | |||
# 初始连接数 | |||
initialSize: 5 | |||
# 最小连接池数量 | |||
minIdle: 5 | |||
# 最大连接池数量 | |||
maxActive: 20 | |||
# 配置获取连接等待超时的时间 | |||
maxWait: 60000 | |||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 | |||
timeBetweenEvictionRunsMillis: 60000 | |||
# 配置一个连接在池中最小生存的时间,单位是毫秒 | |||
minEvictableIdleTimeMillis: 300000 | |||
# 配置一个连接在池中最大生存的时间,单位是毫秒 | |||
maxEvictableIdleTimeMillis: 900000 | |||
# 配置检测连接是否有效 | |||
validationQuery: SELECT 1 FROM DUAL | |||
testWhileIdle: true | |||
testOnBorrow: false | |||
testOnReturn: false | |||
# Redis数据源 | |||
redis: | |||
# 缓存库默认索引0 | |||
database: 0 | |||
# Redis服务器地址 | |||
host: r-uf6r5lm7c7sfdv3ehb.redis.rds.aliyuncs.com | |||
# Redis服务器连接端口 | |||
port: 6379 | |||
# Redis服务器连接密码(默认为空) | |||
password: | |||
# 连接超时时间(毫秒) | |||
timeout: 6000 | |||
# 默认的数据过期时间,主要用于shiro权限管理 | |||
expire: 2592000 | |||
jedis: | |||
pool: | |||
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制) | |||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) | |||
max-idle: 10 # 连接池中的最大空闲连接 | |||
min-idle: 1 # 连接池中的最小空闲连接 |
@@ -0,0 +1,67 @@ | |||
spring: | |||
# 注册中心consul地址 | |||
cloud: | |||
consul: | |||
host: 172.15.1.11 # consul 所在服务地址 | |||
port: 8500 # consul 服务端口 | |||
discovery: | |||
## consul ip地址 | |||
hostname: 172.15.1.11 | |||
# 注册到consul的服务名称 | |||
service-name: ${spring.application.name} # 服务提供者名称 | |||
instance-id: ${spring.application.name}:${spring.cloud.client.ip-address}:${server.port} #实例ID | |||
heartbeat: | |||
enabled: true | |||
prefer-ip-address: true | |||
health-check-path: /actuator/health #健康检查 | |||
health-check-interval: 10s | |||
# 配置数据源 | |||
datasource: | |||
# 使用阿里的Druid连接池 | |||
type: com.alibaba.druid.pool.DruidDataSource | |||
driver-class-name: com.mysql.cj.jdbc.Driver | |||
# 填写你数据库的url、登录名、密码和数据库名 | |||
url: jdbc:mysql://rm-uf6z740323e8053pj.mysql.rds.aliyuncs.com:3306/tuoheng_oidc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||
username: root | |||
password: TH22#2022 | |||
druid: | |||
# 连接池的配置信息 | |||
# 初始连接数 | |||
initialSize: 5 | |||
# 最小连接池数量 | |||
minIdle: 5 | |||
# 最大连接池数量 | |||
maxActive: 20 | |||
# 配置获取连接等待超时的时间 | |||
maxWait: 60000 | |||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 | |||
timeBetweenEvictionRunsMillis: 60000 | |||
# 配置一个连接在池中最小生存的时间,单位是毫秒 | |||
minEvictableIdleTimeMillis: 300000 | |||
# 配置一个连接在池中最大生存的时间,单位是毫秒 | |||
maxEvictableIdleTimeMillis: 900000 | |||
# 配置检测连接是否有效 | |||
validationQuery: SELECT 1 FROM DUAL | |||
testWhileIdle: true | |||
testOnBorrow: false | |||
testOnReturn: false | |||
# Redis数据源 | |||
redis: | |||
# 缓存库默认索引0 | |||
database: 0 | |||
# Redis服务器地址 | |||
host: r-uf6cdzjifj20jszykr.redis.rds.aliyuncs.com | |||
# Redis服务器连接端口 | |||
port: 6379 | |||
# Redis服务器连接密码(默认为空) | |||
password: | |||
# 连接超时时间(毫秒) | |||
timeout: 6000 | |||
# 默认的数据过期时间,主要用于shiro权限管理 | |||
expire: 2592000 | |||
jedis: | |||
pool: | |||
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制) | |||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) | |||
max-idle: 10 # 连接池中的最大空闲连接 | |||
min-idle: 1 # 连接池中的最小空闲连接 |
@@ -0,0 +1,13 @@ | |||
server: | |||
port: 8091 | |||
spring: | |||
profiles: | |||
active: dev | |||
application: | |||
name: tuoheng-oidc-admin | |||
main: | |||
allow-bean-definition-overriding: true | |||
mybatis: | |||
mapper-locations: classpath*:mapper/*Mapper.xml |
@@ -0,0 +1,69 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为WARN,则低于WARN的信息都不会输出 --> | |||
<!-- scan:当此属性设置为true时,配置文档如果发生改变,将会被重新加载,默认值为true --> | |||
<!-- scanPeriod:设置监测配置文档是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。 | |||
当scan为true时,此属性生效。默认的时间间隔为1分钟。 --> | |||
<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 --> | |||
<configuration scan="true" scanPeriod="60 seconds" debug="false"> | |||
<!-- | |||
contextName说明: | |||
每个logger都关联到logger上下文,默认上下文名称为“default”。但可以使用设置成其他名字, | |||
用于区分不同应用程序的记录。一旦设置,不能修改,可以通过%contextName来打印日志上下文名称。 | |||
--> | |||
<contextName>tuoheng_oidc_admin</contextName> | |||
<!--定义日志变量--> | |||
<!--<property name="logging.path" value="D:\\idealogs\\tuoheng_oidc"/>--> | |||
<property name="logging.path" value="/data/java/logs/tuoheng_oidc"/> | |||
<!--日志格式: [时间] [级别] [线程] [行号] [logger信息] - [日志信息]--> | |||
<property name="logging.pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%level][%thread][%L] %logger - %msg%n"/> | |||
<property name="logging.charset" value="UTF-8"/> | |||
<property name="logging.maxHistory" value="15"/> | |||
<property name="logging.totalSizeCap" value="5GB"/> | |||
<property name="logging.maxFileSize" value="40MB"/> | |||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> | |||
<encoder> | |||
<pattern>${logging.pattern}</pattern> | |||
<charset>${logging.charset}</charset> | |||
</encoder> | |||
</appender> | |||
<appender name="LOG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
<File>${logging.path}/admin/tuoheng_oidc_admin.log</File> | |||
<append>true</append> | |||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | |||
<fileNamePattern>${logging.path}/admin/tuoheng_oidc_admin-%d-%i.log</fileNamePattern> | |||
<!-- 最大保存天数--> | |||
<maxHistory>${logging.maxHistory}</maxHistory> | |||
<totalSizeCap>${logging.totalSizeCap}</totalSizeCap> | |||
<maxFileSize>${logging.maxFileSize}</maxFileSize> | |||
</rollingPolicy> | |||
<!--编码器--> | |||
<encoder> | |||
<pattern>${logging.pattern}</pattern> | |||
<charset>${logging.charset}</charset> | |||
</encoder> | |||
</appender> | |||
<appender name="file.async" class="ch.qos.logback.classic.AsyncAppender"> | |||
<discardingThreshold>0</discardingThreshold> | |||
<queueSize>512</queueSize> | |||
<includeCallerData>true</includeCallerData> | |||
<appender-ref ref="LOG_FILE" /> | |||
</appender> | |||
<logger name="com.tuoheng" level="DEBUG" additivity="false"> | |||
<appender-ref ref="console" /> | |||
<appender-ref ref="file.async" /> | |||
</logger> | |||
<!--log4jdbc --> | |||
<logger name="jdbc.sqltiming" level="DEBUG" additivity="false"> | |||
<appender-ref ref="file.async" /> | |||
</logger> | |||
<root level="INFO"> | |||
<appender-ref ref="console" /> | |||
<appender-ref ref="file.async" /> | |||
</root> | |||
</configuration> |
@@ -0,0 +1,18 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.mapper.AuthoritiesMapper"> | |||
<insert id="batchInsert" parameterType="java.util.List"> | |||
insert into authorities (user_id, username, authority, create_user) | |||
VALUES | |||
<foreach collection="list" item="it" separator=","> | |||
(#{it.userId}, #{it.username}, #{it.authority}, #{it.createUser}) | |||
</foreach> | |||
</insert> | |||
<select id="selectByUserId" resultType="com.tuoheng.model.po.AuthoritiesPo"> | |||
SELECT id, user_id, username, authority | |||
FROM authorities | |||
WHERE user_id = #{userId} | |||
</select> | |||
</mapper> |
@@ -0,0 +1,9 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.mapper.ClientMapper"> | |||
<select id="getAllClient" resultType="com.tuoheng.model.dto.ClientDto"> | |||
select client_id as clientId, client_name as clientName from oauth2_registered_client | |||
</select> | |||
</mapper> |
@@ -0,0 +1,47 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.mapper.ClientUserMapper"> | |||
<insert id="insertClientUser" parameterType="com.tuoheng.model.po.UserPo" keyProperty="id" useGeneratedKeys="true"> | |||
insert into users (username, password, create_user, tenant_id, is_tenant) | |||
values (#{username}, #{password}, #{createUser}, #{tenantId}, #{isTenant}) | |||
</insert> | |||
<select id="judgeCreateByUserName" parameterType="java.lang.String" resultType="int"> | |||
select count(1) | |||
from users | |||
where username = #{username} | |||
</select> | |||
<select id="getUserByUserName" parameterType="java.lang.String" resultType="com.tuoheng.model.po.UserPo"> | |||
select * | |||
from users | |||
where username = #{username} | |||
</select> | |||
<select id="selectByUserId" resultType="com.tuoheng.model.po.UserPo"> | |||
SELECT id, | |||
username, | |||
`password`, | |||
enabled, | |||
tenant_id, | |||
is_tenant | |||
FROM users | |||
WHERE id = #{userId} | |||
and enabled = 1 | |||
</select> | |||
<update id="updatePass" parameterType="com.tuoheng.model.po.UserPo"> | |||
update users | |||
<set> | |||
<if test="password != null and password != ''"> | |||
password = #{password}, | |||
</if> | |||
<if test="updateUser != null"> | |||
update_user = #{updateUser}, | |||
</if> | |||
</set> | |||
where username = #{username,jdbcType=VARCHAR} | |||
</update> | |||
</mapper> |
@@ -0,0 +1,31 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.mapper.ClientUserRoleMapper"> | |||
<insert id="batchInsert" parameterType="java.util.List"> | |||
insert into t_client_user_role (user_id, client_id, role_id, create_user) | |||
VALUES | |||
<foreach collection ="list" item="it" separator =","> | |||
(#{it.userId}, #{it.clientId}, #{it.roleId}, #{it.createUser}) | |||
</foreach > | |||
</insert> | |||
<insert id="insert" parameterType="com.tuoheng.model.po.ClientUserRolePo"> | |||
insert into t_client_user_role (user_id, client_id, role_id, create_user) | |||
VALUES (#{userId}, #{clientId}, #{roleId}, #{createUser}) | |||
</insert> | |||
<update id="updateUserClientRole" parameterType="com.tuoheng.model.po.ClientUserRolePo"> | |||
update t_client_user_role | |||
<set> | |||
<if test="roleId != null" > | |||
role_id = #{roleId}, | |||
</if> | |||
<if test="updateUser != null" > | |||
update_user = #{updateUser}, | |||
</if> | |||
</set> | |||
where user_id = #{userId} and client_id = #{clientId} | |||
</update> | |||
</mapper> |
@@ -0,0 +1,24 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper | |||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.mapper.PlatformMapper"> | |||
<resultMap id="BaseResultMap" type="com.tuoheng.model.dto.Platform"> | |||
<id property="id" column="id" jdbcType="VARCHAR"/> | |||
<result property="platformCode" column="platform_code" jdbcType="VARCHAR"/> | |||
<result property="platformName" column="platform_name" jdbcType="VARCHAR"/> | |||
<result property="platformUrl" column="platform_url" jdbcType="VARCHAR"/> | |||
<result property="createUser" column="create_user" jdbcType="VARCHAR"/> | |||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> | |||
<result property="updateUser" column="update_user" jdbcType="VARCHAR"/> | |||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> | |||
<result property="mark" column="mark" jdbcType="TINYINT"/> | |||
</resultMap> | |||
<sql id="Base_Column_List"> | |||
id,platform_code,platform_name, | |||
platform_url,create_user,create_time, | |||
update_user,update_time,mark | |||
</sql> | |||
</mapper> |
@@ -0,0 +1,24 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.mapper.TenantMapper"> | |||
<insert id="insertTenant" parameterType="com.tuoheng.model.po.TenantPo" keyProperty="id" useGeneratedKeys="true"> | |||
INSERT INTO t_tenant (user_id, remark, `code`, `name`) | |||
VALUES (#{userId}, #{remark}, #{code}, #{name}) | |||
</insert> | |||
<select id="getByCode" resultType="com.tuoheng.model.dto.TTenant"> | |||
select * | |||
from tuoheng_oidc.t_tenant | |||
where code = #{code} | |||
</select> | |||
<select id="findList" resultType="com.tuoheng.model.po.TenantPo"> | |||
SELECT id, user_id, remark,enabled, code, name | |||
FROM t_tenant | |||
WHERE enabled = 1 | |||
<if test="query.name != null and query.name != ''"> | |||
and name LIKE concat('%',#{query.name},'%') | |||
</if> | |||
ORDER BY create_time desc | |||
</select> | |||
</mapper> |
@@ -0,0 +1,62 @@ | |||
spring: | |||
security: | |||
oauth2: | |||
resource-server: | |||
jwt: | |||
issuer-uri: http://192.168.11.11:8090 #认证中心端点,作为资源端的配置 | |||
#issuer-uri: http://oidc.dev.t-aaron.com | |||
# 配置数据源 | |||
datasource: | |||
# 使用阿里的Druid连接池 | |||
type: com.alibaba.druid.pool.DruidDataSource | |||
driver-class-name: com.mysql.cj.jdbc.Driver | |||
# 填写你数据库的url、登录名、密码和数据库名 | |||
url: jdbc:mysql://192.168.11.13:3306/tuoheng_oidc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||
username: root | |||
password: idontcare | |||
druid: | |||
# 连接池的配置信息 | |||
# 初始连接数 | |||
initialSize: 5 | |||
# 最小连接池数量 | |||
minIdle: 5 | |||
# 最大连接池数量 | |||
maxActive: 20 | |||
# 配置获取连接等待超时的时间 | |||
maxWait: 60000 | |||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 | |||
timeBetweenEvictionRunsMillis: 60000 | |||
# 配置一个连接在池中最小生存的时间,单位是毫秒 | |||
minEvictableIdleTimeMillis: 300000 | |||
# 配置一个连接在池中最大生存的时间,单位是毫秒 | |||
maxEvictableIdleTimeMillis: 900000 | |||
# 配置检测连接是否有效 | |||
validationQuery: SELECT 1 FROM DUAL | |||
testWhileIdle: true | |||
testOnBorrow: false | |||
testOnReturn: false | |||
# Redis数据源 | |||
redis: | |||
# 缓存库默认索引0 | |||
database: 0 | |||
# Redis服务器地址 | |||
host: 192.168.11.13 | |||
# Redis服务器连接端口 | |||
port: 6379 | |||
# Redis服务器连接密码(默认为空) | |||
password: | |||
# 连接超时时间(毫秒) | |||
timeout: 6000 | |||
# 默认的数据过期时间,主要用于shiro权限管理 | |||
expire: 2592000 | |||
jedis: | |||
pool: | |||
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制) | |||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) | |||
max-idle: 10 # 连接池中的最大空闲连接 | |||
min-idle: 1 # 连接池中的最小空闲连接 | |||
oauth2: | |||
token: | |||
issuer: http://192.168.11.11:8090 |
@@ -0,0 +1,60 @@ | |||
spring: | |||
security: | |||
oauth2: | |||
resource-server: | |||
jwt: | |||
issuer-uri: http://127.0.0.1:8090 #认证中心端点,作为资源端的配置、 | |||
# 配置数据源 | |||
datasource: | |||
# 使用阿里的Druid连接池 | |||
type: com.alibaba.druid.pool.DruidDataSource | |||
driver-class-name: com.mysql.cj.jdbc.Driver | |||
# 填写你数据库的url、登录名、密码和数据库名 | |||
url: jdbc:mysql://192.168.11.13:3306/tuoheng_oidc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||
username: root | |||
password: idontcare | |||
druid: | |||
# 连接池的配置信息 | |||
# 初始连接数 | |||
initialSize: 5 | |||
# 最小连接池数量 | |||
minIdle: 5 | |||
# 最大连接池数量 | |||
maxActive: 20 | |||
# 配置获取连接等待超时的时间 | |||
maxWait: 60000 | |||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 | |||
timeBetweenEvictionRunsMillis: 60000 | |||
# 配置一个连接在池中最小生存的时间,单位是毫秒 | |||
minEvictableIdleTimeMillis: 300000 | |||
# 配置一个连接在池中最大生存的时间,单位是毫秒 | |||
maxEvictableIdleTimeMillis: 900000 | |||
# 配置检测连接是否有效 | |||
validationQuery: SELECT 1 FROM DUAL | |||
testWhileIdle: true | |||
testOnBorrow: false | |||
testOnReturn: false | |||
# Redis数据源 | |||
redis: | |||
# 缓存库默认索引0 | |||
database: 0 | |||
# Redis服务器地址 | |||
host: 192.168.11.13 | |||
# Redis服务器连接端口 | |||
port: 6379 | |||
# Redis服务器连接密码(默认为空) | |||
password: | |||
# 连接超时时间(毫秒) | |||
timeout: 6000 | |||
# 默认的数据过期时间,主要用于shiro权限管理 | |||
expire: 2592000 | |||
jedis: | |||
pool: | |||
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制) | |||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) | |||
max-idle: 10 # 连接池中的最大空闲连接 | |||
min-idle: 1 # 连接池中的最小空闲连接 | |||
oauth2: | |||
token: | |||
issuer: http://127.0.0.1:8090 |
@@ -0,0 +1,60 @@ | |||
spring: | |||
security: | |||
oauth2: | |||
resource-server: | |||
jwt: | |||
issuer-uri: https://oidc.t-aaron.com #认证中心端点,作为资源端的配置、 | |||
# 配置数据源 | |||
datasource: | |||
# 使用阿里的Druid连接池 | |||
type: com.alibaba.druid.pool.DruidDataSource | |||
driver-class-name: com.mysql.cj.jdbc.Driver | |||
# 填写你数据库的url、登录名、密码和数据库名 | |||
url: jdbc:mysql://rm-uf6x76i111rb1eo48.mysql.rds.aliyuncs.com:3306/tuoheng_oidc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||
username: root | |||
password: TH22#2022 | |||
druid: | |||
# 连接池的配置信息 | |||
# 初始连接数 | |||
initialSize: 5 | |||
# 最小连接池数量 | |||
minIdle: 5 | |||
# 最大连接池数量 | |||
maxActive: 20 | |||
# 配置获取连接等待超时的时间 | |||
maxWait: 60000 | |||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 | |||
timeBetweenEvictionRunsMillis: 60000 | |||
# 配置一个连接在池中最小生存的时间,单位是毫秒 | |||
minEvictableIdleTimeMillis: 300000 | |||
# 配置一个连接在池中最大生存的时间,单位是毫秒 | |||
maxEvictableIdleTimeMillis: 900000 | |||
# 配置检测连接是否有效 | |||
validationQuery: SELECT 1 FROM DUAL | |||
testWhileIdle: true | |||
testOnBorrow: false | |||
testOnReturn: false | |||
# Redis数据源 | |||
redis: | |||
# 缓存库默认索引0 | |||
database: 0 | |||
# Redis服务器地址 | |||
host: r-uf6r5lm7c7sfdv3ehb.redis.rds.aliyuncs.com | |||
# Redis服务器连接端口 | |||
port: 6379 | |||
# Redis服务器连接密码(默认为空) | |||
password: | |||
# 连接超时时间(毫秒) | |||
timeout: 6000 | |||
# 默认的数据过期时间,主要用于shiro权限管理 | |||
expire: 2592000 | |||
jedis: | |||
pool: | |||
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制) | |||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) | |||
max-idle: 10 # 连接池中的最大空闲连接 | |||
min-idle: 1 # 连接池中的最小空闲连接 | |||
oauth2: | |||
token: | |||
issuer: https://oidc.t-aaron.com |
@@ -0,0 +1,61 @@ | |||
spring: | |||
security: | |||
oauth2: | |||
resource-server: | |||
jwt: | |||
#issuer-uri: http://192.168.11.241:8090 #认证中心端点,作为资源端的配置、 | |||
issuer-uri: https://login-test.t-aaron.com #认证中心端点,作为资源端的配置、 | |||
# 配置数据源 | |||
datasource: | |||
# 使用阿里的Druid连接池 | |||
type: com.alibaba.druid.pool.DruidDataSource | |||
driver-class-name: com.mysql.cj.jdbc.Driver | |||
# 填写你数据库的url、登录名、密码和数据库名 | |||
url: jdbc:mysql://rm-uf6z740323e8053pj.mysql.rds.aliyuncs.com:3306/tuoheng_oidc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||
username: root | |||
password: TH22#2022 | |||
druid: | |||
# 连接池的配置信息 | |||
# 初始连接数 | |||
initialSize: 5 | |||
# 最小连接池数量 | |||
minIdle: 5 | |||
# 最大连接池数量 | |||
maxActive: 20 | |||
# 配置获取连接等待超时的时间 | |||
maxWait: 60000 | |||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 | |||
timeBetweenEvictionRunsMillis: 60000 | |||
# 配置一个连接在池中最小生存的时间,单位是毫秒 | |||
minEvictableIdleTimeMillis: 300000 | |||
# 配置一个连接在池中最大生存的时间,单位是毫秒 | |||
maxEvictableIdleTimeMillis: 900000 | |||
# 配置检测连接是否有效 | |||
validationQuery: SELECT 1 FROM DUAL | |||
testWhileIdle: true | |||
testOnBorrow: false | |||
testOnReturn: false | |||
# Redis数据源 | |||
redis: | |||
# 缓存库默认索引0 | |||
database: 0 | |||
# Redis服务器地址 | |||
host: r-uf6cdzjifj20jszykr.redis.rds.aliyuncs.com | |||
# Redis服务器连接端口 | |||
port: 6379 | |||
# Redis服务器连接密码(默认为空) | |||
password: | |||
# 连接超时时间(毫秒) | |||
timeout: 6000 | |||
# 默认的数据过期时间,主要用于shiro权限管理 | |||
expire: 2592000 | |||
jedis: | |||
pool: | |||
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制) | |||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) | |||
max-idle: 10 # 连接池中的最大空闲连接 | |||
min-idle: 1 # 连接池中的最小空闲连接 | |||
oauth2: | |||
token: | |||
issuer: https://login-test.t-aaron.com |
@@ -0,0 +1,12 @@ | |||
server: | |||
port: 8090 | |||
spring: | |||
profiles: | |||
active: dev | |||
web: | |||
resources: | |||
static-locations: classpath:/ | |||
mybatis: | |||
mapper-locations: classpath*:mapper/*Mapper.xml |
@@ -0,0 +1,69 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL,如果设置为WARN,则低于WARN的信息都不会输出 --> | |||
<!-- scan:当此属性设置为true时,配置文档如果发生改变,将会被重新加载,默认值为true --> | |||
<!-- scanPeriod:设置监测配置文档是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。 | |||
当scan为true时,此属性生效。默认的时间间隔为1分钟。 --> | |||
<!-- debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 --> | |||
<configuration scan="true" scanPeriod="60 seconds" debug="false"> | |||
<!-- | |||
contextName说明: | |||
每个logger都关联到logger上下文,默认上下文名称为“default”。但可以使用设置成其他名字, | |||
用于区分不同应用程序的记录。一旦设置,不能修改,可以通过%contextName来打印日志上下文名称。 | |||
--> | |||
<contextName>tuoheng_oidc_server</contextName> | |||
<!--定义日志变量--> | |||
<!--<property name="logging.path" value="D:\\idealogs\\tuoheng_oidc"/>--> | |||
<property name="logging.path" value="/data/java/logs/tuoheng_oidc"/> | |||
<!--日志格式: [时间] [级别] [线程] [行号] [logger信息] - [日志信息]--> | |||
<property name="logging.pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%level][%thread][%L] %logger - %msg%n"/> | |||
<property name="logging.charset" value="UTF-8"/> | |||
<property name="logging.maxHistory" value="15"/> | |||
<property name="logging.totalSizeCap" value="5GB"/> | |||
<property name="logging.maxFileSize" value="40MB"/> | |||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender"> | |||
<encoder> | |||
<pattern>${logging.pattern}</pattern> | |||
<charset>${logging.charset}</charset> | |||
</encoder> | |||
</appender> | |||
<appender name="LOG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |||
<File>${logging.path}/server/tuoheng_oidc_server.log</File> | |||
<append>true</append> | |||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | |||
<fileNamePattern>${logging.path}/server/tuoheng_oidc_server-%d-%i.log</fileNamePattern> | |||
<!-- 最大保存天数--> | |||
<maxHistory>${logging.maxHistory}</maxHistory> | |||
<totalSizeCap>${logging.totalSizeCap}</totalSizeCap> | |||
<maxFileSize>${logging.maxFileSize}</maxFileSize> | |||
</rollingPolicy> | |||
<!--编码器--> | |||
<encoder> | |||
<pattern>${logging.pattern}</pattern> | |||
<charset>${logging.charset}</charset> | |||
</encoder> | |||
</appender> | |||
<appender name="file.async" class="ch.qos.logback.classic.AsyncAppender"> | |||
<discardingThreshold>0</discardingThreshold> | |||
<queueSize>512</queueSize> | |||
<includeCallerData>true</includeCallerData> | |||
<appender-ref ref="LOG_FILE" /> | |||
</appender> | |||
<logger name="com.tuoheng" level="DEBUG" additivity="false"> | |||
<appender-ref ref="console" /> | |||
<appender-ref ref="file.async" /> | |||
</logger> | |||
<!--log4jdbc --> | |||
<logger name="jdbc.sqltiming" level="DEBUG" additivity="false"> | |||
<appender-ref ref="file.async" /> | |||
</logger> | |||
<root level="INFO"> | |||
<appender-ref ref="console" /> | |||
<appender-ref ref="file.async" /> | |||
</root> | |||
</configuration> |
@@ -0,0 +1,13 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.mapper.AuthoritiesMapper"> | |||
<insert id="batchInsert" parameterType="java.util.List"> | |||
insert into authorities (user_id, username, authority) | |||
VALUES | |||
<foreach collection ="list" item="it" separator =","> | |||
(#{it.userId}, #{it.username}, #{it.authority}) | |||
</foreach > | |||
</insert> | |||
</mapper> |
@@ -0,0 +1,39 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="com.tuoheng.mapper.UserMapper"> | |||
<resultMap type="com.tuoheng.model.dto.UserBaseInfoDto" id="UserBaseInfoMap"> | |||
<id column="userId" jdbcType="INTEGER" property="userId" /> | |||
<result column="userName" jdbcType="VARCHAR" property="userName" /> | |||
<result column="password" jdbcType="VARCHAR" property="password" /> | |||
<collection property="authorityList" ofType="java.lang.String" javaType="java.util.List"> | |||
<result column="authority" jdbcType="VARCHAR"/> | |||
</collection> | |||
<collection property="clientRoleDtoList" ofType="com.tuoheng.model.dto.ClientRoleDto" javaType="java.util.List"> | |||
<result column="clientId" jdbcType="VARCHAR" property="clientId" /> | |||
<result column="roleId" jdbcType="INTEGER" property="roleId" /> | |||
</collection> | |||
</resultMap> | |||
<insert id="insertUser" parameterType="com.tuoheng.model.po.UserPo" keyProperty="id" useGeneratedKeys="true"> | |||
insert into users (username, password) | |||
values (#{username}, #{password}) | |||
</insert> | |||
<select id="getUserBaseInfo" resultMap="UserBaseInfoMap"> | |||
select a.id as userId, a.username as userName, a.password , b.authority, c.client_id as clientId, c.role_id as roleId | |||
from users a | |||
left join authorities b on a.id = b.user_id | |||
left join t_client_user_role c on a.id = c.user_id | |||
where a.username = #{username} | |||
</select> | |||
<select id="getMpUserInfo" resultMap="UserBaseInfoMap"> | |||
select a.id as userId, a.username as userName, a.password , b.authority, c.client_id as clientId, c.role_id as roleId | |||
from users a | |||
left join authorities b on a.id = b.user_id | |||
left join t_client_user_role c on a.id = c.user_id | |||
where a.username = #{username} | |||
</select> | |||
</mapper> |
@@ -0,0 +1,174 @@ | |||
<!DOCTYPE html> | |||
<html lang="en"> | |||
<head> | |||
<meta charset="UTF-8"> | |||
<title>登录页面</title> | |||
</head> | |||
<head> | |||
<meta charset="UTF-8"> | |||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |||
<title>login</title> | |||
<script src="../static/jquery-3.5.1.min.js"></script> | |||
<style> | |||
.login__back{ | |||
position: fixed; | |||
top: 0; | |||
right: 0; | |||
bottom: 0; | |||
left: 0; | |||
background: url('../static/back.png'); | |||
background-position: center center; | |||
background-repeat: no-repeat; | |||
background-attachment: fixed; | |||
background-size: cover; | |||
} | |||
.login__form{ | |||
/* width: 460px; | |||
height: 410px; */ | |||
width: 410px; | |||
height: 350px; | |||
background: url('../static/form.png'); | |||
background-position: center center; | |||
background-repeat: no-repeat; | |||
background-size: cover; | |||
padding: 60px 30px; | |||
color: rgba(255, 255, 255, 1); | |||
position: relative; | |||
left: 50%; | |||
top: 50%; | |||
transform: translate(-50%,-50%); | |||
} | |||
.login__form h2{ | |||
font-size: 28px; | |||
line-height: 25px; | |||
text-align: center; | |||
margin-bottom: 10px; | |||
} | |||
.login__form p{ | |||
font-size: 12px; | |||
text-align: center; | |||
margin-bottom: 36px; | |||
} | |||
.login__form form{ | |||
padding: 0 40px; | |||
display: flex; | |||
flex-direction: column; | |||
background: transparent; | |||
} | |||
form input{ | |||
height: 40px; | |||
margin-bottom: 18px; | |||
border-radius: 6px; | |||
color: #FFFFFF; | |||
padding: 0 16px; | |||
border: 1px solid rgba(255, 255, 255, 0.5); | |||
background: transparent; | |||
} | |||
form input:focus-within{ | |||
outline: 0; | |||
border: 1px solid #08EBFE; | |||
} | |||
button{ | |||
height: 46px; | |||
border: none; | |||
border-radius: 6px; | |||
background: linear-gradient(0deg, #08EBFE 0%, #28BAC1 100%); | |||
margin-top: 20px; | |||
color: #FFFFFF; | |||
font-size: 16px; | |||
} | |||
.form__code{ | |||
display: flex; | |||
align-items: center; | |||
justify-content: space-between; | |||
margin-bottom: 18px; | |||
} | |||
.form__code input{ | |||
width: calc(100% - 152px); | |||
margin-bottom: 0; | |||
} | |||
.form__code img{ | |||
width: 100px; | |||
height: 42px; | |||
cursor: pointer; | |||
} | |||
.login__form .form__tips{ | |||
margin: 0; | |||
height: 0; | |||
position: relative; | |||
top: -14px; | |||
} | |||
.form__tips.is--error{ | |||
color: red | |||
} | |||
</style> | |||
</head> | |||
<body> | |||
<div class="login__back"> | |||
<div class="login__form"> | |||
<h2>拓恒统一登录平台</h2> | |||
<p>TUOHENG LOGIN PLATFORM</p> | |||
<form th:action="@{/login}" method="post"> | |||
<input name="username" placeholder="请输入用户名" type="text"/> | |||
<input name="password" placeholder="请输入密码" type="password"/> | |||
<div class="form__code"> | |||
<input name="validateCode" placeholder="请输入验证码" /> | |||
<input id="codekey" name="codekey" type="hidden"/> | |||
<img class="code__img" src="" /> | |||
</div> | |||
<div class="form__tips is--error" th:if="${param.error}"> | |||
用户名密码错误,请重新输入! | |||
</div> | |||
<div class="form__tips is--error" th:if="${param.validerror}"> | |||
验证码错误,请重新输入! | |||
</div> | |||
<div class="form__tips is--error" th:if="${param.expirecode}"> | |||
验证码已过期,请重新输入! | |||
</div> | |||
<button type="submit">登 录</button> | |||
</form> | |||
</div> | |||
</div> | |||
<!--绑定点击事件 --> | |||
<script> | |||
const imgDom = document.querySelector('.code__img') | |||
imgDom.onclick = function() { | |||
$.ajax({ | |||
url : "/vercode",//后台请求的数据 | |||
dataType: 'json', //数据格式 | |||
type : "post",//请求方式 | |||
async : true,//是否异步请求 | |||
success : function(data) { //如果请求成功,返回数据。 | |||
var tt = data.data; //第一个data代表json,第二个data代表json里的数组或对象 | |||
$('.code__img').attr('src', tt.captcha); | |||
$('#codekey').val(tt.codeKey); | |||
}, | |||
error : function (arg1) { | |||
alert("加载数据失败"); | |||
console.log(arg1); | |||
} | |||
}) | |||
} | |||
$(document).ready(function() { | |||
$.ajax({ | |||
url : "/vercode",//后台请求的数据 | |||
dataType: 'json', //数据格式 | |||
type : "post",//请求方式 | |||
async : true,//是否异步请求 | |||
success : function(data) { //如果请求成功,返回数据。 | |||
var tt = data.data; //第一个data代表json,第二个data代表json里的数组或对象 | |||
$('.code__img').attr('src', tt.captcha); | |||
$('#codekey').val(tt.codeKey); | |||
}, | |||
error : function (arg1) { | |||
alert("加载数据失败"); | |||
console.log(arg1); | |||
} | |||
}) | |||
}) | |||
</script> | |||
</body> | |||
</html> |
@@ -0,0 +1,62 @@ | |||
spring: | |||
security: | |||
oauth2: | |||
resource-server: | |||
jwt: | |||
issuer-uri: http://192.168.11.11:8090 #认证中心端点,作为资源端的配置 | |||
#issuer-uri: http://oidc.dev.t-aaron.com | |||
# 配置数据源 | |||
datasource: | |||
# 使用阿里的Druid连接池 | |||
type: com.alibaba.druid.pool.DruidDataSource | |||
driver-class-name: com.mysql.cj.jdbc.Driver | |||
# 填写你数据库的url、登录名、密码和数据库名 | |||
url: jdbc:mysql://192.168.11.13:3306/tuoheng_oidc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||
username: root | |||
password: idontcare | |||
druid: | |||
# 连接池的配置信息 | |||
# 初始连接数 | |||
initialSize: 5 | |||
# 最小连接池数量 | |||
minIdle: 5 | |||
# 最大连接池数量 | |||
maxActive: 20 | |||
# 配置获取连接等待超时的时间 | |||
maxWait: 60000 | |||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 | |||
timeBetweenEvictionRunsMillis: 60000 | |||
# 配置一个连接在池中最小生存的时间,单位是毫秒 | |||
minEvictableIdleTimeMillis: 300000 | |||
# 配置一个连接在池中最大生存的时间,单位是毫秒 | |||
maxEvictableIdleTimeMillis: 900000 | |||
# 配置检测连接是否有效 | |||
validationQuery: SELECT 1 FROM DUAL | |||
testWhileIdle: true | |||
testOnBorrow: false | |||
testOnReturn: false | |||
# Redis数据源 | |||
redis: | |||
# 缓存库默认索引0 | |||
database: 0 | |||
# Redis服务器地址 | |||
host: 192.168.11.13 | |||
# Redis服务器连接端口 | |||
port: 6379 | |||
# Redis服务器连接密码(默认为空) | |||
password: | |||
# 连接超时时间(毫秒) | |||
timeout: 6000 | |||
# 默认的数据过期时间,主要用于shiro权限管理 | |||
expire: 2592000 | |||
jedis: | |||
pool: | |||
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制) | |||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) | |||
max-idle: 10 # 连接池中的最大空闲连接 | |||
min-idle: 1 # 连接池中的最小空闲连接 | |||
oauth2: | |||
token: | |||
issuer: http://192.168.11.11:8090 |
@@ -0,0 +1,60 @@ | |||
spring: | |||
security: | |||
oauth2: | |||
resource-server: | |||
jwt: | |||
issuer-uri: http://127.0.0.1:8090 #认证中心端点,作为资源端的配置、 | |||
# 配置数据源 | |||
datasource: | |||
# 使用阿里的Druid连接池 | |||
type: com.alibaba.druid.pool.DruidDataSource | |||
driver-class-name: com.mysql.cj.jdbc.Driver | |||
# 填写你数据库的url、登录名、密码和数据库名 | |||
url: jdbc:mysql://192.168.11.13:3306/tuoheng_oidc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||
username: root | |||
password: idontcare | |||
druid: | |||
# 连接池的配置信息 | |||
# 初始连接数 | |||
initialSize: 5 | |||
# 最小连接池数量 | |||
minIdle: 5 | |||
# 最大连接池数量 | |||
maxActive: 20 | |||
# 配置获取连接等待超时的时间 | |||
maxWait: 60000 | |||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 | |||
timeBetweenEvictionRunsMillis: 60000 | |||
# 配置一个连接在池中最小生存的时间,单位是毫秒 | |||
minEvictableIdleTimeMillis: 300000 | |||
# 配置一个连接在池中最大生存的时间,单位是毫秒 | |||
maxEvictableIdleTimeMillis: 900000 | |||
# 配置检测连接是否有效 | |||
validationQuery: SELECT 1 FROM DUAL | |||
testWhileIdle: true | |||
testOnBorrow: false | |||
testOnReturn: false | |||
# Redis数据源 | |||
redis: | |||
# 缓存库默认索引0 | |||
database: 0 | |||
# Redis服务器地址 | |||
host: 192.168.11.13 | |||
# Redis服务器连接端口 | |||
port: 6379 | |||
# Redis服务器连接密码(默认为空) | |||
password: | |||
# 连接超时时间(毫秒) | |||
timeout: 6000 | |||
# 默认的数据过期时间,主要用于shiro权限管理 | |||
expire: 2592000 | |||
jedis: | |||
pool: | |||
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制) | |||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) | |||
max-idle: 10 # 连接池中的最大空闲连接 | |||
min-idle: 1 # 连接池中的最小空闲连接 | |||
oauth2: | |||
token: | |||
issuer: http://127.0.0.1:8090 |
@@ -0,0 +1,60 @@ | |||
spring: | |||
security: | |||
oauth2: | |||
resource-server: | |||
jwt: | |||
issuer-uri: https://oidc.t-aaron.com #认证中心端点,作为资源端的配置、 | |||
# 配置数据源 | |||
datasource: | |||
# 使用阿里的Druid连接池 | |||
type: com.alibaba.druid.pool.DruidDataSource | |||
driver-class-name: com.mysql.cj.jdbc.Driver | |||
# 填写你数据库的url、登录名、密码和数据库名 | |||
url: jdbc:mysql://rm-uf6x76i111rb1eo48.mysql.rds.aliyuncs.com:3306/tuoheng_oidc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||
username: root | |||
password: TH22#2022 | |||
druid: | |||
# 连接池的配置信息 | |||
# 初始连接数 | |||
initialSize: 5 | |||
# 最小连接池数量 | |||
minIdle: 5 | |||
# 最大连接池数量 | |||
maxActive: 20 | |||
# 配置获取连接等待超时的时间 | |||
maxWait: 60000 | |||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 | |||
timeBetweenEvictionRunsMillis: 60000 | |||
# 配置一个连接在池中最小生存的时间,单位是毫秒 | |||
minEvictableIdleTimeMillis: 300000 | |||
# 配置一个连接在池中最大生存的时间,单位是毫秒 | |||
maxEvictableIdleTimeMillis: 900000 | |||
# 配置检测连接是否有效 | |||
validationQuery: SELECT 1 FROM DUAL | |||
testWhileIdle: true | |||
testOnBorrow: false | |||
testOnReturn: false | |||
# Redis数据源 | |||
redis: | |||
# 缓存库默认索引0 | |||
database: 0 | |||
# Redis服务器地址 | |||
host: r-uf6r5lm7c7sfdv3ehb.redis.rds.aliyuncs.com | |||
# Redis服务器连接端口 | |||
port: 6379 | |||
# Redis服务器连接密码(默认为空) | |||
password: | |||
# 连接超时时间(毫秒) | |||
timeout: 6000 | |||
# 默认的数据过期时间,主要用于shiro权限管理 | |||
expire: 2592000 | |||
jedis: | |||
pool: | |||
max-active: 1000 # 连接池最大连接数(使用负值表示没有限制) | |||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) | |||
max-idle: 10 # 连接池中的最大空闲连接 | |||
min-idle: 1 # 连接池中的最小空闲连接 | |||
oauth2: | |||
token: | |||
issuer: https://oidc.t-aaron.com |