简体   繁体   English

GlassFish身份验证的基本用户名和密码

[英]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.

相关问题 glassfish的基本身份验证失败 - basic authentication fails with glassfish 如何使用Glassfish实现基本身份验证? - How to implement basic authentication with Glassfish? 使用Ldap对Glassfish进行基本身份验证 - Basic Authentication on Glassfish using Ldap 使用 Springboot 应用程序和 Swagger-UI 进行基于令牌的身份验证,其中用户使用用户名和密码登录(基本身份验证) - Token based authentication with Springboot application and Swagger-UI where user logs in with username and password (basic authentication) 如何使用用户名和密码来构造URL以使用基本身份验证Java访问Rest API? - How to frame URL with username and password to access Rest API using basic authentication Java? 没有用户名和密码的Firebase身份验证 - Firebase Authentication without Username and Password 没有用户名/密码的自定义身份验证 - Custom Authentication without username/password 用户名和密码未在Spring中使用身份验证进行映射 - Username and Password not mapping with Authentication in Spring 使用用户名和密码进行 SprinBoot 身份验证 - SprinBoot Authentication with both username and password Spring Security中的用户名密码验证 - Username Password Authentication in Spring Security
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM