Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-14389

Resource adapters subsystem does not accept expression for security-application attribute

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 23.0.0.Beta1, 23.0.0.Final
    • 22.0.0.Final
    • JCA
    • None
    • Hide
      1. Run server with atteched config
      2. Execute cli:
      /subsystem=resource-adapters/resource-adapter=generic-jms-ra.rar/connection-definitions=\$\{genericjms.cf.pool-name\}:write-attribute(name=security-application, value=${test:true})
      
      Show
      Run server with atteched config Execute cli: /subsystem=resource-adapters/resource-adapter= generic -jms-ra.rar/connection-definitions=\$\{genericjms.cf.pool-name\}:write-attribute(name=security-application, value=${test: true })
    • Undefined
    • ---
    • ---

      Resource adapters subsystem supports expression for security-application attribute:

      /subsystem=resource-adapters/resource-adapter=generic-jms-ra.rar/connection-definitions=\$\{genericjms.cf.pool-name\}:read-resource-description
      ...
      "security-application" => {
                      "type" => BOOLEAN,
                      "description" => "Indicates that application-supplied parameters, such as from getConnection(user, pw), are used to distinguish connections in the pool.",
                      "expressions-allowed" => true,
                      "required" => false,
                      "nillable" => true,
                      "default" => false,
                      "alternatives" => [
                          "security-domain",
                          "security-domain-and-application",
                          "authentication-context",
                          "authentication-context-and-application"
                      ],
                      "access-constraints" => {"sensitive" => {
                          "security-domain-ref" => {"type" => "core"},
                          "resource-adapter-security" => {"type" => "resource-adapters"}
                      }},
                      "access-type" => "read-write",
                      "storage" => "configuration",
                      "restart-required" => "all-services"
                  },
      
      

      however it fails to marshall it:

      /subsystem=resource-adapters/resource-adapter=generic-jms-ra.rar/connection-definitions=\$\{genericjms.cf.pool-name\}:write-attribute(name=security-application, value=${test:true})
      
      22:39:11,111 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 1) WFLYCTL0008: Failed to persist configuration change: org.jboss.as.controller.persistence.ConfigurationPersistenceException: WFLYCTL0084: Failed to marshal configuration
      	at org.jboss.as.controller.persistence.AbstractFilePersistenceResource.<init>(AbstractFilePersistenceResource.java:53)
      	at org.jboss.as.controller.persistence.ConfigurationFilePersistenceResource.<init>(ConfigurationFilePersistenceResource.java:46)
      	at org.jboss.as.controller.persistence.BackupXmlConfigurationPersister.store(BackupXmlConfigurationPersister.java:120)
      	at org.jboss.as.controller.ModelControllerImpl.writeModel(ModelControllerImpl.java:728)
      	at org.jboss.as.controller.OperationContextImpl.createPersistenceResource(OperationContextImpl.java:535)
      	at org.jboss.as.controller.AbstractOperationContext.executeDoneStage(AbstractOperationContext.java:821)
      	at org.jboss.as.controller.AbstractOperationContext.processStages(AbstractOperationContext.java:770)
      	at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:468)
      	at org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1415)
      	at org.jboss.as.controller.ModelControllerImpl.internalExecute(ModelControllerImpl.java:431)
      	at org.jboss.as.controller.ModelControllerImpl.lambda$execute$1(ModelControllerImpl.java:248)
      	at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:304)
      	at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:270)
      	at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:248)
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.doExecute(ModelControllerClientOperationHandler.java:240)
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler.access$400(ModelControllerClientOperationHandler.java:138)
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1$1.run(ModelControllerClientOperationHandler.java:162)
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1$1.run(ModelControllerClientOperationHandler.java:158)
      	at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:328)
      	at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:285)
      	at org.jboss.as.controller.AccessAuditContext.doAs(AccessAuditContext.java:254)
      	at org.jboss.as.controller.AccessAuditContext.doAs(AccessAuditContext.java:225)
      	at org.jboss.as.controller.remote.ModelControllerClientOperationHandler$ExecuteRequestHandler$1.execute(ModelControllerClientOperationHandler.java:158)
      	at org.jboss.as.protocol.mgmt.ManagementRequestContextImpl$1.doExecute(ManagementRequestContextImpl.java:70)
      	at org.jboss.as.protocol.mgmt.ManagementRequestContextImpl$AsyncTaskRunner.run(ManagementRequestContextImpl.java:160)
      	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
      	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
      	at java.lang.Thread.run(Thread.java:748)
      	at org.jboss.threads.JBossThread.run(JBossThread.java:513)
      Caused by: org.jboss.as.controller.persistence.ConfigurationPersistenceException: WFLYCTL0089: Failed to write configuration
      	at org.jboss.as.controller.persistence.AbstractConfigurationPersister.marshallAsXml(AbstractConfigurationPersister.java:112)
      	at org.jboss.as.controller.persistence.AbstractFilePersistenceResource.<init>(AbstractFilePersistenceResource.java:46)
      	... 30 more
      Caused by: java.lang.IllegalArgumentException
      	at org.jboss.dmr.ModelValue.asBoolean(ModelValue.java:69)
      	at org.jboss.dmr.ModelNode.asBoolean(ModelNode.java:324)
      	at org.jboss.as.connector.subsystems.resourceadapters.ResourceAdapterSubsystemParser.writeConDef(ResourceAdapterSubsystemParser.java:378)
      	at org.jboss.as.connector.subsystems.resourceadapters.ResourceAdapterSubsystemParser.writeRaElement(ResourceAdapterSubsystemParser.java:232)
      	at org.jboss.as.connector.subsystems.resourceadapters.ResourceAdapterSubsystemParser.writeContent(ResourceAdapterSubsystemParser.java:148)
      	at org.jboss.as.connector.subsystems.resourceadapters.ResourceAdapterSubsystemParser.writeContent(ResourceAdapterSubsystemParser.java:130)
      	at org.jboss.as.server.parsing.CommonXml.writeSubsystems(CommonXml.java:281)
      	at org.jboss.as.server.parsing.StandaloneXml_16.writeServerProfile(StandaloneXml_16.java:830)
      	at org.jboss.as.server.parsing.StandaloneXml_16.writeContent(StandaloneXml_16.java:760)
      	at org.jboss.as.server.parsing.StandaloneXml.writeContent(StandaloneXml.java:151)
      	at org.jboss.as.server.parsing.StandaloneXml.writeContent(StandaloneXml.java:52)
      	at org.jboss.staxmapper.XMLMapperImpl.doDeparse(XMLMapperImpl.java:96)
      	at org.jboss.staxmapper.XMLMapperImpl.deparseDocument(XMLMapperImpl.java:91)
      	at org.jboss.as.controller.persistence.AbstractConfigurationPersister.marshallAsXml(AbstractConfigurationPersister.java:106)
      	... 31 more
      

      The error is caused by [1] where the parser does not resolve expression but read raw string (${yada yada}) as bool.

      [1] https://github.com/wildfly/wildfly/blob/22.0.0.Final/connector/src/main/java/org/jboss/as/connector/subsystems/resourceadapters/ResourceAdapterSubsystemParser.java#L376

              tadamski@redhat.com Tomasz Adamski
              istraka@redhat.com Ivan Straka
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: