From a585f9b229ca1e23d569c4ada5102b234aa6968e Mon Sep 17 00:00:00 2001 From: Ashwin Mehendale Date: Tue, 9 Dec 2025 18:25:42 +0530 Subject: [PATCH] WFLY-19923: QuickStart ServletSecurity cant configure the server during packaging --- servlet-security/README-source.adoc | 18 ++---------------- servlet-security/configure-server.cli | 8 ++------ servlet-security/pom.xml | 4 ---- .../main/resources/META-INF/persistence.xml | 2 +- 4 files changed, 5 insertions(+), 27 deletions(-) diff --git a/servlet-security/README-source.adoc b/servlet-security/README-source.adoc index 75e23d2269..71ae81b835 100644 --- a/servlet-security/README-source.adoc +++ b/servlet-security/README-source.adoc @@ -99,29 +99,15 @@ The batch executed successfully After stopping the server, open the `__{jbossHomeName}__/standalone/configuration/standalone.xml` file and review the changes. -. The following datasource was added to the `datasources` subsystem. -+ -[source,xml,options="nowrap"] ----- - - jdbc:h2:mem:servlet-security;DB_CLOSE_ON_EXIT=FALSE - h2 - - sa - sa - - ----- - . The following `security-realm` was added to the `elytron` subsystem. + [source,xml,options="nowrap"] ---- - + - + diff --git a/servlet-security/configure-server.cli b/servlet-security/configure-server.cli index 95ceea1bf3..97669c68ba 100644 --- a/servlet-security/configure-server.cli +++ b/servlet-security/configure-server.cli @@ -1,12 +1,8 @@ # Batch script to configure the security domain and define the database query used to authenticate users batch - -# Start by creating the JDBC datasource -/subsystem=datasources/data-source=ServletSecurityDS:add(connection-url="jdbc:h2:mem:servlet-security;DB_CLOSE_ON_EXIT=FALSE", jndi-name="java:jboss/datasources/ServletSecurityDS", driver-name=h2, user-name="sa", password="sa") - -# Add the JDBC security realm creation -/subsystem=elytron/jdbc-realm=servlet-security-jdbc-realm:add(principal-query=[{sql="SELECT PASSWORD FROM USERS WHERE USERNAME = ?", data-source="ServletSecurityDS", clear-password-mapper={password-index=1}},{sql="SELECT R.NAME, 'Roles' FROM USERS_ROLES UR INNER JOIN ROLES R ON R.ID = UR.ROLE_ID INNER JOIN USERS U ON U.ID = UR.USER_ID WHERE U.USERNAME = ?", data-source="ServletSecurityDS", attribute-mapping=[{index=1, to=Roles}]}]) +# Create a JDBC security realm +/subsystem=elytron/jdbc-realm=servlet-security-jdbc-realm:add(principal-query=[{sql="SELECT PASSWORD FROM USERS WHERE USERNAME = ?", data-source="ExampleDS", clear-password-mapper={password-index=1}},{sql="SELECT R.NAME, 'Roles' FROM USERS_ROLES UR INNER JOIN ROLES R ON R.ID = UR.ROLE_ID INNER JOIN USERS U ON U.ID = UR.USER_ID WHERE U.USERNAME = ?", data-source="ExampleDS", attribute-mapping=[{index=1, to=Roles}]}]) # Configure the servlet-security-quickstart security domain /subsystem=elytron/security-domain=servlet-security-quickstart-sd:add(default-realm=servlet-security-jdbc-realm, realms=[{realm=servlet-security-jdbc-realm}], permission-mapper=default-permission-mapper) diff --git a/servlet-security/pom.xml b/servlet-security/pom.xml index 3ebb136d1d..48fc18d4c3 100644 --- a/servlet-security/pom.xml +++ b/servlet-security/pom.xml @@ -135,8 +135,6 @@ ${version.server} - - false h2-database @@ -172,8 +170,6 @@ ${version.server} - - false h2-database diff --git a/servlet-security/src/main/resources/META-INF/persistence.xml b/servlet-security/src/main/resources/META-INF/persistence.xml index 548be6c5f4..43edc27642 100644 --- a/servlet-security/src/main/resources/META-INF/persistence.xml +++ b/servlet-security/src/main/resources/META-INF/persistence.xml @@ -25,7 +25,7 @@ data source, this example data source is just for development and testing! --> - java:jboss/datasources/ServletSecurityDS + java:jboss/datasources/ExampleDS