Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzuaa
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzuaa
提交
651e5b5a
提交
651e5b5a
编写于
9月 09, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
login
上级
1fe53228
变更
6
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
43 行增加
和
84 行删除
+43
-84
UserDingtalkRegisterService.java
...e/uaa/extensions/service/UserDingtalkRegisterService.java
+12
-7
UserQQRegisterService.java
...ab/core/uaa/extensions/service/UserQQRegisterService.java
+1
-1
UserWechatRegisterService.java
...ore/uaa/extensions/service/UserWechatRegisterService.java
+1
-1
UserDingtalkRegisterResource.java
...lab/api/rest/extensions/UserDingtalkRegisterResource.java
+8
-23
UserQQRegisterResource.java
...n/ibizlab/api/rest/extensions/UserQQRegisterResource.java
+12
-28
UserWechatRegisterResource.java
...izlab/api/rest/extensions/UserWechatRegisterResource.java
+9
-24
未找到文件。
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/service/UserDingtalkRegisterService.java
浏览文件 @
651e5b5a
...
...
@@ -109,12 +109,17 @@ public class UserDingtalkRegisterService {
if
((
sysOpenAccess
==
null
||
(
sysOpenAccess
.
getDisabled
()!=
null
&&
sysOpenAccess
.
getDisabled
()==
1
))&&
throwEx
)
throw
new
BadRequestAlertException
(
"获取接入配置失败"
,
"UserDingtalkRegisterService"
,
""
);
String
accessToken
=
getAccessToken
(
sysOpenAccess
.
getAccessKey
(),
sysOpenAccess
.
getSecretKey
());
if
(!
accessToken
.
equals
(
sysOpenAccess
.
getAccessToken
()))
{
sysOpenAccess
.
setAccessToken
(
accessToken
);
sysOpenAccess
.
setExpiresTime
(
new
Timestamp
(
lastRefreshTime
));
sysOpenAccessService
.
update
(
sysOpenAccess
);
try
{
// 可能抛出异常,但暂时不进行处理
String
accessToken
=
getAccessToken
(
sysOpenAccess
.
getAccessKey
(),
sysOpenAccess
.
getSecretKey
());
if
(!
accessToken
.
equals
(
sysOpenAccess
.
getAccessToken
()))
{
sysOpenAccess
.
setAccessToken
(
accessToken
);
sysOpenAccess
.
setExpiresTime
(
new
Timestamp
(
lastRefreshTime
));
sysOpenAccessService
.
update
(
sysOpenAccess
);
}
}
catch
(
Exception
e
)
{
}
return
sysOpenAccess
;
...
...
@@ -171,7 +176,7 @@ public class UserDingtalkRegisterService {
* @return
*/
public
JSONObject
getUserBySnsToken
(
String
id
,
String
requestAuthCode
)
{
JSONObject
returnObj
=
n
ull
;
JSONObject
returnObj
=
n
ew
JSONObject
()
;
SysOpenAccess
openAccess
=
getOpenAccess
(
id
);
if
(
openAccess
==
null
||
(
openAccess
.
getDisabled
()!=
null
&&
openAccess
.
getDisabled
()==
1
))
...
...
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/service/UserQQRegisterService.java
浏览文件 @
651e5b5a
...
...
@@ -59,7 +59,7 @@ public class UserQQRegisterService {
* @return
*/
public
JSONObject
getUserBySnsToken
(
String
id
,
String
requestAuthCode
)
{
JSONObject
returnObj
=
n
ull
;
JSONObject
returnObj
=
n
ew
JSONObject
()
;
SysOpenAccess
openAccess
=
getOpenAccess
(
id
);
if
(
openAccess
==
null
||
(
openAccess
.
getDisabled
()!=
null
&&
openAccess
.
getDisabled
()==
1
))
...
...
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/service/UserWechatRegisterService.java
浏览文件 @
651e5b5a
...
...
@@ -86,7 +86,7 @@ public class UserWechatRegisterService {
String
unionid
=
returnObj
.
getString
(
"unionid"
);
SysUserAuth
userAuth
=
sysUserAuthService
.
getOne
(
Wrappers
.<
SysUserAuth
>
lambdaQuery
().
eq
(
SysUserAuth:
:
getIdentityType
,
"we
b
chat"
)
SysUserAuth
userAuth
=
sysUserAuthService
.
getOne
(
Wrappers
.<
SysUserAuth
>
lambdaQuery
().
eq
(
SysUserAuth:
:
getIdentityType
,
"wechat"
)
.
and
(
wrapper
->
wrapper
.
eq
(
SysUserAuth:
:
getIdentifier
,
openid
).
or
().
eq
(
SysUserAuth:
:
getIdentifier
,
unionid
)
),
false
);
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/UserDingtalkRegisterResource.java
浏览文件 @
651e5b5a
...
...
@@ -44,8 +44,11 @@ public class UserDingtalkRegisterResource {
@Autowired
private
ISysOpenAccessService
openAccessService
;
/**
* 获取钉钉开放平台创建的网站应用appid
* @param id
* @return
*/
@GetMapping
(
value
=
{
"/uaa/getDingtalkAppId"
,
"/uaa/open/dingtalk/access_token"
,
"/uaa/open/dingtalk/appid"
})
public
ResponseEntity
<
JSONObject
>
getDingtalkAppId
(
@RequestParam
(
value
=
"id"
,
required
=
false
)
String
id
)
{
...
...
@@ -64,26 +67,14 @@ public class UserDingtalkRegisterResource {
return
ResponseEntity
.
ok
(
obj
);
}
/**
* 根据code查钉钉用户
*
* @param param
* 扫码后查询钉钉用户
* 已注册:返回注册用户并登录
* 未注册:进行注册
* @param code
* @param id
* @return
*/
@PostMapping
(
value
=
"/uaa/queryDingtalkUserByCode"
)
public
ResponseEntity
<
JSONObject
>
queryDingtalkUserByCode
(
@RequestParam
(
value
=
"id"
,
required
=
false
)
String
id
,
@RequestParam
(
value
=
"code"
,
required
=
false
)
String
tmpcode
,
@RequestBody
JSONObject
param
)
{
// 空校验
String
code
=
param
.
getString
(
"code"
);
if
(
StringUtils
.
isEmpty
(
code
))
code
=
tmpcode
;
if
(
StringUtils
.
isEmpty
(
code
))
throw
new
BadRequestAlertException
(
"code为空"
,
"UserDingtalkRegisterResource"
,
""
);
return
ResponseEntity
.
ok
().
body
(
getUserBySnsCode
(
id
,
code
));
}
@GetMapping
(
value
=
"/uaa/open/dingtalk/sns/{code}"
)
public
ResponseEntity
<
JSONObject
>
getUserBySnsToken
(
@PathVariable
(
value
=
"code"
)
String
code
,
@RequestParam
(
value
=
"id"
,
required
=
false
)
String
id
)
{
if
(
StringUtils
.
isEmpty
(
code
))
...
...
@@ -114,13 +105,11 @@ public class UserDingtalkRegisterResource {
/**
* 绑定钉钉并注册
*
* @param param
* @return
*/
@PostMapping
(
value
=
{
"/uaa/bindDingtalkToRegister"
,
"/uaa/open/dingtalk/bind"
})
public
ResponseEntity
<
AuthenticationInfo
>
bindDingtalkToRegister
(
@RequestBody
JSONObject
param
)
{
// 空校验
String
loginname
=
param
.
getString
(
"loginname"
);
String
password
=
param
.
getString
(
"password"
);
...
...
@@ -136,8 +125,6 @@ public class UserDingtalkRegisterResource {
throw
new
BadRequestAlertException
(
"密码为空"
,
"UserDingtalkRegisterResource"
,
""
);
if
(
StringUtils
.
isEmpty
(
openid
))
throw
new
BadRequestAlertException
(
"钉钉信息openid为空"
,
"UserDingtalkRegisterResource"
,
""
);
if
(
StringUtils
.
isEmpty
(
nickname
))
throw
new
BadRequestAlertException
(
"钉钉信息nickname为空"
,
"UserDingtalkRegisterResource"
,
""
);
// 钉钉用户注册
IBZUSER
ibzuser
=
new
IBZUSER
();
...
...
@@ -155,8 +142,6 @@ public class UserDingtalkRegisterResource {
userRegisterService
.
toRegister
(
ibzuser
,
userAuth
);
// 生成登录token信息
userDetailsService
.
resetByUsername
(
ibzuser
.
getLoginname
()+(
StringUtils
.
isEmpty
(
ibzuser
.
getDomains
())?
""
:(
"|"
+
ibzuser
.
getDomains
())));
AuthenticationUser
user
=
userDetailsService
.
loadUserByUsername
(
ibzuser
.
getLoginname
()+(
StringUtils
.
isEmpty
(
ibzuser
.
getDomains
())?
""
:(
"|"
+
ibzuser
.
getDomains
())));
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/UserQQRegisterResource.java
浏览文件 @
651e5b5a
...
...
@@ -18,6 +18,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.context.annotation.Primary
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -34,10 +35,6 @@ public class UserQQRegisterResource {
@Autowired
private
UserRegisterService
userRegisterService
;
@Autowired
private
IBZUSERService
ibzuserService
;
@Autowired
private
ISysUserAuthService
sysUserAuthService
;
@Autowired
private
AuthTokenUtil
jwtTokenUtil
;
@Autowired
@Qualifier
(
"UAAUserService"
)
...
...
@@ -45,8 +42,11 @@ public class UserQQRegisterResource {
@Autowired
private
ISysOpenAccessService
openAccessService
;
/**
* 获取QQ互联平台创建的网站应用appid
* 获取qq互联平台创建的网站应用appid
* @param id
* @return
*/
@GetMapping
(
value
=
{
"/uaa/getQQAppId"
,
"/uaa/open/qq/access_token"
,
"/uaa/open/qq/appid"
})
public
ResponseEntity
<
JSONObject
>
getQQAppId
(
@RequestParam
(
value
=
"id"
,
required
=
false
)
String
id
)
{
...
...
@@ -67,24 +67,13 @@ public class UserQQRegisterResource {
/**
* 根据code查qq用户
*
* @param param
* 扫码后查询qq用户
* 已注册:返回注册用户并登录
* 未注册:进行注册
* @param code
* @param id
* @return
*/
@PostMapping
(
value
=
"/uaa/queryQQUserByCode"
)
public
ResponseEntity
<
JSONObject
>
queryQQUserByCode
(
@RequestParam
(
value
=
"id"
,
required
=
false
)
String
id
,
@RequestParam
(
value
=
"code"
,
required
=
false
)
String
tmpcode
,
@RequestBody
JSONObject
param
)
{
// 空校验
String
code
=
param
.
getString
(
"code"
);
if
(
StringUtils
.
isEmpty
(
code
))
code
=
tmpcode
;
if
(
StringUtils
.
isEmpty
(
code
))
throw
new
BadRequestAlertException
(
"code为空"
,
"UserQQRegisterResource"
,
""
);
return
ResponseEntity
.
ok
().
body
(
getUserBySnsCode
(
id
,
code
));
}
@GetMapping
(
value
=
"/uaa/open/qq/sns/{code}"
)
public
ResponseEntity
<
JSONObject
>
getUserBySnsToken
(
@PathVariable
(
value
=
"code"
)
String
code
,
@RequestParam
(
value
=
"id"
,
required
=
false
)
String
id
)
{
if
(
StringUtils
.
isEmpty
(
code
))
...
...
@@ -114,14 +103,12 @@ public class UserQQRegisterResource {
/**
* 绑定QQ并注册
*
* 绑定qq并注册
* @param param
* @return
*/
@PostMapping
(
value
=
{
"/uaa/bindQQtoRegister"
,
"/uaa/open/qq/bind"
})
public
ResponseEntity
<
AuthenticationInfo
>
bindQQToRegister
(
@RequestBody
JSONObject
param
)
{
// 空校验
String
loginname
=
param
.
getString
(
"loginname"
);
String
password
=
param
.
getString
(
"password"
);
...
...
@@ -138,8 +125,7 @@ public class UserQQRegisterResource {
if
(
StringUtils
.
isEmpty
(
openid
))
throw
new
BadRequestAlertException
(
"QQ信息openid为空"
,
"UserQQRegisterResource"
,
""
);
// 微信用户注册
// qq用户注册
IBZUSER
ibzuser
=
new
IBZUSER
();
ibzuser
.
setPassword
(
password
);
ibzuser
.
setLoginname
(
loginname
);
...
...
@@ -155,8 +141,6 @@ public class UserQQRegisterResource {
userRegisterService
.
toRegister
(
ibzuser
,
userAuth
);
// 生成登录token信息
userDetailsService
.
resetByUsername
(
ibzuser
.
getLoginname
()+(
StringUtils
.
isEmpty
(
ibzuser
.
getDomains
())?
""
:(
"|"
+
ibzuser
.
getDomains
())));
AuthenticationUser
user
=
userDetailsService
.
loadUserByUsername
(
ibzuser
.
getLoginname
()+(
StringUtils
.
isEmpty
(
ibzuser
.
getDomains
())?
""
:(
"|"
+
ibzuser
.
getDomains
())));
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/UserWechatRegisterResource.java
浏览文件 @
651e5b5a
...
...
@@ -45,8 +45,11 @@ public class UserWechatRegisterResource {
@Autowired
private
ISysOpenAccessService
openAccessService
;
/**
* 获取微信开放平台创建的网站应用appid
* @param id
* @return
*/
@GetMapping
(
value
=
{
"/uaa/getWechatAppId"
,
"/uaa/open/wechat/access_token"
,
"/uaa/open/wechat/appid"
})
public
ResponseEntity
<
JSONObject
>
getWechatAppId
(
@RequestParam
(
value
=
"id"
,
required
=
false
)
String
id
)
{
...
...
@@ -54,7 +57,7 @@ public class UserWechatRegisterResource {
SysOpenAccess
openAccess
=
userWechatRegisterService
.
getOpenAccess
(
id
,
false
);
if
(
openAccess
==
null
||
(
openAccess
.
getDisabled
()!=
null
&&
openAccess
.
getDisabled
()==
1
))
return
ResponseEntity
.
ok
(
obj
);
String
appId
=
openAccess
.
getAccessKey
();
//
qq互联
appid
String
appId
=
openAccess
.
getAccessKey
();
//
微信开放平台
appid
if
(!
StringUtils
.
isEmpty
(
appId
))
{
obj
.
put
(
"appid"
,
appId
);
obj
.
put
(
"corp_id"
,
openAccess
.
getRegionId
());
...
...
@@ -65,27 +68,14 @@ public class UserWechatRegisterResource {
}
/**
* 根据code查微信用户
*
* @param param
* 扫码后查询微信用户
* 已注册:返回注册用户并登录
* 未注册:进行注册
* @param code
* @param id
* @return
*/
@PostMapping
(
value
=
"/uaa/queryWechatUserByCode"
)
public
ResponseEntity
<
JSONObject
>
queryWechatUserByCode
(
@RequestParam
(
value
=
"id"
,
required
=
false
)
String
id
,
@RequestParam
(
value
=
"code"
,
required
=
false
)
String
tmpcode
,
@RequestBody
JSONObject
param
)
{
// 空校验
String
code
=
param
.
getString
(
"code"
);
if
(
StringUtils
.
isEmpty
(
code
))
code
=
tmpcode
;
if
(
StringUtils
.
isEmpty
(
code
))
throw
new
BadRequestAlertException
(
"code为空"
,
"UserWechatRegisterResource"
,
""
);
return
ResponseEntity
.
ok
().
body
(
getUserBySnsCode
(
id
,
code
));
}
@GetMapping
(
value
=
"/uaa/open/wechat/sns/{code}"
)
public
ResponseEntity
<
JSONObject
>
getUserBySnsToken
(
@PathVariable
(
value
=
"code"
)
String
code
,
@RequestParam
(
value
=
"id"
,
required
=
false
)
String
id
)
{
if
(
StringUtils
.
isEmpty
(
code
))
...
...
@@ -116,13 +106,11 @@ public class UserWechatRegisterResource {
/**
* 绑定微信并注册
*
* @param param
* @return
*/
@PostMapping
(
value
=
{
"/uaa/bindWechatToRegister"
,
"/uaa/open/wechat/bind"
})
public
ResponseEntity
<
AuthenticationInfo
>
bindWechatToRegister
(
@RequestBody
JSONObject
param
)
{
// 空校验
String
loginname
=
param
.
getString
(
"loginname"
);
String
password
=
param
.
getString
(
"password"
);
...
...
@@ -139,7 +127,6 @@ public class UserWechatRegisterResource {
if
(
StringUtils
.
isEmpty
(
openid
))
throw
new
BadRequestAlertException
(
"微信信息openid为空"
,
"UserWechatRegisterResource"
,
""
);
// 微信用户注册
IBZUSER
ibzuser
=
new
IBZUSER
();
ibzuser
.
setPassword
(
password
);
...
...
@@ -156,8 +143,6 @@ public class UserWechatRegisterResource {
userRegisterService
.
toRegister
(
ibzuser
,
userAuth
);
// 生成登录token信息
userDetailsService
.
resetByUsername
(
ibzuser
.
getLoginname
()+(
StringUtils
.
isEmpty
(
ibzuser
.
getDomains
())?
""
:(
"|"
+
ibzuser
.
getDomains
())));
AuthenticationUser
user
=
userDetailsService
.
loadUserByUsername
(
ibzuser
.
getLoginname
()+(
StringUtils
.
isEmpty
(
ibzuser
.
getDomains
())?
""
:(
"|"
+
ibzuser
.
getDomains
())));
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录