Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MaxKey单点登录官方(MaxKeyTop)
MaxKey
提交
b6d30a87
MaxKey
项目概览
MaxKey单点登录官方(MaxKeyTop)
/
MaxKey
11 个月 前同步成功
通知
76
Star
3
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MaxKey
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b6d30a87
编写于
4月 22, 2022
作者:
M
MaxKey
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
kaptcha
上级
e31a83b6
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
70 addition
and
11 deletion
+70
-11
maxkey-authentications/maxkey-authentication-captcha/src/main/java/com/google/code/kaptcha/impl/UniqueTextCreator.java
.../java/com/google/code/kaptcha/impl/UniqueTextCreator.java
+27
-0
maxkey-authentications/maxkey-authentication-captcha/src/main/resources/kaptcha.properties
...hentication-captcha/src/main/resources/kaptcha.properties
+5
-4
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/jwt/AuthJwtService.java
...re/src/main/java/org/maxkey/authn/jwt/AuthJwtService.java
+4
-1
maxkey-core/src/main/java/org/maxkey/entity/apps/Apps.java
maxkey-core/src/main/java/org/maxkey/entity/apps/Apps.java
+14
-2
maxkey-core/src/main/java/org/maxkey/entity/apps/AppsOAuth20Details.java
.../main/java/org/maxkey/entity/apps/AppsOAuth20Details.java
+1
-0
maxkey-core/src/main/java/org/maxkey/persistence/repository/InstitutionsRepository.java
...maxkey/persistence/repository/InstitutionsRepository.java
+17
-3
maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/endpoint/LoginEntryPoint.java
...rc/main/java/org/maxkey/web/endpoint/LoginEntryPoint.java
+1
-1
maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/LoginEntryPoint.java
.../main/java/org/maxkey/web/contorller/LoginEntryPoint.java
+1
-0
未找到文件。
maxkey-authentications/maxkey-authentication-captcha/src/main/java/com/google/code/kaptcha/impl/UniqueTextCreator.java
0 → 100644
浏览文件 @
b6d30a87
package
com.google.code.kaptcha.impl
;
import
java.util.Random
;
import
com.google.code.kaptcha.text.TextProducer
;
import
com.google.code.kaptcha.util.Configurable
;
public
class
UniqueTextCreator
extends
Configurable
implements
TextProducer
{
@Override
public
String
getText
()
{
int
length
=
getConfig
().
getTextProducerCharLength
();
char
[]
chars
=
getConfig
().
getTextProducerCharString
();
Random
rand
=
new
Random
();
StringBuffer
text
=
new
StringBuffer
();
int
i
=
0
;
while
(
i
<
length
){
char
word
=
chars
[
rand
.
nextInt
(
chars
.
length
)];
if
(
text
.
indexOf
(
word
+
""
)
<=
-
1
)
{
text
.
append
(
word
);
i
++;
}
}
return
text
.
toString
();
}
}
maxkey-authentications/maxkey-authentication-captcha/src/main/resources/kaptcha.properties
浏览文件 @
b6d30a87
kaptcha.image.width
=
8
0
kaptcha.image.width
=
12
0
kaptcha.image.height
=
40
kaptcha.border
=
no
#kaptcha.obscurificator.impl=com.google.code.kaptcha.impl.ShadowGimpy
kaptcha.obscurificator.impl
=
com.google.code.kaptcha.impl.Ripple
kaptcha.textproducer.font.size
=
23
kaptcha.textproducer.font.size
=
30
kaptcha.textproducer.char.string
=
0123456789
kaptcha.textproducer.char.length
=
4
kaptcha.textproducer.char.space
=
3
kaptcha.textproducer.char.space
=
6
#kaptcha.noise.impl=com.google.code.kaptcha.impl.DefaultNoise
kaptcha.noise.impl
=
com.google.code.kaptcha.impl.LightNoise
#kaptcha.noise.color=white
kaptcha.word.impl
=
com.google.code.kaptcha.text.impl.RandomColorWordRenderer
kaptcha.textproducer.impl
=
com.google.code.kaptcha.impl.UniqueTextCreator
\ No newline at end of file
maxkey-authentications/maxkey-authentication-core/src/main/java/org/maxkey/authn/jwt/AuthJwtService.java
浏览文件 @
b6d30a87
...
...
@@ -65,8 +65,11 @@ public class AuthJwtService {
* @return AuthJwt
*/
public
AuthJwt
genAuthJwt
(
Authentication
authentication
)
{
if
(
authentication
!=
null
)
{
return
new
AuthJwt
(
genJwt
(
authentication
),
authentication
);
}
return
null
;
}
/**
* JWT with Authentication
...
...
maxkey-core/src/main/java/org/maxkey/entity/apps/Apps.java
浏览文件 @
b6d30a87
...
...
@@ -141,6 +141,9 @@ public class Apps extends JpaBaseEntity implements Serializable {
@Column
private
String
adapter
;
@Column
private
String
frequently
;
@Column
protected
int
sortIndex
;
@Column
...
...
@@ -248,6 +251,15 @@ public class Apps extends JpaBaseEntity implements Serializable {
this
.
secret
=
secret
;
}
public
String
getFrequently
()
{
return
frequently
;
}
public
void
setFrequently
(
String
frequently
)
{
this
.
frequently
=
frequently
;
}
/**
* @return the icon
*/
...
...
maxkey-core/src/main/java/org/maxkey/entity/apps/AppsOAuth20Details.java
浏览文件 @
b6d30a87
...
...
@@ -106,6 +106,7 @@ public class AppsOAuth20Details extends Apps {
this
.
setAdapter
(
application
.
getAdapter
());
this
.
setAdapterId
(
application
.
getAdapterId
());
this
.
setAdapterName
(
application
.
getAdapterName
());
this
.
setFrequently
(
application
.
getFrequently
());
this
.
clientSecret
=
baseClientDetails
.
getClientSecret
();
this
.
scope
=
StringUtils
...
...
maxkey-core/src/main/java/org/maxkey/persistence/repository/InstitutionsRepository.java
浏览文件 @
b6d30a87
...
...
@@ -38,6 +38,8 @@ public class InstitutionsRepository {
private
static
final
String
SELECT_STATEMENT
=
"select * from mxk_institutions where id = ? or domain = ? "
;
private
static
final
String
DEFAULT_INSTID
=
"1"
;
protected
static
final
Cache
<
String
,
Institutions
>
institutionsStore
=
Caffeine
.
newBuilder
()
.
expireAfterWrite
(
60
,
TimeUnit
.
MINUTES
)
...
...
@@ -54,7 +56,17 @@ public class InstitutionsRepository {
public
Institutions
get
(
String
instIdOrDomain
)
{
_logger
.
trace
(
" instId {}"
,
instIdOrDomain
);
Institutions
inst
=
institutionsStore
.
getIfPresent
(
mapper
.
get
(
instIdOrDomain
)==
null
?
"1"
:
mapper
.
get
(
instIdOrDomain
)
);
Institutions
inst
=
getByInstIdOrDomain
(
instIdOrDomain
);
if
(
inst
==
null
)
{
//use default inst
inst
=
getByInstIdOrDomain
(
DEFAULT_INSTID
);
institutionsStore
.
put
(
instIdOrDomain
,
inst
);
}
return
inst
;
}
private
Institutions
getByInstIdOrDomain
(
String
instIdOrDomain
)
{
_logger
.
trace
(
" instId {}"
,
instIdOrDomain
);
Institutions
inst
=
institutionsStore
.
getIfPresent
(
mapper
.
get
(
instIdOrDomain
)==
null
?
DEFAULT_INSTID
:
mapper
.
get
(
instIdOrDomain
)
);
if
(
inst
==
null
)
{
List
<
Institutions
>
institutions
=
jdbcTemplate
.
query
(
SELECT_STATEMENT
,
new
InstitutionsRowMapper
(),
instIdOrDomain
,
instIdOrDomain
);
...
...
@@ -62,9 +74,11 @@ public class InstitutionsRepository {
if
(
institutions
!=
null
&&
institutions
.
size
()
>
0
)
{
inst
=
institutions
.
get
(
0
);
}
if
(
inst
!=
null
)
{
institutionsStore
.
put
(
inst
.
getDomain
(),
inst
);
mapper
.
put
(
inst
.
getId
(),
inst
.
getDomain
());
}
}
return
inst
;
}
...
...
maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/endpoint/LoginEntryPoint.java
浏览文件 @
b6d30a87
...
...
@@ -155,7 +155,7 @@ public class LoginEntryPoint {
String
authType
=
loginCredential
.
getAuthType
();
_logger
.
debug
(
"Login AuthN Type "
+
authType
);
if
(
StringUtils
.
isNotBlank
(
authType
)){
Authentication
authentication
=
authenticationProvider
.
doA
uthenticate
(
loginCredential
);
Authentication
authentication
=
authenticationProvider
.
a
uthenticate
(
loginCredential
);
if
(
authentication
!=
null
)
{
authJwtMessage
=
new
Message
<
AuthJwt
>(
authJwtService
.
genAuthJwt
(
authentication
));
}
...
...
maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/LoginEntryPoint.java
浏览文件 @
b6d30a87
...
...
@@ -45,6 +45,7 @@ import org.springframework.http.MediaType;
*
*/
@Controller
@RequestMapping
(
value
=
"/login"
)
public
class
LoginEntryPoint
{
private
static
Logger
_logger
=
LoggerFactory
.
getLogger
(
LoginEntryPoint
.
class
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录