评论

收藏

[Java] spring security认证异常后返回中文提示的问题

编程语言 编程语言 发布于:2021-08-17 11:07 | 阅读数:434 | 评论:0

1.加载中文提示类
@configuration
public class reloadmessageconfig {
 
  /**
   * 加载中文的认证提示信息
   *
   * @return
   */
  @bean
  public reloadableresourcebundlemessagesource messagesource() {
  reloadableresourcebundlemessagesource messagesource = new reloadableresourcebundlemessagesource();
  // .properties 不要加到后面
  messagesource.setbasename("classpath:messages_zh_cn");
  return messagesource;
  }
2.messages_zh_cn存放路径
DSC0000.png

3.messages_zh_cn文件
切记不要修改编码
abstractaccessdecisionmanager.accessdenied=\u4e0d\u5141\u8bb8\u8bbf\u95ee
abstractldapauthenticationprovider.emptypassword=\u7528\u6237\u540d\u6216\u5bc6\u7801\u9519\u8bef
abstractsecurityinterceptor.authenticationnotfound=\u672a\u5728securitycontext\u4e2d\u67e5\u627e\u5230\u8ba4\u8bc1\u5bf9\u8c61
abstractuserdetailsauthenticationprovider.badcredentials=\u7528\u6237\u540d\u6216\u5bc6\u7801\u9519\u8bef
abstractuserdetailsauthenticationprovider.credentialsexpired=\u7528\u6237\u51ed\u8bc1\u5df2\u8fc7\u671f
abstractuserdetailsauthenticationprovider.disabled=\u7528\u6237\u5df2\u5931\u6548
abstractuserdetailsauthenticationprovider.expired=\u7528\u6237\u5e10\u53f7\u5df2\u8fc7\u671f
abstractuserdetailsauthenticationprovider.locked=\u7528\u6237\u5e10\u53f7\u5df2\u88ab\u9501\u5b9a
abstractuserdetailsauthenticationprovider.onlysupports=\u4ec5\u4ec5\u652f\u6301usernamepasswordauthenticationtoken
accountstatususerdetailschecker.credentialsexpired=\u7528\u6237\u51ed\u8bc1\u5df2\u8fc7\u671f
accountstatususerdetailschecker.disabled=\u7528\u6237\u5df2\u5931\u6548
accountstatususerdetailschecker.expired=\u7528\u6237\u5e10\u53f7\u5df2\u8fc7\u671f
accountstatususerdetailschecker.locked=\u7528\u6237\u5e10\u53f7\u5df2\u88ab\u9501\u5b9a
aclentryafterinvocationprovider.nopermission=\u7ed9\u5b9a\u7684authentication\u5bf9\u8c61({0})\u6839\u672c\u65e0\u6743\u64cd\u63a7\u9886\u57df\u5bf9\u8c61({1})
anonymousauthenticationprovider.incorrectkey=\u5c55\u793a\u7684anonymousauthenticationtoken\u4e0d\u542b\u6709\u9884\u671f\u7684key
bindauthenticator.badcredentials=\u7528\u6237\u540d\u6216\u5bc6\u7801\u9519\u8bef
bindauthenticator.emptypassword=\u7528\u6237\u540d\u6216\u5bc6\u7801\u9519\u8bef
casauthenticationprovider.incorrectkey=\u5c55\u793a\u7684casauthenticationtoken\u4e0d\u542b\u6709\u9884\u671f\u7684key
casauthenticationprovider.noserviceticket=\u672a\u80fd\u591f\u6b63\u786e\u63d0\u4f9b\u5f85\u9a8c\u8bc1\u7684cas\u670d\u52a1\u7968\u6839
concurrentsessioncontrolauthenticationstrategy.exceededallowed=\u5f53\u524d\u7528\u6237\u5df2\u7ecf\u5728\u53e6\u5916\u4e00\u53f0\u7535\u8111\u767b\u5f55\u4e86\uff0c\u4e0d\u5141\u8bb8\u91cd\u590d\u767b\u5f55
digestauthenticationfilter.incorrectrealm=\u54cd\u5e94\u7ed3\u679c\u4e2d\u7684realm\u540d\u5b57({0})\u540c\u7cfb\u7edf\u6307\u5b9a\u7684realm\u540d\u5b57({1})\u4e0d\u543b\u5408
digestauthenticationfilter.incorrectresponse=\u9519\u8bef\u7684\u54cd\u5e94\u7ed3\u679c
digestauthenticationfilter.missingauth=\u9057\u6f0f\u4e86\u9488\u5bf9'auth' qop\u7684\u3001\u5fc5\u987b\u7ed9\u5b9a\u7684\u6458\u8981\u53d6\u503c; \u63a5\u6536\u5230\u7684\u5934\u4fe1\u606f\u4e3a{0}
digestauthenticationfilter.missingmandatory=\u9057\u6f0f\u4e86\u5fc5\u987b\u7ed9\u5b9a\u7684\u6458\u8981\u53d6\u503c; \u63a5\u6536\u5230\u7684\u5934\u4fe1\u606f\u4e3a{0}
digestauthenticationfilter.noncecompromised=nonce\u4ee4\u724c\u5df2\u7ecf\u5b58\u5728\u95ee\u9898\u4e86\uff0c{0}
digestauthenticationfilter.nonceencoding=nonce\u672a\u7ecf\u8fc7base64\u7f16\u7801; \u76f8\u5e94\u7684nonce\u53d6\u503c\u4e3a {0}
digestauthenticationfilter.nonceexpired=nonce\u5df2\u7ecf\u8fc7\u671f/\u8d85\u65f6
digestauthenticationfilter.noncenotnumeric=nonce\u4ee4\u724c\u7684\u7b2c1\u90e8\u5206\u5e94\u8be5\u662f\u6570\u5b57\uff0c\u4f46\u7ed3\u679c\u5374\u662f{0}
digestauthenticationfilter.noncenottwotokens=nonce\u5e94\u8be5\u7531\u4e24\u90e8\u5206\u53d6\u503c\u6784\u6210\uff0c\u4f46\u7ed3\u679c\u5374\u662f{0}
digestauthenticationfilter.usernamenotfound=\u7528\u6237\u540d{0}\u672a\u627e\u5230
jdbcdaoimpl.noauthority=\u6ca1\u6709\u4e3a\u7528\u6237{0}\u6307\u5b9a\u89d2\u8272
jdbcdaoimpl.notfound=\u672a\u627e\u5230\u7528\u6237{0}
ldapauthenticationprovider.badcredentials=\u7528\u6237\u540d\u6216\u5bc6\u7801\u9519\u8bef
ldapauthenticationprovider.credentialsexpired=\u7528\u6237\u51ed\u8bc1\u5df2\u8fc7\u671f
ldapauthenticationprovider.disabled=\u7528\u6237\u5df2\u5931\u6548
ldapauthenticationprovider.expired=\u7528\u6237\u5e10\u53f7\u5df2\u8fc7\u671f
ldapauthenticationprovider.locked=\u7528\u6237\u5e10\u53f7\u5df2\u88ab\u9501\u5b9a
ldapauthenticationprovider.emptyusername=\u7528\u6237\u540d\u4e0d\u5141\u8bb8\u4e3a\u7a7a
ldapauthenticationprovider.onlysupports=\u4ec5\u4ec5\u652f\u6301usernamepasswordauthenticationtoken
passwordcomparisonauthenticator.badcredentials=\u7528\u6237\u540d\u6216\u5bc6\u7801\u9519\u8bef
#persistenttokenbasedremembermeservices.cookiestolen=invalid remember-me token (series/token) mismatch. implies previous cookie theft attack.
providermanager.providernotfound=\u672a\u67e5\u627e\u5230\u9488\u5bf9{0}\u7684authenticationprovider
remembermeauthenticationprovider.incorrectkey=\u5c55\u793aremembermeauthenticationtoken\u4e0d\u542b\u6709\u9884\u671f\u7684key
runasimplauthenticationprovider.incorrectkey=\u5c55\u793a\u7684runasusertoken\u4e0d\u542b\u6709\u9884\u671f\u7684key
subjectdnx509principalextractor.nomatching=\u672a\u5728subjectdn\: {0}\u4e2d\u627e\u5230\u5339\u914d\u7684\u6a21\u5f0f
switchuserfilter.nocurrentuser=\u4e0d\u5b58\u5728\u5f53\u524d\u7528\u6237
switchuserfilter.nooriginalauthentication=\u4e0d\u80fd\u591f\u67e5\u627e\u5230\u539f\u5148\u7684\u5df2\u8ba4\u8bc1\u5bf9\u8c61
DSC0001.png

到此这篇关于spring security认证异常后返回中文提示的问题的文章就介绍到这了,更多相关spring security认证异常内容请搜索CodeAE代码之家
以前的文章或继续浏览下面的相关文章希望大家以后多多支持CodeAE代码之家!
原文链接:https://blog.csdn.net/qq_20143059/article/details/113607978

关注下面的标签,发现更多相似文章