I'm trying to write a module test for my application, but unfortunately, the authentication is a bit complex by default. I want to change payara's authentication to an XML based one, where I can list hard coded users, passwords, and roles. Where can I do that, if it's even possible?
Thanks in advance.
Payara Server supports file-based realm with users, passwords and roles stored in a file. However, the passwords in that file are encrypted, so it's not possible to edit the file in type in the passwords in plain text. The format of the file isn't XML, it's basically a CSV file with semicolon separators. Here's more information about the file realm: https://javaee.github.io/tutorial/security-intro005.html
If the file realm isn't what you seek, you need to use the standard Java EE Security API and define your own IdentityStore in your application that can read everything from your custom XML file. If such an identity store is found in your application, it will be used instead of any realm defined in the server. This article describes how to create a custom IdentityStore: https://www.baeldung.com/java-ee-8-security