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

Elytron, unable to create custom principal transformer

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker Blocker
    • 11.0.0.Alpha1
    • None
    • Security
    • None
    • Hide
      • register module
        module add --name=org.jboss.customprincipaltransformerimpl --resources=/tmp/testJar2863518208058951940.jar --dependencies=org.wildfly.security.elytron,org.wildfly.extension.elytron
        
      • try to register custom credential security facotry
        [standalone@localhost:9990 /] /subsystem=elytron/custom-principal-transformer=CreaperTestAddCustomPrincipalTransformer:add(class-name=org.wildfly.extras.creaper.commands.elytron.mapper.AddCustomPrincipalTransformerImpl, module=org.jboss.customprincipaltransformerimpl)
        {
        "outcome" => "failed",
        "failure-description" =>
        Unknown macro: { "WFLYCTL0080}

        ,
        "rolled-back" => true
        }

        
        
      Show
      register module module add --name=org.jboss.customprincipaltransformerimpl --resources=/tmp/testJar2863518208058951940.jar --dependencies=org.wildfly.security.elytron,org.wildfly.extension.elytron try to register custom credential security facotry [standalone@localhost:9990 /] /subsystem=elytron/custom-principal-transformer=CreaperTestAddCustomPrincipalTransformer:add(class-name=org.wildfly.extras.creaper.commands.elytron.mapper.AddCustomPrincipalTransformerImpl, module=org.jboss.customprincipaltransformerimpl) { "outcome" => "failed", "failure-description" => Unknown macro: { "WFLYCTL0080} , "rolled-back" => true }

      When I try to register custom principal transformer I get NoClassDefFoundError

      07:11:37,203 WARN  [org.jboss.modules] (MSC service thread 1-4) Failed to define class org.wildfly.extras.creaper.commands.elytron.mapper.AddCustomPrincipalTransformerImpl in Module "org.jboss.customprincipaltransformerimpl" from local module loader @282ba1e (finder: local module finder @13b6d03 (roots: /home/mchoma/workspace/git-repositories/creaper/testsuite/standalone/target/jboss-as/modules,/home/mchoma/workspace/git-repositories/creaper/testsuite/standalone/target/jboss-as/modules/system/layers/base)): java.lang.NoClassDefFoundError: Failed to link org/wildfly/extras/creaper/commands/elytron/mapper/AddCustomPrincipalTransformerImpl (Module "org.jboss.customprincipaltransformerimpl" from local module loader @282ba1e (finder: local module finder @13b6d03 (roots: /home/mchoma/workspace/git-repositories/creaper/testsuite/standalone/target/jboss-as/modules,/home/mchoma/workspace/git-repositories/creaper/testsuite/standalone/target/jboss-as/modules/system/layers/base))): org/wildfly/extension/elytron/capabilities/PrincipalTransformer
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
      	at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:448)
      	at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:276)
      	at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:79)
      	at org.jboss.modules.Module.loadModuleClass(Module.java:708)
      	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:192)
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:412)
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:400)
      	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
      	at org.wildfly.extension.elytron.CustomComponentDefinition$ComponentAddHandler.createValue(CustomComponentDefinition.java:156)
      	at org.wildfly.extension.elytron.CustomComponentDefinition$ComponentAddHandler.lambda$performRuntime$1(CustomComponentDefinition.java:135)
      	at org.wildfly.extension.elytron.TrivialService.start(TrivialService.java:53)
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      
      07:11:37,204 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service org.wildfly.security.principal-transformer.CreaperTestAddCustomPrincipalTransformer: org.jboss.msc.service.StartException in service org.wildfly.security.principal-transformer.CreaperTestAddCustomPrincipalTransformer: Failed to start service
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1978)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.NoClassDefFoundError: Failed to link org/wildfly/extras/creaper/commands/elytron/mapper/AddCustomPrincipalTransformerImpl (Module "org.jboss.customprincipaltransformerimpl" from local module loader @282ba1e (finder: local module finder @13b6d03 (roots: /home/mchoma/workspace/git-repositories/creaper/testsuite/standalone/target/jboss-as/modules,/home/mchoma/workspace/git-repositories/creaper/testsuite/standalone/target/jboss-as/modules/system/layers/base))): org/wildfly/extension/elytron/capabilities/PrincipalTransformer
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      	at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
      	at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:448)
      	at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:276)
      	at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:79)
      	at org.jboss.modules.Module.loadModuleClass(Module.java:708)
      	at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:192)
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:412)
      	at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:400)
      	at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
      	at org.wildfly.extension.elytron.CustomComponentDefinition$ComponentAddHandler.createValue(CustomComponentDefinition.java:156)
      	at org.wildfly.extension.elytron.CustomComponentDefinition$ComponentAddHandler.lambda$performRuntime$1(CustomComponentDefinition.java:135)
      	at org.wildfly.extension.elytron.TrivialService.start(TrivialService.java:53)
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
      	... 3 more
      
      07:11:37,207 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 3) WFLYCTL0013: Operation ("add") failed - address: ([
          ("subsystem" => "elytron"),
          ("custom-principal-transformer" => "CreaperTestAddCustomPrincipalTransformer")
      ]) - failure description: {
          "WFLYCTL0080: Failed services" => {"org.wildfly.security.principal-transformer.CreaperTestAddCustomPrincipalTransformer" => "org.jboss.msc.service.StartException in service org.wildfly.security.principal-transformer.CreaperTestAddCustomPrincipalTransformer: Failed to start service
          Caused by: java.lang.NoClassDefFoundError: Failed to link org/wildfly/extras/creaper/commands/elytron/mapper/AddCustomPrincipalTransformerImpl (Module \"org.jboss.customprincipaltransformerimpl\" from local module loader @282ba1e (finder: local module finder @13b6d03 (roots: /home/mchoma/workspace/git-repositories/creaper/testsuite/standalone/target/jboss-as/modules,/home/mchoma/workspace/git-repositories/creaper/testsuite/standalone/target/jboss-as/modules/system/layers/base))): org/wildfly/extension/elytron/capabilities/PrincipalTransformer"},
          "WFLYCTL0412: Required services that are not installed:" => ["org.wildfly.security.principal-transformer.CreaperTestAddCustomPrincipalTransformer"]
      }
      

      That works in DR11 without issue

      Here is implementation of used custom prncipal transformer

      AddCustomPrincipalTransformerImpl.java
      package org.wildfly.extras.creaper.commands.elytron.mapper;
      
      import org.wildfly.extension.elytron.Configurable;
      import java.security.Principal;
      import java.util.Map;
      import org.wildfly.extension.elytron.capabilities.PrincipalTransformer;
      
      public class AddCustomPrincipalTransformerImpl implements PrincipalTransformer, Configurable {
      
          @Override
          public Principal apply(Principal p) {
              return p;
          }
      
          @Override
          public void initialize(Map<String, String> configuration) {
              if (configuration.containsKey("throwException")) {
                  throw new IllegalStateException("Only test purpose. This exception was thrown on demand.");
              }
          }
      
      }
      

              jkalina@redhat.com Jan Kalina (Inactive)
              mchoma@redhat.com Martin Choma
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: