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

NPE in UndertowDeploymentInfoService.authMethod

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 8.0.0.CR1
    • 8.0.0.Beta1
    • None
    • None
    • Workaround Exists
    • Hide

      Add BASIC auth method to web.xml:

          <login-config>
              <auth-method>BASIC</auth-method>
              <realm-name>RestBase</realm-name>
          </login-config>
      
      Show
      Add BASIC auth method to web.xml: <login-config> <auth-method> BASIC </auth-method> <realm-name> RestBase </realm-name> </login-config>

      If I do not define auth method in web.xml then NPE happens during deployment (Yoda would have saved you)

      web.xml:

          <login-config>
              <realm-name>RestBase</realm-name>
          </login-config>
      

      Stacktrace:

      java.lang.NullPointerException
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.authMethod(UndertowDeploymentInfoService.java:758)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.createServletConfig(UndertowDeploymentInfoService.java:693)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.start(UndertowDeploymentInfoService.java:214)
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1944) [jboss-msc-1.2.0.Beta2.jar:1.2.0.Beta2]
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1877) [jboss-msc-1.2.0.Beta2.jar:1.2.0.Beta2]
      

      Related source code:

          private static String authMethod(String configuredMethod) {
              // TODO - Feels like a candidate for an enum but will hold off until configuration of custom methods and chaining is
              // defined.
              if (configuredMethod.equals("CLIENT-CERT")) { //Speak Yoda here please
                  return HttpServletRequest.CLIENT_CERT_AUTH;
              }
              return configuredMethod;
          }
      

            sdouglas1@redhat.com Stuart Douglas
            blabno Bernard Labno (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: