Wednesday, May 20, 2015

Apply Basic Authentication In Glassfish

In this post I will explain how you can configure Glassfish instance (server) with basic authentication. If you deploy any java application or ADF application or web service in the Glassfish instance the user who will use this application or web service will be prompted to enter username and password.

To do so follow this following steps:

1- Open Glassfish admin console then go to:
Configurations --> Server-config --> Security --> Realms --> file



2- Enter "USERS" in Assign Groups



3- Press in "Manage Users" button



4- Press New to create new user and set Group List to "USERS"



5- In your web application add this in web.xml



6- In your web application create file "sun-web.xml" in the same place of web.xml and write this:





7- Now deploy the web application (Java, ADF ,Web Service,...) to the Glassfish and when you try to call the application you have to enter username / password



No comments:

Post a Comment