Skip to content

Commit 18de555

Browse files
committed
WFLY-19923: QuickStart ServletSecurity cant configure the server during packaging
1 parent 0ea81c7 commit 18de555

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

servlet-security/README-source.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ After stopping the server, open the `__{jbossHomeName}__/standalone/configuratio
103103
+
104104
[source,xml,options="nowrap"]
105105
----
106-
<datasource jndi-name="java:jboss/datasources/ServletSecurityDS" pool-name="ServletSecurityDS">
106+
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS">
107107
<connection-url>jdbc:h2:mem:servlet-security;DB_CLOSE_ON_EXIT=FALSE</connection-url>
108108
<driver>h2</driver>
109109
<security>
@@ -118,10 +118,10 @@ After stopping the server, open the `__{jbossHomeName}__/standalone/configuratio
118118
[source,xml,options="nowrap"]
119119
----
120120
<jdbc-realm name="servlet-security-jdbc-realm">
121-
<principal-query sql="SELECT PASSWORD FROM USERS WHERE USERNAME = ?" data-source="ServletSecurityDS">
121+
<principal-query sql="SELECT PASSWORD FROM USERS WHERE USERNAME = ?" data-source="ExampleDS">
122122
<clear-password-mapper password-index="1"/>
123123
</principal-query>
124-
<principal-query 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">
124+
<principal-query 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">
125125
<attribute-mapping>
126126
<attribute to="roles" index="1"/>
127127
</attribute-mapping>

servlet-security/configure-server.cli

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
# Batch script to configure the security domain and define the database query used to authenticate users
22
batch
33

4-
5-
# Start by creating the JDBC datasource
6-
/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")
7-
8-
# Add the JDBC security realm creation
9-
/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}]}])
4+
# Create a JDBC security realm
5+
/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}]}])
106

117
# Configure the servlet-security-quickstart security domain
128
/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)

servlet-security/src/main/resources/META-INF/persistence.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
data source, this example data source is just for development and testing! -->
2626
<!-- The datasource is deployed as WEB-INF/servlet-security-quickstart-ds.xml,
2727
you can find it in the source at src/main/webapp/WEB-INF/servlet-security-quickstart-ds.xml -->
28-
<jta-data-source>java:jboss/datasources/ServletSecurityDS</jta-data-source>
28+
<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
2929
<properties>
3030
<!-- Properties for Hibernate -->
3131
<property name="hibernate.hbm2ddl.auto" value="create-drop" />

0 commit comments

Comments
 (0)