简体   繁体   中英

GlassFish authentication basic username and PASSWORD

I need to make protected resource on my GlassFish4.1 server. 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. Also there is possibility to create user via asadmin console command. 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?


UPD: my app is very simple and I do not use database.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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