- Take a look at the
configure-elytron.cli
file that creates an Elytron filesystem-based security realm and adds the configuration necessary to secure our application using Elytron. Notice that our security realms has two users,alice
andbob
, with passwordsalice123+
andbob123+
, respectively. Also notice that alice has both theemployee
andadmin
roles but bob only has theemployee
role.
$WILDFLY_HOME/bin/jboss-cli.sh --connect --file=configure-elytron.cli
-
This example consists of two servlets that an invoke an EJB (see
example.InventoryServlet
andexample.AddServlet
). Notice thatInventoryServlet
invokes an unsecured EJB method calledgetProducts
.AddServlet
invokes an EJB method,addProduct
, that requiresadmin
role. -
Build and deploy the application:
mvn clean install wildfly:deploy
- First access the application as
bob
. Try viewing the inventory. Then try to add a product. Since adding a product requires "admin" role, you'll see an error message. Then access the application asalice
. Sincealice
hasadmin
role, you'll be able to add a product successfully.
http://localhost:8080/wildfly-widgets