mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-06 17:08:29 +08:00
功能模块化,调整通用模块为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:
parent
5dd0c6dc96
commit
e1ac754186
@ -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")
|
||||
|
||||
}
|
||||
@ -0,0 +1,3 @@
|
||||
org.dromara.maxkey.autoconfigure.MvcCurrentUserAutoConfiguration
|
||||
org.dromara.maxkey.autoconfigure.SessionAutoConfiguration
|
||||
org.dromara.maxkey.autoconfigure.TokenAutoConfiguration
|
||||
@ -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")
|
||||
|
||||
}
|
||||
@ -0,0 +1,2 @@
|
||||
org.dromara.maxkey.autoconfigure.AuthnProviderAutoConfiguration
|
||||
org.dromara.maxkey.autoconfigure.JwtAuthnAutoConfiguration
|
||||
@ -0,0 +1 @@
|
||||
org.dromara.maxkey.autoconfigure.SocialSignOnAutoConfiguration
|
||||
@ -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;
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -0,0 +1 @@
|
||||
org.dromara.maxkey.autoconfigure.CasAutoConfiguration
|
||||
@ -0,0 +1 @@
|
||||
org.dromara.maxkey.autoconfigure.Saml20AutoConfiguration
|
||||
@ -1,5 +1,5 @@
|
||||
|
||||
description = "maxkey-authentication-captcha"
|
||||
description = "maxkey-starter-captcha"
|
||||
|
||||
|
||||
dependencies {
|
||||
@ -0,0 +1 @@
|
||||
org.dromara.maxkey.autoconfigure.KaptchaAutoConfiguration
|
||||
@ -1,5 +1,5 @@
|
||||
|
||||
description = "maxkey-authentication-core"
|
||||
description = "maxkey-starter-ip2location"
|
||||
|
||||
|
||||
dependencies {
|
||||
|
Before Width: | Height: | Size: 65 MiB After Width: | Height: | Size: 65 MiB |
@ -1,5 +1,5 @@
|
||||
|
||||
description = "maxkey-authentication-otp"
|
||||
description = "maxkey-starter-otp"
|
||||
|
||||
|
||||
dependencies {
|
||||
@ -0,0 +1 @@
|
||||
org.dromara.maxkey.autoconfigure.OneTimePasswordAutoConfiguration
|
||||
@ -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")
|
||||
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
org.dromara.maxkey.autoconfigure.SmsAutoConfiguration
|
||||
13
maxkey-starter/maxkey-starter-web/build.gradle
Normal file
13
maxkey-starter/maxkey-starter-web/build.gradle
Normal 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")
|
||||
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
@ -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,27 +74,27 @@ 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 key = parameterNames.nextElement();
|
||||
if(!skipParameterName.containsKey(key)) {
|
||||
String value = request.getParameter(key);
|
||||
_logger.trace("parameter name "+key +" , value " + value);
|
||||
_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 "+key +" , value " + value
|
||||
+ ", contains dangerous content ! ");
|
||||
_logger.error("parameter name {} , value {}, contains dangerous content ! ",key,value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!isWebXss) {
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
@ -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
|
||||
@ -0,0 +1 @@
|
||||
org.dromara.maxkey.autoconfigure.SynchronizerAutoConfiguration
|
||||
@ -39,13 +39,15 @@ 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")
|
||||
|
||||
@ -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
|
||||
@ -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")
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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")
|
||||
|
||||
@ -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
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user