Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yujianwangzivayy
MaxKey
提交
65788971
MaxKey
项目概览
yujianwangzivayy
/
MaxKey
与 Fork 源项目一致
Fork自
MaxKey单点登录官方(MaxKeyTop) / MaxKey
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MaxKey
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
65788971
编写于
2月 27, 2022
作者:
M
MaxKey
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
qiye.163.com
上级
feabbcdd
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
92 addition
and
2 deletion
+92
-2
maxkey-common/src/main/java/org/maxkey/crypto/RSAUtils.java
maxkey-common/src/main/java/org/maxkey/crypto/RSAUtils.java
+2
-2
maxkey-protocols/maxkey-protocol-extendapi/src/main/java/org/maxkey/authz/exapi/endpoint/adapter/ExtendApiQiye163ExmailAdapter.java
...exapi/endpoint/adapter/ExtendApiQiye163ExmailAdapter.java
+90
-0
未找到文件。
maxkey-common/src/main/java/org/maxkey/crypto/RSAUtils.java
浏览文件 @
65788971
...
...
@@ -208,7 +208,7 @@ public final class RSAUtils {
return
cipher
.
doFinal
(
data
);
}
public
byte
[]
sign
(
byte
[]
src
,
RSAPrivateKey
privateKey
,
String
algorithm
)
{
public
static
byte
[]
sign
(
byte
[]
src
,
RSAPrivateKey
privateKey
,
String
algorithm
)
{
if
(
StringUtils
.
isBlank
(
algorithm
))
{
algorithm
=
"SHA1withRSA"
;
}
...
...
@@ -223,7 +223,7 @@ public final class RSAUtils {
}
}
public
boolean
verify
(
byte
[]
sign
,
byte
[]
src
,
RSAPublicKey
publicKey
,
String
algorithm
)
{
public
static
boolean
verify
(
byte
[]
sign
,
byte
[]
src
,
RSAPublicKey
publicKey
,
String
algorithm
)
{
try
{
if
(
StringUtils
.
isBlank
(
algorithm
))
{
algorithm
=
"SHA1withRSA"
;
...
...
maxkey-protocols/maxkey-protocol-extendapi/src/main/java/org/maxkey/authz/exapi/endpoint/adapter/ExtendApiQiye163ExmailAdapter.java
0 → 100644
浏览文件 @
65788971
/*
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org.maxkey.authz.exapi.endpoint.adapter
;
import
java.io.UnsupportedEncodingException
;
import
java.security.interfaces.RSAPrivateKey
;
import
org.maxkey.authz.endpoint.adapter.AbstractAuthorizeAdapter
;
import
org.maxkey.crypto.HexUtils
;
import
org.maxkey.crypto.RSAUtils
;
import
org.maxkey.entity.Accounts
;
import
org.maxkey.entity.ExtraAttrs
;
import
org.maxkey.entity.apps.Apps
;
import
org.maxkey.util.HttpsTrusts
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.web.servlet.ModelAndView
;
/**
* qiye.163.com
* @author shimingxy
*
*/
public
class
ExtendApiQiye163ExmailAdapter
extends
AbstractAuthorizeAdapter
{
final
static
Logger
_logger
=
LoggerFactory
.
getLogger
(
ExtendApiQiye163ExmailAdapter
.
class
);
//https://entryhz.qiye.163.com
static
String
REDIRECT_URI
=
"https://entryhz.qiye.163.com/domain/oa/Entry?domain=%s&account_name=%s&time=%s&enc=%s"
;
Accounts
account
;
@Override
public
Object
generateInfo
()
{
return
null
;
}
@Override
public
ModelAndView
authorize
(
ModelAndView
modelAndView
)
{
HttpsTrusts
.
beforeConnection
();
Apps
details
=(
Apps
)
app
;
//extraAttrs from Applications
ExtraAttrs
extraAttrs
=
null
;
if
(
details
.
getIsExtendAttr
()==
1
){
extraAttrs
=
new
ExtraAttrs
(
details
.
getExtendAttr
());
}
String
time
=
System
.
currentTimeMillis
()
+
""
;
//域名,请使用企业自己的域名
String
domain
=
details
.
getPrincipal
();
String
account_name
=
this
.
userInfo
.
getEmail
();
//String lang = "0";
String
src
=
account_name
+
domain
+
time
;
String
privateKey
=
details
.
getCredentials
();
String
enc
=
null
;
try
{
enc
=
HexUtils
.
bytes2HexString
(
RSAUtils
.
sign
(
src
.
getBytes
(
"UTF-8"
),
(
RSAPrivateKey
)
RSAUtils
.
privateKey
(
HexUtils
.
hex2Bytes
(
privateKey
)),
null
)
);
String
loginUrl
=
String
.
format
(
REDIRECT_URI
,
domain
,
account_name
,
time
,
enc
);
_logger
.
debug
(
"LoginUrl {} "
,
loginUrl
);
modelAndView
.
addObject
(
"redirect_uri"
,
loginUrl
);
}
catch
(
UnsupportedEncodingException
e
)
{
_logger
.
error
(
"UnsupportedEncodingException "
,
e
);
}
catch
(
Exception
e
)
{
_logger
.
error
(
"Exception "
,
e
);
}
return
modelAndView
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录