@@ -27,7 +27,7 @@ public class JwtUser implements UserDetails { | |||
id = user.getUserId(); | |||
username = user.getUserName(); | |||
password = user.getPassword(); | |||
authorities = Collections.singleton(new SimpleGrantedAuthority(user.getAuthority())); | |||
authorities = Collections.singleton(new SimpleGrantedAuthority(user.getAuthorityList().toString())); | |||
} | |||
@Override |
@@ -2,6 +2,8 @@ package com.tuoheng.model.dto; | |||
import lombok.Data; | |||
import java.util.List; | |||
/** | |||
* @author chenjiandong | |||
* @description: TODO | |||
@@ -16,6 +18,6 @@ public class UserBaseInfoDto { | |||
private String password; | |||
private String authority; | |||
private List<String> authorityList; | |||
} |
@@ -31,7 +31,7 @@ public class OidcUserInfoServiceImpl implements OidcUserInfoService { | |||
if (scopes.contains(OidcScopes.PROFILE)) { | |||
builder.claim("userId", userBaseInfoDto.getUserId()) | |||
.claim("userName", userBaseInfoDto.getUserName()) | |||
.claim("authority", userBaseInfoDto.getAuthority()); | |||
.claim("authority", userBaseInfoDto.getAuthorityList()); | |||
} | |||
/*if (scopes.contains(OidcScopes.EMAIL)) { | |||
builder.email(name + "@163.com").emailVerified(true); |
@@ -11,7 +11,7 @@ spring: | |||
type: com.alibaba.druid.pool.DruidDataSource | |||
driver-class-name: com.mysql.cj.jdbc.Driver | |||
# 填写你数据库的url、登录名、密码和数据库名 | |||
url: jdbc:mysql://192.168.11.242:3306/tuoheng_dsp?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||
url: jdbc:mysql://192.168.11.242:3306/tuoheng_oidc?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2b8&useSSL=true&tinyInt1isBit=false | |||
username: root | |||
password: idontcare | |||
druid: |
@@ -2,13 +2,22 @@ | |||
<!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> | |||
</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" resultType="com.tuoheng.model.dto.UserBaseInfoDto"> | |||
<select id="getUserBaseInfo" resultMap="UserBaseInfoMap"> | |||
select a.id as userId, a.username as userName, a.password , b.authority | |||
from users a | |||
inner join authorities b on a.id = b.user_id |