功能模块化,调整通用模块为starter

maxkey-starter:maxkey-starter-captcha
maxkey-starter:maxkey-starter-ip2location
maxkey-starter:maxkey-starter-otp
maxkey-starter:maxkey-starter-sms
maxkey-starter:maxkey-starter-web
This commit is contained in:
shimingxy 2024-07-12 12:02:50 +08:00
parent 5dd0c6dc96
commit e1ac754186
100 changed files with 91 additions and 96 deletions

View File

@ -9,6 +9,6 @@ dependencies {
implementation project(":maxkey-common")
implementation project(":maxkey-core")
implementation project(":maxkey-persistence")
implementation project(":maxkey-authentications:maxkey-authentication-otp")
implementation project(":maxkey-starter:maxkey-starter-otp")
}

View File

@ -0,0 +1,3 @@
org.dromara.maxkey.autoconfigure.MvcCurrentUserAutoConfiguration
org.dromara.maxkey.autoconfigure.SessionAutoConfiguration
org.dromara.maxkey.autoconfigure.TokenAutoConfiguration

View File

@ -9,9 +9,11 @@ dependencies {
implementation project(":maxkey-common")
implementation project(":maxkey-core")
implementation project(":maxkey-persistence")
implementation project(":maxkey-starter:maxkey-starter-ip2location")
implementation project(":maxkey-starter:maxkey-starter-otp")
implementation project(":maxkey-starter:maxkey-starter-sms")
implementation project(":maxkey-authentications:maxkey-authentication-core")
implementation project(":maxkey-authentications:maxkey-authentication-ip2location")
implementation project(":maxkey-authentications:maxkey-authentication-otp")
implementation project(":maxkey-authentications:maxkey-authentication-sms")
}

View File

@ -0,0 +1,2 @@
org.dromara.maxkey.autoconfigure.AuthnProviderAutoConfiguration
org.dromara.maxkey.autoconfigure.JwtAuthnAutoConfiguration

View File

@ -0,0 +1 @@
org.dromara.maxkey.autoconfigure.SocialSignOnAutoConfiguration

View File

@ -17,7 +17,6 @@
package org.dromara.maxkey.configuration;
import org.apache.commons.lang3.StringUtils;
import org.dromara.maxkey.constants.ConstsDatabase;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

View File

@ -27,7 +27,6 @@ import jakarta.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Map;
import org.dromara.maxkey.persistence.repository.LocalizationRepository;
import org.dromara.maxkey.web.WebContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -51,9 +50,6 @@ public class LocaleTagDirective implements TemplateDirectiveModel {
@Autowired
private HttpServletRequest request;
@Autowired
LocalizationRepository localizationService;
@SuppressWarnings("rawtypes")
@Override
public void execute(Environment env,

View File

@ -0,0 +1 @@
org.dromara.maxkey.autoconfigure.CasAutoConfiguration

View File

@ -0,0 +1 @@
org.dromara.maxkey.autoconfigure.Saml20AutoConfiguration

View File

@ -1,5 +1,5 @@
description = "maxkey-authentication-captcha"
description = "maxkey-starter-captcha"
dependencies {

View File

@ -0,0 +1 @@
org.dromara.maxkey.autoconfigure.KaptchaAutoConfiguration

View File

@ -1,5 +1,5 @@
description = "maxkey-authentication-core"
description = "maxkey-starter-ip2location"
dependencies {

View File

@ -1,5 +1,5 @@
description = "maxkey-authentication-otp"
description = "maxkey-starter-otp"
dependencies {

View File

@ -0,0 +1 @@
org.dromara.maxkey.autoconfigure.OneTimePasswordAutoConfiguration

View File

@ -1,5 +1,5 @@
description = "maxkey-authentication-sms"
description = "maxkey-starter-sms"
dependencies {
@ -9,6 +9,6 @@ dependencies {
implementation project(":maxkey-common")
implementation project(":maxkey-core")
implementation project(":maxkey-persistence")
implementation project(":maxkey-authentications:maxkey-authentication-otp")
implementation project(":maxkey-starter:maxkey-starter-otp")
}

View File

@ -0,0 +1 @@
org.dromara.maxkey.autoconfigure.SmsAutoConfiguration

View File

@ -0,0 +1,13 @@
description = "maxkey-starter-web"
dependencies {
//local jars
implementation fileTree(dir: '../maxkey-lib/', include: '*/*.jar')
implementation project(":maxkey-common")
implementation project(":maxkey-core")
implementation project(":maxkey-persistence")
}

View File

@ -35,13 +35,13 @@ import jakarta.servlet.ServletResponse;
import jakarta.servlet.http.HttpServletRequest;
public class WebInstRequestFilter extends GenericFilterBean {
final static Logger _logger = LoggerFactory.getLogger(GenericFilterBean.class);
static final Logger _logger = LoggerFactory.getLogger(WebInstRequestFilter.class);
public final static String HEADER_HOST = "host";
public static final String HEADER_HOST = "host";
public final static String HEADER_HOSTNAME = "hostname";
public static final String HEADER_HOSTNAME = "hostname";
public final static String HEADER_ORIGIN = "Origin";
public static final String HEADER_ORIGIN = "Origin";
InstitutionsRepository institutionsRepository;
@ -69,6 +69,7 @@ public class WebInstRequestFilter extends GenericFilterBean {
host = host.split(":")[0];
_logger.trace("domain split {}",host);
}
_logger.trace("host {}",host);
Institutions institution = institutionsRepository.get(host);
_logger.trace("{}" ,institution);
request.getSession().setAttribute(WebConstants.CURRENT_INST, institution);
@ -77,6 +78,7 @@ public class WebInstRequestFilter extends GenericFilterBean {
if(StringUtils.isEmpty(origin)) {
origin = applicationConfig.getFrontendUri();
}
_logger.trace("origin {}" ,origin);
}
chain.doFilter(servletRequest, servletResponse);
}

View File

@ -35,10 +35,10 @@ import jakarta.servlet.http.HttpServletRequest;
public class WebXssRequestFilter extends GenericFilterBean {
final static Logger _logger = LoggerFactory.getLogger(GenericFilterBean.class);
static final Logger _logger = LoggerFactory.getLogger(WebXssRequestFilter.class);
final static ConcurrentHashMap <String,String> skipUrlMap = new ConcurrentHashMap <String,String>();
final static ConcurrentHashMap <String,String> skipParameterName = new ConcurrentHashMap <String,String>();
static final ConcurrentHashMap <String,String> skipUrlMap = new ConcurrentHashMap <>();
static final ConcurrentHashMap <String,String> skipParameterName = new ConcurrentHashMap <>();
static {
//add or update
@ -74,24 +74,24 @@ public class WebXssRequestFilter extends GenericFilterBean {
boolean isWebXss = false;
HttpServletRequest request= ((HttpServletRequest)servletRequest);
if(_logger.isTraceEnabled()) {WebContext.printRequest(request);}
if(skipUrlMap.containsKey(request.getRequestURI().substring(request.getContextPath().length()))) {
isWebXss = false;
String requestURL =request.getRequestURI().substring(request.getContextPath().length());
if(skipUrlMap.containsKey(requestURL)) {
_logger.trace("skip URL {}",requestURL);
}else {
Enumeration<String> parameterNames = request.getParameterNames();
while (parameterNames.hasMoreElements()) {
String key = (String) parameterNames.nextElement();
if(skipParameterName.containsKey(key)) {continue;}
String value = request.getParameter(key);
_logger.trace("parameter name "+key +" , value " + value);
String tempValue = value;
if(!StringEscapeUtils.escapeHtml4(tempValue).equals(value)
||tempValue.toLowerCase().indexOf("script")>-1
||tempValue.toLowerCase().replace(" ", "").indexOf("eval(")>-1) {
isWebXss = true;
_logger.error("parameter name "+key +" , value " + value
+ ", contains dangerous content ! ");
break;
String key = parameterNames.nextElement();
if(!skipParameterName.containsKey(key)) {
String value = request.getParameter(key);
_logger.trace("parameter name {} , value {}" , key, value);
String tempValue = value;
if(!StringEscapeUtils.escapeHtml4(tempValue).equals(value)
||tempValue.toLowerCase().indexOf("script")>-1
||tempValue.toLowerCase().replace(" ", "").indexOf("eval(")>-1) {
isWebXss = true;
_logger.error("parameter name {} , value {}, contains dangerous content ! ",key,value);
break;
}
}
}
}

View File

@ -0,0 +1,5 @@
org.dromara.maxkey.autoconfigure.ApplicationAutoConfiguration
org.dromara.maxkey.autoconfigure.RedisAutoConfiguration
org.dromara.maxkey.autoconfigure.MvcCurrentUserAutoConfiguration
org.dromara.maxkey.autoconfigure.MvcResourceAutoConfiguration
org.dromara.maxkey.autoconfigure.SwaggerAutoConfiguration

View File

@ -0,0 +1 @@
org.dromara.maxkey.autoconfigure.SynchronizerAutoConfiguration

View File

@ -39,14 +39,16 @@ dependencies {
implementation project(":maxkey-core")
implementation project(":maxkey-persistence")
implementation project(":maxkey-starter:maxkey-starter-captcha")
implementation project(":maxkey-starter:maxkey-starter-ip2location")
implementation project(":maxkey-starter:maxkey-starter-otp")
implementation project(":maxkey-starter:maxkey-starter-sms")
implementation project(":maxkey-starter:maxkey-starter-web")
implementation project(":maxkey-authentications:maxkey-authentication-core")
implementation project(":maxkey-authentications:maxkey-authentication-social")
implementation project(":maxkey-authentications:maxkey-authentication-captcha")
implementation project(":maxkey-authentications:maxkey-authentication-ip2location")
implementation project(":maxkey-authentications:maxkey-authentication-otp")
implementation project(":maxkey-authentications:maxkey-authentication-provider")
implementation project(":maxkey-authentications:maxkey-authentication-sms")
implementation project(":maxkey-protocols:maxkey-protocol-authorize")
implementation project(":maxkey-protocols:maxkey-protocol-cas")
implementation project(":maxkey-protocols:maxkey-protocol-extendapi")

View File

@ -1,19 +1,3 @@
org.dromara.maxkey.autoconfigure.ApplicationAutoConfiguration
org.dromara.maxkey.autoconfigure.MvcAutoConfiguration
org.dromara.maxkey.autoconfigure.KaptchaAutoConfiguration
org.dromara.maxkey.autoconfigure.RedisAutoConfiguration
org.dromara.maxkey.autoconfigure.AuthnProviderAutoConfiguration
org.dromara.maxkey.autoconfigure.JwtAuthnAutoConfiguration
org.dromara.maxkey.autoconfigure.OneTimePasswordAutoConfiguration
org.dromara.maxkey.autoconfigure.SmsAutoConfiguration
org.dromara.maxkey.autoconfigure.SessionAutoConfiguration
org.dromara.maxkey.autoconfigure.TokenAutoConfiguration
org.dromara.maxkey.autoconfigure.CasAutoConfiguration
org.dromara.maxkey.autoconfigure.Oauth20AutoConfiguration
org.dromara.maxkey.autoconfigure.MvcCurrentUserAutoConfiguration
org.dromara.maxkey.autoconfigure.MvcResourceAutoConfiguration
org.dromara.maxkey.autoconfigure.Saml20AutoConfiguration
org.dromara.maxkey.autoconfigure.SocialSignOnAutoConfiguration
org.dromara.maxkey.autoconfigure.SwaggerAutoConfiguration
org.dromara.maxkey.autoconfigure.MaxKeyMvcConfig
org.dromara.maxkey.autoconfigure.MaxKeyConfig

View File

@ -44,12 +44,14 @@ dependencies {
implementation project(":maxkey-core")
implementation project(":maxkey-persistence")
implementation project(":maxkey-starter:maxkey-starter-captcha")
implementation project(":maxkey-starter:maxkey-starter-ip2location")
implementation project(":maxkey-starter:maxkey-starter-otp")
implementation project(":maxkey-starter:maxkey-starter-sms")
implementation project(":maxkey-starter:maxkey-starter-web")
implementation project(":maxkey-authentications:maxkey-authentication-core")
implementation project(":maxkey-authentications:maxkey-authentication-captcha")
implementation project(":maxkey-authentications:maxkey-authentication-ip2location")
implementation project(":maxkey-authentications:maxkey-authentication-otp")
implementation project(":maxkey-authentications:maxkey-authentication-provider")
implementation project(":maxkey-authentications:maxkey-authentication-sms")
implementation project(":maxkey-protocols:maxkey-protocol-oauth-2.0")
implementation project(":maxkey-protocols:maxkey-protocol-saml-2.0")

View File

@ -1,17 +1,3 @@
org.dromara.maxkey.autoconfigure.ApplicationAutoConfiguration
org.dromara.maxkey.autoconfigure.KaptchaAutoConfiguration
org.dromara.maxkey.autoconfigure.MvcAutoConfiguration
org.dromara.maxkey.autoconfigure.JwtAuthnAutoConfiguration
org.dromara.maxkey.autoconfigure.RedisAutoConfiguration
org.dromara.maxkey.autoconfigure.AuthnProviderAutoConfiguration
org.dromara.maxkey.autoconfigure.OneTimePasswordAutoConfiguration
org.dromara.maxkey.autoconfigure.SmsAutoConfiguration
org.dromara.maxkey.autoconfigure.SessionAutoConfiguration
org.dromara.maxkey.autoconfigure.TokenAutoConfiguration
org.dromara.maxkey.autoconfigure.MvcCurrentUserAutoConfiguration
org.dromara.maxkey.autoconfigure.MvcResourceAutoConfiguration
org.dromara.maxkey.autoconfigure.SynchronizerAutoConfiguration
org.dromara.maxkey.autoconfigure.SwaggerAutoConfiguration
org.dromara.maxkey.autoconfigure.Oauth20ClientAutoConfiguration
org.dromara.maxkey.autoconfigure.MaxKeyMgtConfig
org.dromara.maxkey.autoconfigure.MaxKeyMgtMvcConfig

View File

@ -44,12 +44,14 @@ dependencies {
implementation project(":maxkey-core")
implementation project(":maxkey-persistence")
implementation project(":maxkey-starter:maxkey-starter-captcha")
implementation project(":maxkey-starter:maxkey-starter-ip2location")
implementation project(":maxkey-starter:maxkey-starter-otp")
implementation project(":maxkey-starter:maxkey-starter-sms")
implementation project(":maxkey-starter:maxkey-starter-web")
implementation project(":maxkey-authentications:maxkey-authentication-core")
implementation project(":maxkey-authentications:maxkey-authentication-captcha")
implementation project(":maxkey-authentications:maxkey-authentication-ip2location")
implementation project(":maxkey-authentications:maxkey-authentication-otp")
implementation project(":maxkey-authentications:maxkey-authentication-provider")
implementation project(":maxkey-authentications:maxkey-authentication-sms")
implementation project(":maxkey-protocols:maxkey-protocol-oauth-2.0")
implementation project(":maxkey-protocols:maxkey-protocol-saml-2.0")

View File

@ -1,16 +1,3 @@
org.dromara.maxkey.autoconfigure.ApplicationAutoConfiguration
org.dromara.maxkey.autoconfigure.KaptchaAutoConfiguration
org.dromara.maxkey.autoconfigure.MvcAutoConfiguration
org.dromara.maxkey.autoconfigure.JwtAuthnAutoConfiguration
org.dromara.maxkey.autoconfigure.RedisAutoConfiguration
org.dromara.maxkey.autoconfigure.AuthnProviderAutoConfiguration
org.dromara.maxkey.autoconfigure.OneTimePasswordAutoConfiguration
org.dromara.maxkey.autoconfigure.MvcCurrentUserAutoConfiguration
org.dromara.maxkey.autoconfigure.MvcResourceAutoConfiguration
org.dromara.maxkey.autoconfigure.SmsAutoConfiguration
org.dromara.maxkey.autoconfigure.SessionAutoConfiguration
org.dromara.maxkey.autoconfigure.TokenAutoConfiguration
org.dromara.maxkey.autoconfigure.SwaggerAutoConfiguration
org.dromara.maxkey.autoconfigure.Oauth20ClientAutoConfiguration
org.dromara.maxkey.autoconfigure.MaxKeyOpenApiConfig
org.dromara.maxkey.autoconfigure.MaxKeyOpenApiMvcConfig

View File

@ -25,13 +25,16 @@ include ('maxkey-common')
include ('maxkey-core')
include ('maxkey-persistence')
//maxkey-starter
include ('maxkey-starter:maxkey-starter-captcha')
include ('maxkey-starter:maxkey-starter-ip2location')
include ('maxkey-starter:maxkey-starter-otp')
include ('maxkey-starter:maxkey-starter-sms')
include ('maxkey-starter:maxkey-starter-web')
//authentications
include ('maxkey-authentications:maxkey-authentication-captcha')
include ('maxkey-authentications:maxkey-authentication-core')
include ('maxkey-authentications:maxkey-authentication-ip2location')
include ('maxkey-authentications:maxkey-authentication-otp')
include ('maxkey-authentications:maxkey-authentication-provider')
include ('maxkey-authentications:maxkey-authentication-sms')
include ('maxkey-authentications:maxkey-authentication-social')
//rest apis