v 1.5.0 RC2

v 1.5.0 RC2
This commit is contained in:
shimingxy
2020-05-16 21:44:46 +08:00
parent 2f0f0ed8eb
commit caa656191a
18 changed files with 517 additions and 540 deletions

View File

@@ -3,4 +3,6 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
org.maxkey.autoconfigure.ApplicationAutoConfiguration,\
org.maxkey.autoconfigure.KaptchaAutoConfiguration,\
org.maxkey.autoconfigure.MvcAutoConfiguration,\
org.maxkey.autoconfigure.JwtAuthnAutoConfiguration,\
org.maxkey.autoconfigure.RedisAutoConfiguration,\
org.maxkey.MaxKeyMgtConfig

View File

@@ -24,6 +24,15 @@ spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
#mybatis
mybatis.type-aliases-package=org.maxkey.domain,org.maxkey.domain.apps,
mybatis.mapper-locations=classpath*:/org/maxkey/dao/persistence/xml/mysql/*.xml
#redis
spring.redis.host=127.0.0.1
spring.redis.port=6379
spring.redis.password=password
spring.redis.timeout=10000
spring.redis.jedis.pool.max-wait=1000
spring.redis.jedis.pool.max-idle=200
spring.redis.lettuce.pool.max-active=-1
spring.redis.lettuce.pool.min-idle=0
#mail
spring.mail.default-encoding=utf-8
spring.mail.host=smtp.163.com

View File

@@ -9,6 +9,8 @@ config.server.prefix.uri=${config.server.name}:9521/maxkey-mgt
#default.uri
config.server.default.uri=${config.server.prefix.uri}/main
config.maxkey.uri=${config.server.name}/maxkey
#InMemory 0 , jdbc 1, Redis 2
config.server.persistence=0
############################################################################
# Login configuration
#enable captcha
@@ -26,7 +28,7 @@ config.login.wsfederation=false
#remeberme
config.login.remeberme=false
#validity
config.login.remeberme.validity=
config.login.remeberme.validity=0
#default.uri
#to appList page
config.login.default.uri=appList

View File

@@ -1,169 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<!-- enable autowire -->
<context:annotation-config />
<!-- language select must remove -->
<mvc:annotation-driven />
<!--
* Self-issued Provider Metadata
*
* http://openid.net/specs/openid-connect-core-1_0.html#SelfIssued
* -->
<bean id="oidcProviderMetadata" class="org.maxkey.config.oidc.OIDCProviderMetadataDetails">
<property name="issuer" value="${config.oidc.metadata.issuer}" />
<property name="authorizationEndpoint" value="${config.oidc.metadata.authorizationEndpoint}" />
<property name="tokenEndpoint" value="${config.oidc.metadata.tokenEndpoint}" />
<property name="userinfoEndpoint" value="${config.oidc.metadata.userinfoEndpoint}" />
</bean>
<bean id="jwkSetKeyStore" class="org.maxkey.crypto.jose.keystore.JWKSetKeyStore">
<property name="location" value="classpath:config/keystore.jwks" />
</bean>
<bean id="jwtSignerValidationService" class="org.maxkey.crypto.jwt.signer.service.impl.DefaultJwtSigningAndValidationService">
<constructor-arg name="keyStore" ref="jwkSetKeyStore" />
<property name="defaultSignerKeyId" value="maxkey_rsa" />
<property name="defaultSigningAlgorithmName" value="RS256" />
</bean>
<bean id="jwtEncryptionService" class="org.maxkey.crypto.jwt.encryption.service.impl.DefaultJwtEncryptionAndDecryptionService">
<constructor-arg name="keyStore" ref="jwkSetKeyStore" />
<property name="defaultAlgorithm" value="RSA1_5" />
<property name="defaultDecryptionKeyId" value="maxkey_rsa" />
<property name="defaultEncryptionKeyId" value="maxkey_rsa" />
</bean>
<bean id="jwtLoginService" class="org.maxkey.authn.support.jwt.JwtLoginService">
<property name="jwtSignerValidationService" ref="jwtSignerValidationService" />
<property name="jwtProviderMetadata" ref="oidcProviderMetadata" />
</bean>
<!-- web Controller InterceptorAdapter -->
<mvc:interceptors>
<!-- web Controller InterceptorAdapter for platform permission -->
<mvc:interceptor>
<mvc:mapping path="/main*/**" />
<mvc:mapping path="/main*/**" />
<mvc:mapping path="/orgs*/**" />
<mvc:mapping path="/userinfo*/**" />
<mvc:mapping path="/apps*/**" />
<mvc:mapping path="/app*/**" />
<mvc:mapping path="/groups*/**" />
<mvc:mapping path="/groupMember*/**" />
<mvc:mapping path="/groupPrivileges*/**" />
<mvc:mapping path="/config*/**" />
<mvc:mapping path="/logs*/**" />
<bean class="org.maxkey.web.interceptor.PermissionAdapter" />
</mvc:interceptor>
<!-- web Controller InterceptorAdapter for platform log -->
<mvc:interceptor>
<mvc:mapping path="/users/*" />
<mvc:mapping path="/userinfo/*" />
<mvc:mapping path="/enterprises/*" />
<mvc:mapping path="/employees/*" />
<mvc:mapping path="/authInfo/*" />
<mvc:mapping path="/usercenter/*"/>
<mvc:mapping path="/retrievePassword/*"/>
<mvc:mapping path="/roles/*"/>
<mvc:mapping path="/applications/*"/>
<mvc:mapping path="/approles/*"/>
<bean class="org.maxkey.web.interceptor.HistoryLogsAdapter" />
</mvc:interceptor>
<ref bean="localeChangeInterceptor" />
</mvc:interceptors>
<!--
<bean id="remeberMeService" class="org.maxkey.authn.support.rememberme.JdbcRemeberMeService">
<constructor-arg ref="jdbcTemplate"/>
<property name="validity" value="${config.login.remeberme.validity}"/>
</bean>
-->
<bean id="remeberMeService" class="org.maxkey.authn.support.rememberme.InMemoryRemeberMeService">
</bean>
<bean id="timeBasedKeyUriFormat" class="org.maxkey.crypto.password.opt.algorithm.KeyUriFormat">
<property name="type" value="totp" />
<property name="digits" value="6" />
<property name="issuer" value="maxkey" />
<property name="domain" value="maxkey.org" />
<property name="period" value="30" />
</bean>
<bean id="tfaOptAuthn" class="org.maxkey.crypto.password.opt.impl.TimeBasedOtpAuthn">
</bean>
<!-- Authentication Password Encoder Config -->
<bean id="passwordEncoder" class="org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder"></bean>
<!-- LDAP Realm
<bean id="authenticationRealm" class="org.maxkey.web.authentication.realm.ldap.LdapAuthenticationRealm">
<constructor-arg ref="jdbcTemplate"/>
<property name="ldapServers">
<list>
<bean id="ldapServer1" class="org.maxkey.web.authentication.realm.ldap.LdapServer">
<property name="ldapUtils">
<bean id="ldapUtils" class="org.maxkey.ldap.LdapUtils">
<property name="providerUrl" value="ldap://localhost:389"></property>
<property name="principal" value="cn=root"></property>
<property name="credentials" value="rootroot"></property>
<property name="baseDN" value="dc=connsec,dc=com"></property>
</bean>
</property>
<property name="filterAttribute" value="uid"></property>
</bean>
</list>
</property>
</bean> -->
<!-- Active Directory Realm
<bean id="authenticationRealm" class="org.maxkey.web.authentication.realm.activedirectory.ActiveDirectoryAuthenticationRealm">
<constructor-arg ref="jdbcTemplate"/>
<property name="activeDirectoryServers">
<list>
<bean id="activeDirectory1" class="org.maxkey.web.authentication.realm.activedirectory.ActiveDirectoryServer">
<property name="activeDirectoryUtils">
<bean id="ldapUtils" class="org.maxkey.ldap.ActiveDirectoryUtils">
<property name="providerUrl" value="ldap://localhost:389"></property>
<property name="principal" value="cn=root"></property>
<property name="credentials" value="rootroot"></property>
<property name="domain" value="connsec"></property>
</bean>
</property>
</bean>
</list>
</property>
</bean> -->
<!-- Default Realm-->
<!-- realm use jdbc -->
<bean id="authenticationRealm" class="org.maxkey.authn.realm.jdbc.JdbcAuthenticationRealm">
<constructor-arg ref="jdbcTemplate"/>
</bean>
<!-- Authentication providers -->
<bean id="authenticationProvider" class="org.maxkey.authn.RealmAuthenticationProvider" >
</bean>
<mvc:annotation-driven />
<mvc:default-servlet-handler />
</beans>

View File

@@ -1,51 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:sec="http://www.springframework.org/schema/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd">
<!-- Scheduler Task Start -->
<!-- Day login report
<bean id="loginDayReport" class="org.maxkey.tasks.report.LoginDayReport">
<property name="jdbcTemplate" ref="jdbcTemplate" />
</bean>
<bean id="jobDetailLoginDayReport" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean" >
<property name="targetObject" ref="loginDayReport" />
<property name="targetMethod" value="dayReportCount" />
<property name="concurrent" value="false" />
</bean>
<bean id="triggerJobDetailLoginDayReport" class="org.springframework.scheduling.quartz.CronTriggerFactoryBean">
<property name="cronExpression" value="59 59 23 * * ?" />
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="triggerJobDetailLoginDayReport" />
<ref bean="cronTrigger" />
<ref bean="simpleTrigger" />
</list>
</property>
</bean> -->
<!-- Scheduler Task End -->
</beans>

View File

@@ -19,58 +19,94 @@
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<!-- enable autowire -->
<context:annotation-config />
<!-- language select must remove -->
<mvc:annotation-driven />
<context:component-scan base-package="org.maxkey.config" />
<!-- Scans the classpath for annotated components that will be auto-registered as Spring beans.
@Controller and @Service. Make sure to set the correct base-package-->
<!-- domain bean -->
<context:component-scan base-package="org.maxkey.domain" />
<context:component-scan base-package="org.maxkey.domain.apps" />
<context:component-scan base-package="org.maxkey.domain.userinfo" />
<!-- web Controller InterceptorAdapter -->
<mvc:interceptors>
<!-- web Controller InterceptorAdapter for platform permission -->
<mvc:interceptor>
<mvc:mapping path="/main*/**" />
<mvc:mapping path="/main*/**" />
<mvc:mapping path="/orgs*/**" />
<mvc:mapping path="/userinfo*/**" />
<mvc:mapping path="/apps*/**" />
<mvc:mapping path="/app*/**" />
<mvc:mapping path="/groups*/**" />
<mvc:mapping path="/groupMember*/**" />
<mvc:mapping path="/groupPrivileges*/**" />
<mvc:mapping path="/config*/**" />
<mvc:mapping path="/logs*/**" />
<bean class="org.maxkey.web.interceptor.PermissionAdapter" />
</mvc:interceptor>
<!-- web Controller InterceptorAdapter for platform log -->
<mvc:interceptor>
<mvc:mapping path="/users/*" />
<mvc:mapping path="/userinfo/*" />
<mvc:mapping path="/enterprises/*" />
<mvc:mapping path="/employees/*" />
<mvc:mapping path="/authInfo/*" />
<mvc:mapping path="/usercenter/*"/>
<mvc:mapping path="/retrievePassword/*"/>
<mvc:mapping path="/roles/*"/>
<mvc:mapping path="/applications/*"/>
<mvc:mapping path="/approles/*"/>
<bean class="org.maxkey.web.interceptor.HistoryLogsAdapter" />
</mvc:interceptor>
<ref bean="localeChangeInterceptor" />
</mvc:interceptors>
<bean id="tfaOptAuthn" class="org.maxkey.crypto.password.opt.impl.TimeBasedOtpAuthn">
</bean>
<!-- Business Contorller -->
<context:component-scan base-package="org.maxkey.web.endpoint" />
<context:component-scan base-package="org.maxkey.web.contorller" />
<context:component-scan base-package="org.maxkey.web.apps.contorller" />
<context:component-scan base-package="org.maxkey.web.endpoint" />
<context:component-scan base-package="org.maxkey.authn" />
<context:component-scan base-package="org.maxkey.dao" />
<context:component-scan base-package="org.maxkey.web" />
<context:component-scan base-package="org.maxkey.web.tag" />
<!-- LDAP Realm
<bean id="authenticationRealm" class="org.maxkey.web.authentication.realm.ldap.LdapAuthenticationRealm">
<constructor-arg ref="jdbcTemplate"/>
<property name="ldapServers">
<list>
<bean id="ldapServer1" class="org.maxkey.web.authentication.realm.ldap.LdapServer">
<property name="ldapUtils">
<bean id="ldapUtils" class="org.maxkey.ldap.LdapUtils">
<property name="providerUrl" value="ldap://localhost:389"></property>
<property name="principal" value="cn=root"></property>
<property name="credentials" value="rootroot"></property>
<property name="baseDN" value="dc=connsec,dc=com"></property>
</bean>
</property>
<property name="filterAttribute" value="uid"></property>
</bean>
</list>
</property>
</bean> -->
<bean id="keyStoreLoader" class="org.maxkey.crypto.keystore.KeyStoreLoader">
<property name="entityName" value="${config.saml.v20.idp.issuing.entity.id}" />
<property name="keystorePassword" value="${config.saml.v20.idp.keystore.password}" />
<property name="keystoreFile" value="${config.saml.v20.idp.keystore}"/>
</bean>
<bean id="spKeyStoreLoader" class="org.maxkey.crypto.keystore.KeyStoreLoader">
<property name="entityName" value="${config.saml.v20.sp.issuing.entity.id}" />
<property name="keystorePassword" value="${config.saml.v20.sp.keystore.password}" />
<property name="keystoreFile" value="${config.saml.v20.sp.keystore}"/>
</bean>
<bean id="spIssuingEntityName" class="java.lang.String" >
<constructor-arg value="${config.saml.v20.sp.issuing.entity.id}"/>
</bean>
<bean id="maxKeyURI" class="java.lang.String" >
<constructor-arg value="${config.maxkey.uri}"/>
</bean>
<bean id="oauth20JdbcClientDetailsService" class="org.maxkey.authz.oauth2.provider.client.JdbcClientDetailsService" >
<constructor-arg ref="dataSource" />
<property name="passwordEncoder" ref="passwordReciprocal"></property>
</bean>
<import resource="maxkey-mgt-security.xml"/>
<import resource="maxkey-mgt-task.xml"/>
<!-- Active Directory Realm
<bean id="authenticationRealm" class="org.maxkey.web.authentication.realm.activedirectory.ActiveDirectoryAuthenticationRealm">
<constructor-arg ref="jdbcTemplate"/>
<property name="activeDirectoryServers">
<list>
<bean id="activeDirectory1" class="org.maxkey.web.authentication.realm.activedirectory.ActiveDirectoryServer">
<property name="activeDirectoryUtils">
<bean id="ldapUtils" class="org.maxkey.ldap.ActiveDirectoryUtils">
<property name="providerUrl" value="ldap://localhost:389"></property>
<property name="principal" value="cn=root"></property>
<property name="credentials" value="rootroot"></property>
<property name="domain" value="connsec"></property>
</bean>
</property>
</bean>
</list>
</property>
</bean> -->
<!-- Default Realm-->
<!-- realm use jdbc -->
<bean id="authenticationRealm" class="org.maxkey.authn.realm.jdbc.JdbcAuthenticationRealm">
<constructor-arg ref="jdbcTemplate"/>
</bean>
<mvc:annotation-driven />
<mvc:default-servlet-handler />
</beans>