[英]GlassFish authentication basic username and PASSWORD
I need to make protected resource on my GlassFish4.1 server. 我需要在GlassFish4.1服务器上制作受保护的资源。 Digest or basic authentication will be good.
摘要或基本身份验证会很好。 I need only one user to be created.
我只需要创建一个用户。 I know, I could create user in admin-console, which is internal app-server application.
我知道,我可以在admin控制台(内部应用程序服务器应用程序)中创建用户。 Also there is possibility to create user via
asadmin
console command. 也可以通过
asadmin
控制台命令创建用户。 But I'd like to have this one user in existing file, that will be packet to war with application. 但是我想在现有文件中拥有一个用户,这将与应用程序发生争执。 Is there a way to set user with password via
web.xml
or in some other internal file? 有没有一种方法可以通过
web.xml
或其他内部文件为用户设置密码?
UPD: my app is very simple and I do not use database. UPD:我的应用程序非常简单,我不使用数据库。
It looks like this isn't directly possible. 看来这不是直接可能的。 Container managed security always uses a realm (either the one you set up in
web.xml
or the default one) to get the user data and none of the existing realms gives you the possibility to specify users inside your web application. 容器管理的安全性始终使用领域(您在
web.xml
设置的领域或默认领域)来获取用户数据,而现有的领域都无法让您在Web应用程序中指定用户。
You could easily implement a solution for this with the help of filters or there may be some Java web authentication framework which already provides this functionality but I guess this would be overkill. 您可以借助过滤器轻松实现此解决方案,或者可能已经有一些Java Web身份验证框架已经提供了此功能,但我想这可能会过头了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.