简体   繁体   English

升级tomcat嵌入式版本后,基本登录身份验证失败

[英]Basic login authentication fails after upgrading tomcat-embeded versions

My application expose web applications using Tomcat Embedded. 我的应用程序使用Tomcat Embedded公开了Web应用程序。
It is secured using username and password authentication. 它使用用户名和密码身份验证进行保护。 From my web.xml 从我的web.xml

<login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>BMC Application Diagnostics Portal Console</realm-name>
</login-config>

I'm implementing my own Realm and I'm configuring it in my Tomcat instance: 我正在实现自己的Realm,并在Tomcat实例中对其进行配置:

_tomcat.setDefaultRealm(new MyRealm());

Everything worked just fine, until I had to upgrade tomcat's version (to 7.0.30 minimum). 一切正常,直到我必须升级tomcat的版本(最低为7.0.30)。 After upgrading both tomcat-embed-core.jar and tomcat-embed-jasper.jar I just can't access my web application. 升级了tomcat-embed-core.jar和tomcat-embed-jasper.jar之后,我只是无法访问我的Web应用程序。
The authentication window pops up, I insert my username and password but it fail to login (seems like username\\password incorrect behavior). 身份验证窗口弹出,我输入了用户名和密码,但登录失败(似乎用户名\\密码行为不正确)。
I didn't change nothing in my code! 我没有在代码中做任何更改! If I swap the jars back to 7.0.22 everything works just fine. 如果我将罐子换回7.0.22,一切正常。

BTW, setDefaultRealm() is deprecated, I don't know if it helps. 顺便说一句, setDefaultRealm()已被弃用,我不知道它是否有帮助。

If someone had this problem before or has an idea how to handle this it would be great. 如果有人以前有这个问题,或者对如何解决这个问题有一个想法,那就太好了。

Thanks 谢谢

Found the answer here . 这里找到答案。 Since version 7.0.24 Realm should be set to Engine, as follows: 从版本7.0.24开始,应将Realm设置为Engine,如下所示:

_tomcat.getEngine().setRealm(new MyRealm());

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM