This is an automated email from the ASF dual-hosted git repository.
xiaoyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push:
new 553122996 feature/check-passsword-support-I18n (#4758)
553122996 is described below
commit 5531229960c771641a9f25034bd41faf9d4073d8
Author: likeguo <[email protected]>
AuthorDate: Sun Jun 25 11:42:55 2023 +0800
feature/check-passsword-support-I18n (#4758)
* fixbug/ci-fix
* fixbug/ci-fix
* fixbug/ci-fix
* fixbug/ci-fix
* fixbug/ci-fix
* fixbug/ci-fix
---------
Co-authored-by: xiaoyu <[email protected]>
---
.../aspect/controller/RestControllerAspect.java | 7 +-
.../admin/config/ShenyuAdminConfiguration.java | 16 ++++
.../shenyu/admin/exception/ExceptionHandlers.java | 14 +++
.../shenyu/admin/exception/I18nException.java | 68 ++++++++++++++
.../shenyu/admin/exception/WebI18nException.java | 45 +++++++++
.../shenyu/admin/model/dto/DashboardUserDTO.java | 4 +-
.../model/dto/DashboardUserModifyPasswordDTO.java | 4 +-
.../service/impl/DashboardUserServiceImpl.java | 9 +-
.../apache/shenyu/admin/utils/FailI18nMessage.java | 34 +++++++
.../apache/shenyu/admin/utils/WebI18nAssert.java | 102 +++++++++++++++++++++
shenyu-admin/src/main/resources/application.yml | 2 +
.../src/main/resources/message/i18n.properties | 18 ++++
.../main/resources/message/i18n_en_US.properties | 19 ++++
.../main/resources/message/i18n_zh_CN.properties | 18 ++++
.../shenyu/admin/controller/ApiControllerTest.java | 2 +-
.../admin/controller/MetaDataControllerTest.java | 2 +-
.../MockRequestRecordControllerTest.java | 2 +-
.../admin/controller/PluginControllerTest.java | 2 +-
.../controller/PluginHandleControllerTest.java | 2 +-
.../admin/controller/ResourceControllerTest.java | 2 +-
.../admin/controller/RuleControllerTest.java | 2 +-
.../admin/controller/SandboxControllerTest.java | 2 +-
.../admin/controller/SelectorControllerTest.java | 2 +-
.../admin/controller/ShenyuDictControllerTest.java | 2 +-
.../shenyu/admin/controller/TagControllerTest.java | 2 +-
.../controller/TagRelationControllerTest.java | 2 +-
.../admin/exception/ExceptionHandlersTest.java | 2 +-
27 files changed, 364 insertions(+), 22 deletions(-)
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/aspect/controller/RestControllerAspect.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/aspect/controller/RestControllerAspect.java
index cc14ffc42..5176acecf 100644
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/aspect/controller/RestControllerAspect.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/aspect/controller/RestControllerAspect.java
@@ -18,6 +18,7 @@
package org.apache.shenyu.admin.aspect.controller;
import com.google.common.base.Stopwatch;
+import org.apache.shenyu.admin.exception.ShenyuAdminException;
import org.apache.shenyu.admin.utils.SessionUtil;
import org.apache.shenyu.common.exception.ShenyuException;
import org.aspectj.lang.ProceedingJoinPoint;
@@ -55,6 +56,7 @@ public class RestControllerAspect {
*
* @param point point {@link ProceedingJoinPoint}
* @return result {@link Object}
+ * @throws ShenyuException Throwable
*/
@Around("controller()")
public Object logAround(final ProceedingJoinPoint point) {
@@ -66,7 +68,10 @@ public class RestControllerAspect {
return point.proceed();
} catch (final Throwable throwable) {
doExec(a -> a.doThrowable(target, method, stopwatch, throwable));
- throw new ShenyuException(throwable);
+ if (throwable instanceof ShenyuException) {
+ throw (ShenyuException) throwable;
+ }
+ throw new ShenyuAdminException(throwable);
} finally {
try {
doExec(a -> a.doFinally(target, method, stopwatch));
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/config/ShenyuAdminConfiguration.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/config/ShenyuAdminConfiguration.java
index 0e9ede0ef..f3b9a8eb4 100644
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/config/ShenyuAdminConfiguration.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/config/ShenyuAdminConfiguration.java
@@ -22,11 +22,15 @@ import
org.apache.shenyu.admin.service.converter.SelectorHandleConverterFactor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
+import org.springframework.web.servlet.LocaleResolver;
+import org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
/**
* The type Shenyu admin configuration.
@@ -46,4 +50,16 @@ public class ShenyuAdminConfiguration {
Map<String, SelectorHandleConverter> converterMap =
converterList.stream().collect(Collectors.toMap(SelectorHandleConverter::pluginName,
Function.identity()));
return new SelectorHandleConverterFactor(converterMap);
}
+
+ /**
+ * support I18n.
+ *
+ * @return LocaleResolver
+ */
+ @Bean
+ public LocaleResolver localeResolver() {
+ final AcceptHeaderLocaleResolver localeResolver = new
AcceptHeaderLocaleResolver();
+ localeResolver.setSupportedLocales(Stream.of(Locale.US,
Locale.SIMPLIFIED_CHINESE).collect(Collectors.toList()));
+ return localeResolver;
+ }
}
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/exception/ExceptionHandlers.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/exception/ExceptionHandlers.java
index 4854c191c..eca44fec1 100644
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/exception/ExceptionHandlers.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/exception/ExceptionHandlers.java
@@ -24,6 +24,8 @@ import org.apache.shenyu.common.exception.ShenyuException;
import org.apache.shiro.authz.UnauthorizedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.context.MessageSource;
+import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.validation.BindingResult;
import org.springframework.web.HttpRequestMethodNotSupportedException;
@@ -52,6 +54,12 @@ public class ExceptionHandlers {
private static final Logger LOG =
LoggerFactory.getLogger(ExceptionHandlers.class);
+ private final MessageSource messageSource;
+
+ public ExceptionHandlers(final MessageSource messageSource) {
+ this.messageSource = messageSource;
+ }
+
@ExceptionHandler(Exception.class)
protected ShenyuAdminResult handleExceptionHandler(final Exception
exception) {
LOG.error(exception.getMessage(), exception);
@@ -130,4 +138,10 @@ public class ExceptionHandlers {
LOG.error("shenyu admin exception ", exception);
return ShenyuAdminResult.error(CommonErrorCode.ERROR,
exception.getMessage());
}
+
+ @ExceptionHandler(WebI18nException.class)
+ protected ShenyuAdminResult webI18nException(final WebI18nException
exception) {
+ final String message =
messageSource.getMessage(exception.getMessage(), exception.getArgs(),
LocaleContextHolder.getLocale());
+ return ShenyuAdminResult.error(CommonErrorCode.ERROR, message);
+ }
}
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/exception/I18nException.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/exception/I18nException.java
new file mode 100644
index 000000000..39dc1169d
--- /dev/null
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/exception/I18nException.java
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.exception;
+
+import java.util.Locale;
+
+/**
+ * ValidFailException.
+ * <p>valid fail.</p>
+ * <p>Exceptions that support internationalized messages</p>
+ */
+public class I18nException extends ShenyuAdminException {
+
+ private final Locale locale;
+
+ private final Object[] args;
+
+ public I18nException(final Throwable e) {
+ super(e);
+ locale = Locale.getDefault();
+ args = null;
+ }
+
+ public I18nException(final Locale locale, final String message, final
Object... objects) {
+ super(message);
+ this.locale = locale;
+ args = objects;
+ }
+
+ public I18nException(final Locale locale, final String message, final
Throwable throwable, final Object... objects) {
+ super(message, throwable);
+ this.locale = locale;
+ args = objects;
+ }
+
+ /**
+ * get locale.
+ *
+ * @return locale
+ */
+ public Locale getLocale() {
+ return locale;
+ }
+
+ /**
+ * get args.
+ *
+ * @return args
+ */
+ public Object[] getArgs() {
+ return args;
+ }
+}
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/exception/WebI18nException.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/exception/WebI18nException.java
new file mode 100644
index 000000000..b4c75e356
--- /dev/null
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/exception/WebI18nException.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.exception;
+
+import org.springframework.context.i18n.LocaleContextHolder;
+
+/**
+ * WebI18nException.
+ * <p>Used for internationalized message exceptions in the web environment.</p>
+ * <p>Exceptions that support internationalized messages</p>
+ */
+public class WebI18nException extends I18nException {
+
+ public WebI18nException(final Throwable e) {
+ super(e);
+ }
+
+ public WebI18nException(final String message) {
+ super(LocaleContextHolder.getLocale(), message);
+ }
+
+ public WebI18nException(final String message, final Object... objects) {
+ super(LocaleContextHolder.getLocale(), message, objects);
+ }
+
+ public WebI18nException(final String message, final Throwable throwable) {
+ super(LocaleContextHolder.getLocale(), message, throwable);
+ }
+
+}
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/DashboardUserDTO.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/DashboardUserDTO.java
index 7ec49b46c..f162c0300 100644
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/DashboardUserDTO.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/DashboardUserDTO.java
@@ -18,7 +18,7 @@
package org.apache.shenyu.admin.model.dto;
import org.apache.shenyu.admin.model.constant.RegConstant;
-import org.apache.shenyu.admin.utils.ShenyuResultMessage;
+import org.apache.shenyu.admin.utils.FailI18nMessage;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@@ -48,7 +48,7 @@ public class DashboardUserDTO implements Serializable {
/**
* user password.
*/
- @Pattern(regexp = RegConstant.PASSWORD_RULE, message =
ShenyuResultMessage.PASSWORD_MUST)
+ @Pattern(regexp = RegConstant.PASSWORD_RULE, message = '{' +
FailI18nMessage.PASSWORD_MUST + '}')
private String password;
/**
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/DashboardUserModifyPasswordDTO.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/DashboardUserModifyPasswordDTO.java
index 6aec394e3..470e42e13 100644
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/DashboardUserModifyPasswordDTO.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/model/dto/DashboardUserModifyPasswordDTO.java
@@ -18,7 +18,7 @@
package org.apache.shenyu.admin.model.dto;
import org.apache.shenyu.admin.model.constant.RegConstant;
-import org.apache.shenyu.admin.utils.ShenyuResultMessage;
+import org.apache.shenyu.admin.utils.FailI18nMessage;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
@@ -43,7 +43,7 @@ public class DashboardUserModifyPasswordDTO implements
Serializable {
* user password.
*/
@NotBlank
- @Pattern(regexp = RegConstant.PASSWORD_RULE, message =
ShenyuResultMessage.PASSWORD_MUST)
+ @Pattern(regexp = RegConstant.PASSWORD_RULE, message = '{' +
FailI18nMessage.PASSWORD_MUST + '}')
private String password;
/**
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/DashboardUserServiceImpl.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/DashboardUserServiceImpl.java
index 4e1a0ddbc..13009e744 100644
---
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/DashboardUserServiceImpl.java
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/DashboardUserServiceImpl.java
@@ -43,12 +43,13 @@ import org.apache.shenyu.admin.service.DashboardUserService;
import org.apache.shenyu.admin.service.publish.UserEventPublisher;
import org.apache.shenyu.admin.transfer.DashboardUserTransfer;
import org.apache.shenyu.admin.utils.Assert;
+import org.apache.shenyu.admin.utils.FailI18nMessage;
import org.apache.shenyu.admin.utils.JwtUtils;
-import org.apache.shenyu.common.utils.ListUtil;
import org.apache.shenyu.admin.utils.SessionUtil;
-import org.apache.shenyu.admin.utils.ShenyuResultMessage;
+import org.apache.shenyu.admin.utils.WebI18nAssert;
import org.apache.shenyu.common.constant.AdminConstants;
import org.apache.shenyu.common.utils.DigestUtils;
+import org.apache.shenyu.common.utils.ListUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.ldap.NameNotFoundException;
@@ -309,10 +310,10 @@ public class DashboardUserServiceImpl implements
DashboardUserService {
public boolean checkUserPassword(final String userId) {
final DashboardUserDO userDO = dashboardUserMapper.selectById(userId);
- Assert.isTrue(!Objects.equals(userDO.getDateCreated(),
userDO.getDateUpdated()), ShenyuResultMessage.PASSWORD_IS_DEFAULT);
+ WebI18nAssert.isTrue(!Objects.equals(userDO.getDateCreated(),
userDO.getDateUpdated()), FailI18nMessage.PASSWORD_IS_DEFAULT);
// The password has not been changed for a long time
- Assert.isTrue(passwordUsedLongTime(userDO),
ShenyuResultMessage.PASSWORD_USED_FOR_LONG_TIME);
+ WebI18nAssert.isTrue(passwordUsedLongTime(userDO),
FailI18nMessage.PASSWORD_USED_FOR_LONG_TIME);
// Weak password blacklist
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/utils/FailI18nMessage.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/utils/FailI18nMessage.java
new file mode 100644
index 000000000..0b39c4139
--- /dev/null
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/utils/FailI18nMessage.java
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.utils;
+
+/**
+ * result message.
+ */
+public final class FailI18nMessage {
+
+ public static final String PASSWORD_MUST =
"org.shenyu.admin.system.password.must";
+
+ public static final String PASSWORD_IS_DEFAULT =
"org.shenyu.admin.system.password.is.default";
+
+ public static final String PASSWORD_USED_FOR_LONG_TIME =
"org.shenyu.admin.system.password.used.for.long.time";
+
+ private FailI18nMessage() {
+
+ }
+}
diff --git
a/shenyu-admin/src/main/java/org/apache/shenyu/admin/utils/WebI18nAssert.java
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/utils/WebI18nAssert.java
new file mode 100644
index 000000000..234ab2bc2
--- /dev/null
+++
b/shenyu-admin/src/main/java/org/apache/shenyu/admin/utils/WebI18nAssert.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shenyu.admin.utils;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shenyu.admin.exception.WebI18nException;
+import org.springframework.util.CollectionUtils;
+
+import java.util.Collection;
+import java.util.Objects;
+
+/**
+ * Assert.<br>
+ * Support for assertion tools in web environments,
+ */
+public final class WebI18nAssert {
+
+ private WebI18nAssert() {
+ }
+
+ /**
+ * assert obj is not null.
+ *
+ * @param obj obj
+ * @param message error message
+ * @param objects objects
+ */
+ public static void notNull(final Object obj, final String message, final
Object... objects) {
+ isTrue(Objects.nonNull(obj), message, objects);
+ }
+
+ /**
+ * assert obj is null.
+ *
+ * @param obj obj
+ * @param message error message
+ * @param objects objects
+ */
+ public static void isNull(final Object obj, final String message, final
Object... objects) {
+ isTrue(Objects.isNull(obj), message, objects);
+ }
+
+ /**
+ * assert string is not black.
+ *
+ * @param str string
+ * @param message error message
+ * @param objects objects
+ */
+ public static void notBlack(final String str, final String message, final
Object... objects) {
+ isTrue(StringUtils.isNoneBlank(str), message, objects);
+ }
+
+ /**
+ * assert collection is not empty.
+ *
+ * @param collection obj
+ * @param message error message
+ * @param objects objects
+ */
+ public static void notEmpty(final Collection<?> collection, final String
message, final Object... objects) {
+ isTrue(!CollectionUtils.isEmpty(collection), message, objects);
+ }
+
+ /**
+ * assert test is true.
+ *
+ * @param test string
+ * @param message error message
+ * @param objects objects
+ */
+ public static void isTrue(final Boolean test, final String message, final
Object... objects) {
+ if (!Boolean.TRUE.equals(test)) {
+ fail(message, objects);
+ }
+ }
+
+ /**
+ * fail.
+ *
+ * @param message message
+ * @param objects objects
+ */
+ public static void fail(final String message, final Object... objects) {
+ throw new WebI18nException(message, objects);
+ }
+}
diff --git a/shenyu-admin/src/main/resources/application.yml
b/shenyu-admin/src/main/resources/application.yml
index d6c949fb6..e3d1e4940 100755
--- a/shenyu-admin/src/main/resources/application.yml
+++ b/shenyu-admin/src/main/resources/application.yml
@@ -31,6 +31,8 @@ spring:
matching-strategy: ant_path_matcher
jackson:
time-zone: GMT+8 # GMT , Asia/Shanghai
+ messages:
+ basename: message/i18n
management:
endpoints:
diff --git a/shenyu-admin/src/main/resources/message/i18n.properties
b/shenyu-admin/src/main/resources/message/i18n.properties
new file mode 100644
index 000000000..0c831b08b
--- /dev/null
+++ b/shenyu-admin/src/main/resources/message/i18n.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+org.shenyu.admin.system.password.used.for.long.time=If the password has not
been changed for a long time, please use it after changing it to ensure the
security of the super administrator account
+org.shenyu.admin.system.password.is.default=The password is the default
password and you must complete the change once
+org.shenyu.admin.system.password.must=Minimum length of 8, including upper and
lower case letters, numbers and special characters
diff --git a/shenyu-admin/src/main/resources/message/i18n_en_US.properties
b/shenyu-admin/src/main/resources/message/i18n_en_US.properties
new file mode 100644
index 000000000..1f92246a2
--- /dev/null
+++ b/shenyu-admin/src/main/resources/message/i18n_en_US.properties
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+org.shenyu.admin.system.password.used.for.long.time=If the password has not
been changed for a long time, please use it after changing it to ensure the
security of the super administrator account
+org.shenyu.admin.system.password.is.default=The password is the default
password and you must complete the change once
+org.shenyu.admin.system.password.must=Minimum length of 8, including upper and
lower case letters, numbers and special characters
+
diff --git a/shenyu-admin/src/main/resources/message/i18n_zh_CN.properties
b/shenyu-admin/src/main/resources/message/i18n_zh_CN.properties
new file mode 100644
index 000000000..ba1c8a954
--- /dev/null
+++ b/shenyu-admin/src/main/resources/message/i18n_zh_CN.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+org.shenyu.admin.system.password.used.for.long.time=\u5982\u679C\u5BC6\u7801\u957F\u65F6\u95F4\u672A\u66F4\u6539\uFF0C\u8BF7\u5728\u66F4\u6539\u540E\u4F7F\u7528\uFF0C\u4EE5\u786E\u4FDD\u8D85\u7EA7\u7BA1\u7406\u5458\u5E10\u6237\u7684\u5B89\u5168\u6027
+org.shenyu.admin.system.password.is.default=\u5BC6\u7801\u662F\u9ED8\u8BA4\u5BC6\u7801\uFF0C\u60A8\u5FC5\u987B\u5B8C\u6210\u4E00\u6B21\u66F4\u6539
+org.shenyu.admin.system.password.must=\u6700\u5C0F\u957F\u5EA6\u4E3A
8\uFF0C\u5305\u62EC\u5927\u5199\u548C\u5C0F\u5199\u5B57\u6BCD\u3001\u6570\u5B57\u548C\u7279\u6B8A\u5B57\u7B26
+
diff --git
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/ApiControllerTest.java
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/ApiControllerTest.java
index 637e1603f..f94275aec 100644
---
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/ApiControllerTest.java
+++
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/ApiControllerTest.java
@@ -77,7 +77,7 @@ public final class ApiControllerTest {
@BeforeEach
public void setUp() {
this.mockMvc = MockMvcBuilders.standaloneSetup(apiController)
- .setControllerAdvice(new ExceptionHandlers())
+ .setControllerAdvice(new ExceptionHandlers(null))
.build();
this.apiVO = ApiVO.builder()
.id("123")
diff --git
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/MetaDataControllerTest.java
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/MetaDataControllerTest.java
index 2767a4bf5..1fa925aa8 100644
---
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/MetaDataControllerTest.java
+++
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/MetaDataControllerTest.java
@@ -85,7 +85,7 @@ public final class MetaDataControllerTest {
@BeforeEach
public void setUp() {
this.mockMvc = MockMvcBuilders.standaloneSetup(metaDataController)
- .setControllerAdvice(new ExceptionHandlers())
+ .setControllerAdvice(new ExceptionHandlers(null))
.build();
}
diff --git
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/MockRequestRecordControllerTest.java
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/MockRequestRecordControllerTest.java
index 0cb4a84e6..1084f4695 100644
---
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/MockRequestRecordControllerTest.java
+++
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/MockRequestRecordControllerTest.java
@@ -62,7 +62,7 @@ public class MockRequestRecordControllerTest {
@BeforeEach
public void setUp() {
this.mockMvc =
MockMvcBuilders.standaloneSetup(mockRequestRecordController)
- .setControllerAdvice(new ExceptionHandlers())
+ .setControllerAdvice(new ExceptionHandlers(null))
.build();
}
diff --git
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/PluginControllerTest.java
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/PluginControllerTest.java
index 9b9673d93..669023cf9 100644
---
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/PluginControllerTest.java
+++
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/PluginControllerTest.java
@@ -88,7 +88,7 @@ public final class PluginControllerTest {
@BeforeEach
public void setUp() {
this.mockMvc = MockMvcBuilders.standaloneSetup(pluginController)
- .setControllerAdvice(new ExceptionHandlers())
+ .setControllerAdvice(new ExceptionHandlers(null))
.build();
this.pluginVO = new PluginVO("123", "1", "t_n", "1", 1, true,
DateUtils.localDateTimeToString(LocalDateTime.now()),
DateUtils.localDateTimeToString(LocalDateTime.now()));
diff --git
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/PluginHandleControllerTest.java
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/PluginHandleControllerTest.java
index 98882d581..362cbbd52 100644
---
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/PluginHandleControllerTest.java
+++
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/PluginHandleControllerTest.java
@@ -76,7 +76,7 @@ public final class PluginHandleControllerTest {
@BeforeEach
public void setUp() {
this.mockMvc = MockMvcBuilders.standaloneSetup(pluginHandleController)
- .setControllerAdvice(new ExceptionHandlers())
+ .setControllerAdvice(new ExceptionHandlers(null))
.build();
}
diff --git
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/ResourceControllerTest.java
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/ResourceControllerTest.java
index da5406309..0b520c8ea 100644
---
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/ResourceControllerTest.java
+++
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/ResourceControllerTest.java
@@ -73,7 +73,7 @@ public class ResourceControllerTest {
@BeforeEach
public void setUp() {
this.mockMvc = MockMvcBuilders.standaloneSetup(resourceController)
- .setControllerAdvice(new ExceptionHandlers())
+ .setControllerAdvice(new ExceptionHandlers(null))
.build();
}
diff --git
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/RuleControllerTest.java
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/RuleControllerTest.java
index d4f177a67..138125564 100644
---
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/RuleControllerTest.java
+++
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/RuleControllerTest.java
@@ -95,7 +95,7 @@ public final class RuleControllerTest {
@BeforeEach
public void setUp() {
this.mockMvc = MockMvcBuilders.standaloneSetup(ruleController)
- .setControllerAdvice(new ExceptionHandlers())
+ .setControllerAdvice(new ExceptionHandlers(null))
.build();
// mock login user
final UserInfo mockLoginUser = new UserInfo();
diff --git
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/SandboxControllerTest.java
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/SandboxControllerTest.java
index 8bb91b091..a50af0f5f 100644
---
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/SandboxControllerTest.java
+++
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/SandboxControllerTest.java
@@ -64,7 +64,7 @@ public final class SandboxControllerTest {
@BeforeEach
public void setUp() {
this.mockMvc = MockMvcBuilders.standaloneSetup(sandboxController)
- .setControllerAdvice(new ExceptionHandlers())
+ .setControllerAdvice(new ExceptionHandlers(null))
.build();
}
diff --git
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/SelectorControllerTest.java
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/SelectorControllerTest.java
index 11aab8cde..d9b1b79dd 100644
---
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/SelectorControllerTest.java
+++
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/SelectorControllerTest.java
@@ -89,7 +89,7 @@ public final class SelectorControllerTest {
@BeforeEach
public void setUp() {
this.mockMvc = MockMvcBuilders.standaloneSetup(selectorController)
- .setControllerAdvice(new ExceptionHandlers())
+ .setControllerAdvice(new ExceptionHandlers(null))
.build();
// mock login user
final UserInfo mockLoginUser = new UserInfo();
diff --git
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/ShenyuDictControllerTest.java
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/ShenyuDictControllerTest.java
index 0a235da7a..e483b643a 100644
---
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/ShenyuDictControllerTest.java
+++
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/ShenyuDictControllerTest.java
@@ -79,7 +79,7 @@ public final class ShenyuDictControllerTest {
@BeforeEach
public void setUp() {
this.mockMvc = MockMvcBuilders.standaloneSetup(shenyuDictController)
- .setControllerAdvice(new ExceptionHandlers())
+ .setControllerAdvice(new ExceptionHandlers(null))
.build();
}
diff --git
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/TagControllerTest.java
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/TagControllerTest.java
index bca79e453..2691be6f7 100644
---
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/TagControllerTest.java
+++
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/TagControllerTest.java
@@ -63,7 +63,7 @@ public final class TagControllerTest {
@BeforeEach
public void setUp() {
this.mockMvc = MockMvcBuilders.standaloneSetup(tagController)
- .setControllerAdvice(new ExceptionHandlers())
+ .setControllerAdvice(new ExceptionHandlers(null))
.build();
}
diff --git
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/TagRelationControllerTest.java
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/TagRelationControllerTest.java
index bd839b727..564e963dd 100644
---
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/TagRelationControllerTest.java
+++
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/controller/TagRelationControllerTest.java
@@ -63,7 +63,7 @@ public final class TagRelationControllerTest {
@BeforeEach
public void setUp() {
this.mockMvc = MockMvcBuilders.standaloneSetup(tagRelationController)
- .setControllerAdvice(new ExceptionHandlers())
+ .setControllerAdvice(new ExceptionHandlers(null))
.build();
}
diff --git
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/exception/ExceptionHandlersTest.java
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/exception/ExceptionHandlersTest.java
index 96897f238..371e63e6e 100644
---
a/shenyu-admin/src/test/java/org/apache/shenyu/admin/exception/ExceptionHandlersTest.java
+++
b/shenyu-admin/src/test/java/org/apache/shenyu/admin/exception/ExceptionHandlersTest.java
@@ -85,7 +85,7 @@ public final class ExceptionHandlersTest {
@BeforeEach
public void setUp() {
- exceptionHandlersUnderTest = new ExceptionHandlers();
+ exceptionHandlersUnderTest = new ExceptionHandlers(null);
}
@Test