# Batch script to remove the servlet-security-quickstart domain from the server configuration file

# Start batching commands
batch

# Remove Undertow's application security domain
/subsystem=undertow/application-security-domain=servlet-security-quickstart:remove()

# Remove the HTTP Authentication Factory
/subsystem=elytron/http-authentication-factory=servlet-security-quickstart-http-auth:remove()

# Remove the servlet-security-quickstart security domain
/subsystem=elytron/security-domain=servlet-security-quickstart-sd:remove()

# Remove a simple role decoder for the "roles" attribute mapping
/subsystem=elytron/simple-role-decoder=from-roles-attribute:remove()

# Remove the JDBC security realm creation
/subsystem=elytron/jdbc-realm=servlet-security-jdbc-realm:remove()

# Remove the JDBC datasource
/subsystem=datasources/data-source=ServletSecurityDS:remove()

# The README file contains instructions to undeploy the application. 
# If you prefer, you can uncomment the following to undeploy the application using this script.
# undeploy jboss-servlet-security.war

# Run the batch commands
run-batch

# Reload the server configuration
reload

