Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MaxKey单点登录官方(MaxKeyTop)
MaxKey
提交
1ad1db98
MaxKey
项目概览
MaxKey单点登录官方(MaxKeyTop)
/
MaxKey
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
1ad1db98
编写于
5月 23, 2020
作者:
MaxKey单点登录官方
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
v2.0.0RC1
v2.0.0RC1
上级
bcbd926b
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
314 addition
and
103 deletion
+314
-103
maxkey-authentications/src/main/java/org/maxkey/authn/support/basic/BasicEntryPoint.java
.../java/org/maxkey/authn/support/basic/BasicEntryPoint.java
+10
-1
maxkey-authentications/src/main/java/org/maxkey/authn/support/httpheader/HttpHeaderConfig.java
...org/maxkey/authn/support/httpheader/HttpHeaderConfig.java
+5
-0
maxkey-authentications/src/main/java/org/maxkey/authn/support/httpheader/HttpHeaderEntryPoint.java
...maxkey/authn/support/httpheader/HttpHeaderEntryPoint.java
+11
-5
maxkey-authentications/src/main/java/org/maxkey/authn/support/socialsignon/service/SocialSignOnProvider.java
...hn/support/socialsignon/service/SocialSignOnProvider.java
+7
-0
maxkey-authentications/src/main/java/org/maxkey/authn/support/socialsignon/service/SocialSignOnProviderService.java
...ort/socialsignon/service/SocialSignOnProviderService.java
+2
-1
maxkey-web-maxkey/src/main/java/org/maxkey/MaxKeyConfig.java
maxkey-web-maxkey/src/main/java/org/maxkey/MaxKeyConfig.java
+117
-1
maxkey-web-maxkey/src/main/java/org/maxkey/MaxKeyMvcConfig.java
...-web-maxkey/src/main/java/org/maxkey/MaxKeyMvcConfig.java
+138
-0
maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/HistoryLoginAppAdapter.java
...va/org/maxkey/web/interceptor/HistoryLoginAppAdapter.java
+2
-0
maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/HistoryLogsAdapter.java
...n/java/org/maxkey/web/interceptor/HistoryLogsAdapter.java
+2
-0
maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/PermissionAdapter.java
...in/java/org/maxkey/web/interceptor/PermissionAdapter.java
+2
-1
maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/PreLoginAppAdapter.java
...n/java/org/maxkey/web/interceptor/PreLoginAppAdapter.java
+2
-0
maxkey-web-maxkey/src/main/resources/META-INF/spring.factories
...y-web-maxkey/src/main/resources/META-INF/spring.factories
+2
-1
maxkey-web-maxkey/src/main/resources/config/applicationConfig.properties
...ey/src/main/resources/config/applicationConfig.properties
+2
-0
maxkey-web-maxkey/src/main/resources/spring/maxkey.xml
maxkey-web-maxkey/src/main/resources/spring/maxkey.xml
+12
-93
未找到文件。
maxkey-authentications/src/main/java/org/maxkey/authn/support/basic/BasicEntryPoint.java
浏览文件 @
1ad1db98
...
...
@@ -18,7 +18,16 @@ public class BasicEntryPoint extends HandlerInterceptorAdapter {
boolean
enable
;
String
[]
skipRequestURI
={
public
BasicEntryPoint
()
{
}
public
BasicEntryPoint
(
boolean
enable
)
{
super
();
this
.
enable
=
enable
;
}
String
[]
skipRequestURI
={
"/oauth/v20/token"
,
"/oauth/v10a/request_token"
,
"/oauth/v10a/access_token"
...
...
maxkey-authentications/src/main/java/org/maxkey/authn/support/httpheader/HttpHeaderConfig.java
浏览文件 @
1ad1db98
...
...
@@ -23,6 +23,11 @@ public class HttpHeaderConfig {
public
void
setEnable
(
boolean
enable
)
{
this
.
enable
=
enable
;
}
public
HttpHeaderConfig
(
String
headerName
,
boolean
enable
)
{
super
();
this
.
headerName
=
headerName
;
this
.
enable
=
enable
;
}
}
maxkey-authentications/src/main/java/org/maxkey/authn/support/httpheader/HttpHeaderEntryPoint.java
浏览文件 @
1ad1db98
...
...
@@ -7,8 +7,6 @@ import org.maxkey.constants.ConstantsLoginType;
import
org.maxkey.web.WebContext
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.security.authentication.UsernamePasswordAuthenticationToken
;
import
org.springframework.security.core.context.SecurityContextHolder
;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
...
...
@@ -17,8 +15,7 @@ import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
public
class
HttpHeaderEntryPoint
extends
HandlerInterceptorAdapter
{
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
HttpHeaderEntryPoint
.
class
);
@Autowired
@Qualifier
(
"httpHeaderSupport"
)
HttpHeaderConfig
httpHeaderSupport
;
String
[]
skipRequestURI
={
...
...
@@ -94,7 +91,16 @@ public class HttpHeaderEntryPoint extends HandlerInterceptorAdapter {
return
true
;
}
public
void
setHttpHeaderSupport
(
HttpHeaderConfig
httpHeaderSupport
)
{
public
HttpHeaderEntryPoint
()
{
super
();
}
public
HttpHeaderEntryPoint
(
HttpHeaderConfig
httpHeaderSupport
)
{
super
();
this
.
httpHeaderSupport
=
httpHeaderSupport
;
}
public
void
setHttpHeaderSupport
(
HttpHeaderConfig
httpHeaderSupport
)
{
this
.
httpHeaderSupport
=
httpHeaderSupport
;
}
...
...
maxkey-authentications/src/main/java/org/maxkey/authn/support/socialsignon/service/SocialSignOnProvider.java
浏览文件 @
1ad1db98
...
...
@@ -87,6 +87,13 @@ public class SocialSignOnProvider {
public
void
setUserBind
(
boolean
userBind
)
{
this
.
userBind
=
userBind
;
}
@Override
public
String
toString
()
{
return
"SocialSignOnProvider [provider="
+
provider
+
", providerName="
+
providerName
+
", icon="
+
icon
+
", clientId="
+
clientId
+
", clientSecret="
+
clientSecret
+
", accountId="
+
accountId
+
", sortOrder="
+
sortOrder
+
", userBind="
+
userBind
+
"]"
;
}
...
...
maxkey-authentications/src/main/java/org/maxkey/authn/support/socialsignon/service/SocialSignOnProviderService.java
浏览文件 @
1ad1db98
...
...
@@ -78,8 +78,9 @@ public class SocialSignOnProviderService{
return
((
AuthUser
)
authResponse
.
getData
()).
getUuid
();
}
else
if
(
provider
.
equalsIgnoreCase
(
"DingTalk"
))
{
return
((
AuthUser
)
authResponse
.
getData
()).
getUuid
();
}
else
{
return
((
AuthUser
)
authResponse
.
getData
()).
getUuid
();
}
return
null
;
}
public
List
<
SocialSignOnProvider
>
getSocialSignOnProviders
()
{
return
socialSignOnProviders
;
...
...
maxkey-web-maxkey/src/main/java/org/maxkey/MaxKeyConfig.java
浏览文件 @
1ad1db98
package
org.maxkey
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Properties
;
import
org.apache.catalina.Context
;
import
org.apache.catalina.connector.Connector
;
import
org.apache.tomcat.util.descriptor.web.SecurityCollection
;
import
org.apache.tomcat.util.descriptor.web.SecurityConstraint
;
import
org.maxkey.authn.realm.jdbc.JdbcAuthenticationRealm
;
import
org.maxkey.authn.support.kerberos.KerberosProxy
;
import
org.maxkey.authn.support.kerberos.RemoteKerberosService
;
import
org.maxkey.authn.support.socialsignon.service.JdbcSocialsAssociateService
;
import
org.maxkey.authn.support.socialsignon.service.SocialSignOnProvider
;
import
org.maxkey.authn.support.socialsignon.service.SocialSignOnProviderService
;
import
org.maxkey.authz.oauth2.provider.endpoint.TokenEndpointAuthenticationFilter
;
import
org.maxkey.crypto.password.opt.algorithm.KeyUriFormat
;
import
org.maxkey.crypto.password.opt.impl.MailOtpAuthn
;
import
org.maxkey.crypto.password.opt.impl.SmsOtpAuthn
;
import
org.maxkey.crypto.password.opt.impl.TimeBasedOtpAuthn
;
import
org.maxkey.crypto.password.opt.impl.sms.SmsOtpAuthnYunxin
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.autoconfigure.condition.ConditionalOnClass
;
import
org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory
;
import
org.springframework.boot.web.servlet.FilterRegistrationBean
;
import
org.springframework.context.annotation.Bean
;
...
...
@@ -18,12 +34,15 @@ import org.springframework.context.annotation.ComponentScan;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.ImportResource
;
import
org.springframework.context.annotation.PropertySource
;
import
org.springframework.core.io.ClassPathResource
;
import
org.springframework.core.io.Resource
;
import
org.springframework.jdbc.core.JdbcTemplate
;
@Configuration
@ImportResource
(
locations
=
{
"classpath:spring/maxkey.xml"
})
//
@ImportResource(locations = { "classpath:spring/maxkey.xml" })
@PropertySource
(
"classpath:/application.properties"
)
@PropertySource
(
"classpath:/config/applicationConfig.properties"
)
@MapperScan
(
"org.maxkey.dao.persistence,"
)
...
...
@@ -35,6 +54,7 @@ import org.springframework.context.annotation.PropertySource;
"org.maxkey.api.v1.contorller"
,
"org.maxkey.web.endpoint"
,
"org.maxkey.web.contorller"
,
"org.maxkey.web.interceptor"
,
//single sign on protocol
"org.maxkey.authz.endpoint"
,
"org.maxkey.authz.desktop.endpoint"
,
...
...
@@ -42,6 +62,7 @@ import org.springframework.context.annotation.PropertySource;
"org.maxkey.authz.formbased.endpoint"
,
"org.maxkey.authz.ltpa.endpoint"
,
"org.maxkey.authz.token.endpoint"
,
"org.maxkey.web.authentication.support.socialsignon"
})
public
class
MaxKeyConfig
implements
InitializingBean
{
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
MaxKeyConfig
.
class
);
...
...
@@ -115,6 +136,101 @@ public class MaxKeyConfig implements InitializingBean {
return
keyUriFormat
;
}
@Bean
(
name
=
"authenticationRealm"
)
public
JdbcAuthenticationRealm
JdbcAuthenticationRealm
(
JdbcTemplate
jdbcTemplate
)
{
JdbcAuthenticationRealm
authenticationRealm
=
new
JdbcAuthenticationRealm
(
jdbcTemplate
);
_logger
.
debug
(
"JdbcAuthenticationRealm inited."
);
return
authenticationRealm
;
}
@Bean
(
name
=
"tfaOptAuthn"
)
public
TimeBasedOtpAuthn
tfaOptAuthn
()
{
TimeBasedOtpAuthn
tfaOptAuthn
=
new
TimeBasedOtpAuthn
();
_logger
.
debug
(
"TimeBasedOtpAuthn inited."
);
return
tfaOptAuthn
;
}
@Bean
(
name
=
"tfaMailOptAuthn"
)
public
MailOtpAuthn
mailOtpAuthn
()
{
MailOtpAuthn
mailOtpAuthn
=
new
MailOtpAuthn
();
_logger
.
debug
(
"tfaMailOptAuthn inited."
);
return
mailOtpAuthn
;
}
@Bean
(
name
=
"tfaMobileOptAuthn"
)
public
SmsOtpAuthn
smsOtpAuthn
()
{
SmsOtpAuthnYunxin
smsOtpAuthn
=
new
SmsOtpAuthnYunxin
();
_logger
.
debug
(
"SmsOtpAuthn inited."
);
return
smsOtpAuthn
;
}
@Bean
(
name
=
"kerberosService"
)
public
RemoteKerberosService
kerberosService
(
@Value
(
"${config.support.kerberos.default.userdomain}"
)
String
userDomain
,
@Value
(
"${config.support.kerberos.default.fulluserdomain}"
)
String
fullUserDomain
,
@Value
(
"${config.support.kerberos.default.crypto}"
)
String
crypto
,
@Value
(
"${config.support.kerberos.default.redirecturi}"
)
String
redirectUri
)
{
RemoteKerberosService
kerberosService
=
new
RemoteKerberosService
();
KerberosProxy
kerberosProxy
=
new
KerberosProxy
();
kerberosProxy
.
setCrypto
(
crypto
);
kerberosProxy
.
setFullUserdomain
(
fullUserDomain
);
kerberosProxy
.
setUserdomain
(
userDomain
);
kerberosProxy
.
setRedirectUri
(
redirectUri
);
List
<
KerberosProxy
>
kerberosProxysList
=
new
ArrayList
<
KerberosProxy
>();
kerberosProxysList
.
add
(
kerberosProxy
);
kerberosService
.
setKerberosProxys
(
kerberosProxysList
);
_logger
.
debug
(
"RemoteKerberosService inited."
);
return
kerberosService
;
}
@Bean
(
name
=
"socialSignOnProviderService"
)
@ConditionalOnClass
(
SocialSignOnProvider
.
class
)
public
SocialSignOnProviderService
socialSignOnProviderService
()
throws
IOException
{
SocialSignOnProviderService
socialSignOnProviderService
=
new
SocialSignOnProviderService
();
Resource
resource
=
new
ClassPathResource
(
"/config/applicationConfig.properties"
);
Properties
properties
=
new
Properties
();
properties
.
load
(
resource
.
getInputStream
());
String
[]
providerList
=
properties
.
get
(
"config.login.socialsignon.providers"
).
toString
().
split
(
","
);
List
<
SocialSignOnProvider
>
socialSignOnProviderList
=
new
ArrayList
<
SocialSignOnProvider
>();
for
(
String
provider
:
providerList
)
{
String
providerName
=
properties
.
getProperty
(
"config.socialsignon."
+
provider
+
".provider.name"
);
String
icon
=
properties
.
getProperty
(
"config.socialsignon."
+
provider
+
".icon"
);
String
clientId
=
properties
.
getProperty
(
"config.socialsignon."
+
provider
+
".client.id"
);
String
clientSecret
=
properties
.
getProperty
(
"config.socialsignon."
+
provider
+
".client.secret"
);
String
sortOrder
=
properties
.
getProperty
(
"config.socialsignon."
+
provider
+
".sortorder"
);
SocialSignOnProvider
socialSignOnProvider
=
new
SocialSignOnProvider
();
socialSignOnProvider
.
setProvider
(
provider
);
socialSignOnProvider
.
setProviderName
(
providerName
);
socialSignOnProvider
.
setIcon
(
icon
);
socialSignOnProvider
.
setClientId
(
clientId
);
socialSignOnProvider
.
setClientSecret
(
clientSecret
);
socialSignOnProvider
.
setSortOrder
(
Integer
.
valueOf
(
sortOrder
));
_logger
.
debug
(
"socialSignOnProvider "
+
socialSignOnProvider
);
socialSignOnProviderList
.
add
(
socialSignOnProvider
);
}
socialSignOnProviderService
.
setSocialSignOnProviders
(
socialSignOnProviderList
);
_logger
.
debug
(
"SocialSignOnProviderService inited."
);
return
socialSignOnProviderService
;
}
@Bean
(
name
=
"socialsAssociateService"
)
public
JdbcSocialsAssociateService
socialsAssociateService
(
JdbcTemplate
jdbcTemplate
)
{
JdbcSocialsAssociateService
socialsAssociateService
=
new
JdbcSocialsAssociateService
(
jdbcTemplate
);
_logger
.
debug
(
"JdbcSocialsAssociateService inited."
);
return
socialsAssociateService
;
}
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
// TODO Auto-generated method stub
...
...
maxkey-web-maxkey/src/main/java/org/maxkey/MaxKeyMvcConfig.java
0 → 100644
浏览文件 @
1ad1db98
package
org.maxkey
;
import
org.maxkey.authn.support.basic.BasicEntryPoint
;
import
org.maxkey.authn.support.httpheader.HttpHeaderConfig
;
import
org.maxkey.authn.support.httpheader.HttpHeaderEntryPoint
;
import
org.maxkey.web.interceptor.HistoryLoginAppAdapter
;
import
org.maxkey.web.interceptor.HistoryLogsAdapter
;
import
org.maxkey.web.interceptor.PermissionAdapter
;
import
org.maxkey.web.interceptor.PreLoginAppAdapter
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.PropertySource
;
import
org.springframework.web.servlet.config.annotation.EnableWebMvc
;
import
org.springframework.web.servlet.config.annotation.InterceptorRegistry
;
import
org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
org.springframework.web.servlet.i18n.LocaleChangeInterceptor
;
@Configuration
@EnableWebMvc
@PropertySource
(
"classpath:/config/applicationConfig.properties"
)
public
class
MaxKeyMvcConfig
implements
WebMvcConfigurer
{
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
MaxKeyMvcConfig
.
class
);
@Autowired
PermissionAdapter
permissionAdapter
;
@Autowired
HistoryLogsAdapter
historyLogsAdapter
;
@Autowired
LocaleChangeInterceptor
localeChangeInterceptor
;
@Autowired
PreLoginAppAdapter
preLoginAppAdapter
;
@Autowired
HistoryLoginAppAdapter
historyLoginAppAdapter
;
@Value
(
"${config.support.httpheader.enable:false}"
)
private
boolean
httpHeaderEnable
;
@Value
(
"${config.support.httpheader.headername:iv-user}"
)
private
String
httpHeaderName
;
@Value
(
"${config.support.basic.enable:false}"
)
private
boolean
basicEnable
;
@Override
public
void
addResourceHandlers
(
ResourceHandlerRegistry
registry
)
{
registry
.
addResourceHandler
(
"/static/**"
)
.
addResourceLocations
(
"classpath:/static/"
);
registry
.
addResourceHandler
(
"/templates/**"
)
.
addResourceLocations
(
"classpath:/templates/"
);
_logger
.
debug
(
"add addResourceHandler"
);
}
@Override
public
void
addInterceptors
(
InterceptorRegistry
registry
)
{
//addPathPatterns 用于添加拦截规则 , 先把所有路径都加入拦截, 再一个个排除
//excludePathPatterns 表示改路径不用拦截
registry
.
addInterceptor
(
permissionAdapter
)
.
addPathPatterns
(
"/index/**"
)
.
addPathPatterns
(
"/logs/**"
)
.
addPathPatterns
(
"/userinfo/**"
)
.
addPathPatterns
(
"/profile/**"
)
.
addPathPatterns
(
"/safe/**"
)
.
addPathPatterns
(
"/historys/**"
)
.
addPathPatterns
(
"/appList/**"
)
.
addPathPatterns
(
"/socialsignon/**"
)
.
addPathPatterns
(
"/authz/basic/*"
)
.
addPathPatterns
(
"/authz/ltpa/*"
)
.
addPathPatterns
(
"/authz/desktop/*"
)
.
addPathPatterns
(
"/authz/formbased/*"
)
.
addPathPatterns
(
"/authz/tokenbased/*"
)
.
addPathPatterns
(
"/authz/saml20/idpinit/*"
)
.
addPathPatterns
(
"/authz/saml20/assertion"
)
.
addPathPatterns
(
"/authz/cas/*"
)
.
addPathPatterns
(
"/authz/cas/*/*"
)
.
addPathPatterns
(
"/authz/cas/granting/*"
)
.
addPathPatterns
(
"/oauth/v20/authorize"
)
.
addPathPatterns
(
"/oauth/v20/authorize/*"
)
;
_logger
.
debug
(
"add PermissionAdapter"
);
registry
.
addInterceptor
(
historyLogsAdapter
)
.
addPathPatterns
(
"/safe/changePassword/**"
)
;
_logger
.
debug
(
"add HistoryLogsAdapter"
);
registry
.
addInterceptor
(
preLoginAppAdapter
)
.
addPathPatterns
(
"/authz/basic/*"
)
.
addPathPatterns
(
"/authz/ltpa/*"
)
.
addPathPatterns
(
"/authz/desktop/*"
)
.
addPathPatterns
(
"/authz/formbased/*"
)
.
addPathPatterns
(
"/authz/tokenbased/*"
)
.
addPathPatterns
(
"/authz/saml20/idpinit/*"
)
.
addPathPatterns
(
"/authz/saml20/assertion"
)
.
addPathPatterns
(
"/authz/cas/login"
)
.
addPathPatterns
(
"/authz/cas/granting"
)
;
_logger
.
debug
(
"add PreLoginAppAdapter"
);
registry
.
addInterceptor
(
historyLoginAppAdapter
)
.
addPathPatterns
(
"/authz/basic/*"
)
.
addPathPatterns
(
"/authz/ltpa/*"
)
.
addPathPatterns
(
"/authz/desktop/*"
)
.
addPathPatterns
(
"/authz/formbased/*"
)
.
addPathPatterns
(
"/authz/tokenbased/*"
)
.
addPathPatterns
(
"/authz/saml20/idpinit/*"
)
.
addPathPatterns
(
"/authz/saml20/assertion"
)
.
addPathPatterns
(
"/authz/cas/granting"
)
;
_logger
.
debug
(
"add HistoryLoginAppAdapter"
);
registry
.
addInterceptor
(
localeChangeInterceptor
);
_logger
.
debug
(
"add LocaleChangeInterceptor"
);
if
(
httpHeaderEnable
)
{
HttpHeaderConfig
httpHeaderConfig
=
new
HttpHeaderConfig
(
this
.
httpHeaderName
,
httpHeaderEnable
);
registry
.
addInterceptor
(
new
HttpHeaderEntryPoint
(
httpHeaderConfig
))
.
addPathPatterns
(
"/*"
);
_logger
.
debug
(
"add HttpHeaderEntryPoint"
);
}
if
(
basicEnable
)
{
registry
.
addInterceptor
(
new
BasicEntryPoint
(
basicEnable
))
.
addPathPatterns
(
"/*"
);
_logger
.
debug
(
"add BasicEntryPoint"
);
}
}
}
maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/HistoryLoginAppAdapter.java
浏览文件 @
1ad1db98
...
...
@@ -14,9 +14,11 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.servlet.ModelAndView
;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
@Component
public
class
HistoryLoginAppAdapter
extends
HandlerInterceptorAdapter
{
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
HistoryLoginAppAdapter
.
class
);
...
...
maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/HistoryLogsAdapter.java
浏览文件 @
1ad1db98
...
...
@@ -13,6 +13,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Qualifier
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.servlet.ModelAndView
;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
...
...
@@ -23,6 +24,7 @@ import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
* @author Crystal.Sea
*
*/
@Component
public
class
HistoryLogsAdapter
extends
HandlerInterceptorAdapter
{
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
HistoryLogsAdapter
.
class
);
...
...
maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/PermissionAdapter.java
浏览文件 @
1ad1db98
...
...
@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
import
org.springframework.security.web.savedrequest.HttpSessionRequestCache
;
import
org.springframework.security.web.savedrequest.RequestCache
;
import
org.springframework.security.web.savedrequest.SavedRequest
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
/**
...
...
@@ -24,7 +25,7 @@ import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
* @author Crystal.Sea
*
*/
@Component
public
class
PermissionAdapter
extends
HandlerInterceptorAdapter
{
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
PermissionAdapter
.
class
);
// 无需Interceptor url
...
...
maxkey-web-maxkey/src/main/java/org/maxkey/web/interceptor/PreLoginAppAdapter.java
浏览文件 @
1ad1db98
...
...
@@ -7,8 +7,10 @@ import org.maxkey.web.WebConstants;
import
org.maxkey.web.WebContext
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
@Component
public
class
PreLoginAppAdapter
extends
HandlerInterceptorAdapter
{
private
static
final
Logger
_logger
=
LoggerFactory
.
getLogger
(
PreLoginAppAdapter
.
class
);
...
...
maxkey-web-maxkey/src/main/resources/META-INF/spring.factories
浏览文件 @
1ad1db98
...
...
@@ -6,4 +6,5 @@ org.maxkey.autoconfigure.KaptchaAutoConfiguration,\
org.maxkey.autoconfigure.RedisAutoConfiguration,\
org.maxkey.autoconfigure.CasAutoConfiguration,\
org.maxkey.autoconfigure.Oauth20AutoConfiguration,\
org.maxkey.autoconfigure.Saml20AutoConfiguration
org.maxkey.autoconfigure.Saml20AutoConfiguration,\
org.maxkey.MaxKeyMvcConfig
maxkey-web-maxkey/src/main/resources/config/applicationConfig.properties
浏览文件 @
1ad1db98
...
...
@@ -22,6 +22,8 @@ config.login.captcha.type=text
config.login.onetimepwd
=
true
#enable social sign on
config.login.socialsignon
=
true
#social sign on providers
config.login.socialsignon.providers
=
sinaweibo,google,qq,dingtalk,microsoft,facebook
#Enable kerberos/SPNEGO
config.login.kerberos
=
true
#wsFederation
...
...
maxkey-web-maxkey/src/main/resources/spring/maxkey.xml
浏览文件 @
1ad1db98
...
...
@@ -43,11 +43,10 @@
</mvc:interceptors>
<!-- BASIC Support End-->
<!-- KERBEROS Support Start
-->
<!-- KERBEROS Support Start
<bean id="kerberosService" class="org.maxkey.authn.support.kerberos.RemoteKerberosService">
<property name="kerberosProxys" >
<list>
<!-- default -->
<bean class="org.maxkey.authn.support.kerberos.KerberosProxy">
<property name="userdomain" value="${config.support.kerberos.default.userdomain}"/>
<property name="fullUserdomain" value="${config.support.kerberos.default.fulluserdomain}"/>
...
...
@@ -56,7 +55,7 @@
</bean>
</list>
</property>
</bean>
</bean>
-->
<!-- KERBEROS Support End-->
<!-- WsFederation Support Start -->
...
...
@@ -93,85 +92,7 @@
</bean>
-->
<!-- WsFederation Support End -->
<!-- Social Sign On Support Start-->
<!-- Social Sign On Endpoint-->
<context:component-scan
base-package=
"org.maxkey.web.authentication.support.socialsignon"
/>
<bean
id=
"socialSignOnWeibo"
class=
"org.maxkey.authn.support.socialsignon.service.SocialSignOnProvider"
>
<property
name=
"provider"
value=
"${config.socialsignon.sinaweibo.provider}"
/>
<property
name=
"providerName"
value=
"${config.socialsignon.sinaweibo.provider.name}"
/>
<property
name=
"icon"
value=
"${config.socialsignon.sinaweibo.icon}"
/>
<property
name=
"clientId"
value=
"${config.socialsignon.sinaweibo.client.id}"
/>
<property
name=
"clientSecret"
value=
"${config.socialsignon.sinaweibo.client.secret}"
/>
<property
name=
"sortOrder"
value=
"${config.socialsignon.sinaweibo.sortorder}"
/>
</bean>
<bean
id=
"socialSignOnGoogle"
class=
"org.maxkey.authn.support.socialsignon.service.SocialSignOnProvider"
>
<property
name=
"provider"
value=
"${config.socialsignon.google.provider}"
/>
<property
name=
"providerName"
value=
"${config.socialsignon.google.provider.name}"
/>
<property
name=
"icon"
value=
"${config.socialsignon.google.icon}"
/>
<property
name=
"clientId"
value=
"${config.socialsignon.google.client.id}"
/>
<property
name=
"clientSecret"
value=
"${config.socialsignon.google.client.secret}"
/>
<property
name=
"sortOrder"
value=
"${config.socialsignon.google.sortorder}"
/>
</bean>
<bean
id=
"socialSignOnQQ"
class=
"org.maxkey.authn.support.socialsignon.service.SocialSignOnProvider"
>
<property
name=
"provider"
value=
"${config.socialsignon.qq.provider}"
/>
<property
name=
"providerName"
value=
"${config.socialsignon.qq.provider.name}"
/>
<property
name=
"icon"
value=
"${config.socialsignon.qq.icon}"
/>
<property
name=
"clientId"
value=
"${config.socialsignon.qq.client.id}"
/>
<property
name=
"clientSecret"
value=
"${config.socialsignon.qq.client.secret}"
/>
<property
name=
"sortOrder"
value=
"${config.socialsignon.qq.sortorder}"
/>
</bean>
<bean
id=
"socialSignOnMicrosoft"
class=
"org.maxkey.authn.support.socialsignon.service.SocialSignOnProvider"
>
<property
name=
"provider"
value=
"${config.socialsignon.microsoft.provider}"
/>
<property
name=
"providerName"
value=
"${config.socialsignon.microsoft.provider.name}"
/>
<property
name=
"icon"
value=
"${config.socialsignon.microsoft.icon}"
/>
<property
name=
"clientId"
value=
"${config.socialsignon.microsoft.client.id}"
/>
<property
name=
"clientSecret"
value=
"${config.socialsignon.microsoft.client.secret}"
/>
<property
name=
"sortOrder"
value=
"${config.socialsignon.microsoft.sortorder}"
/>
</bean>
<bean
id=
"socialSignOnFacebook"
class=
"org.maxkey.authn.support.socialsignon.service.SocialSignOnProvider"
>
<property
name=
"provider"
value=
"${config.socialsignon.facebook.provider}"
/>
<property
name=
"providerName"
value=
"${config.socialsignon.facebook.provider.name}"
/>
<property
name=
"icon"
value=
"${config.socialsignon.facebook.icon}"
/>
<property
name=
"clientId"
value=
"${config.socialsignon.facebook.client.id}"
/>
<property
name=
"clientSecret"
value=
"${config.socialsignon.facebook.client.secret}"
/>
<property
name=
"sortOrder"
value=
"${config.socialsignon.facebook.sortorder}"
/>
</bean>
<bean
id=
"socialSignOndingtalk"
class=
"org.maxkey.authn.support.socialsignon.service.SocialSignOnProvider"
>
<property
name=
"provider"
value=
"${config.socialsignon.dingtalk.provider}"
/>
<property
name=
"providerName"
value=
"${config.socialsignon.dingtalk.provider.name}"
/>
<property
name=
"icon"
value=
"${config.socialsignon.dingtalk.icon}"
/>
<property
name=
"clientId"
value=
"${config.socialsignon.dingtalk.client.id}"
/>
<property
name=
"clientSecret"
value=
"${config.socialsignon.dingtalk.client.secret}"
/>
<property
name=
"sortOrder"
value=
"${config.socialsignon.dingtalk.sortorder}"
/>
</bean>
<!-- Add Your Providers Here -->
<bean
id=
"socialSignOnProviderService"
class=
"org.maxkey.authn.support.socialsignon.service.SocialSignOnProviderService"
>
<property
name=
"socialSignOnProviders"
>
<list>
<ref
bean=
"socialSignOnWeibo"
/>
<ref
bean=
"socialSignOnQQ"
/>
<ref
bean=
"socialSignOnGoogle"
/>
<ref
bean=
"socialSignOnMicrosoft"
/>
<ref
bean=
"socialSignOnFacebook"
/>
<ref
bean=
"socialSignOndingtalk"
/>
<!-- ref Your Providers Here -->
</list>
</property>
</bean>
<bean
id=
"socialsAssociateService"
class=
"org.maxkey.authn.support.socialsignon.service.JdbcSocialsAssociateService"
>
<constructor-arg
ref=
"jdbcTemplate"
/>
</bean>
<!-- Social Sign On Support End -->
<!-- Web URL InterceptorAdapter -->
<mvc:interceptors>
<!-- InterceptorAdapter for platform permission -->
...
...
@@ -238,20 +159,15 @@
<ref
bean=
"localeChangeInterceptor"
/>
</mvc:interceptors>
<bean
id=
"tfaOptAuthn"
class=
"org.maxkey.crypto.password.opt.impl.TimeBasedOtpAuthn"
>
</bean>
<!--
<bean id="tfaOptAuthn" class="org.maxkey.crypto.password.opt.impl.sms.SmsOtpAuthnYunxin">
</bean>
-->
<!-- for Forgot Password -->
<!-- for Forgot Password
<bean id="tfaMailOptAuthn" class="org.maxkey.crypto.password.opt.impl.MailOtpAuthn">
</bean>
<bean id="tfaMobileOptAuthn" class="org.maxkey.crypto.password.opt.impl.sms.SmsOtpAuthnYunxin">
</bean>
-->
<!-- LDAP Realm
<bean id="authenticationRealm" class="org.maxkey.web.authentication.realm.ldap.LdapAuthenticationRealm">
<constructor-arg ref="jdbcTemplate"/>
...
...
@@ -292,11 +208,14 @@
</bean> -->
<!-- Default Realm-->
<!-- realm use jdbc
-->
<!-- realm use jdbc
<bean id="authenticationRealm" class="org.maxkey.authn.realm.jdbc.JdbcAuthenticationRealm">
<constructor-arg ref="jdbcTemplate"/>
</bean>
<bean id="tfaOptAuthn" class="org.maxkey.crypto.password.opt.impl.TimeBasedOtpAuthn">
</bean>
-->
<!-- enable autowire -->
<context:annotation-config
/>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录