5 Replies Latest reply on Jan 7, 2015 9:38 AM by axis123

    JBoss7.1.1.Final Security port to Wildfly 8.2.Final

    axis123

      hello jboss community!

       

      i ve written my own login module and cant get it running on wildfly...(i need some stuff from java8 so ive to update..) on jboss7 everything works just fine, but on the wildfly side i always get an 401 error...

       

      what i mean is - that i dont believe that my application server does use my login module, because nothing shows up in the log..

       

      Log after start and trying to log in with my android client (which works with Volley.. a http library from google)

      10:01:22,871 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 31) JBAS018559: Deployed "server-wildfly-ear.ear" (runtime-name : "server-wildfly-ear.ear")
      10:01:22,948 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
      10:01:22,948 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
      10:01:22,949 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.2.0.Final "Tweek" started in 4927ms - Started 471 of 536 services (122 services are lazy, passive or on-demand)
      
      

      sure.. basic log after starting the server..

       

      and nothing then a "401 forbidden" on client side:

      12-11 10:05:47.523: E/Volley(27433): [2623] BasicNetwork.performRequest: Unexpected response code 401 for https://10.0.0.202:8443/server-wildfly-web/rest/userinfo/get_some_information
      
      

      (same with my internet explorer)

       

      my web.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app xmlns="http://java.sun.com/xml/ns/javaee"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
            version="3.0">
      
      
        <module-name>server-wildfly-web</module-name>
      
      
        <security-constraint>
              <web-resource-collection>
                   <web-resource-name>users</web-resource-name>
                  <url-pattern>/rest/userinfo/*</url-pattern>
              </web-resource-collection>
           
              <auth-constraint>
                  <role-name>user_role</role-name>
              </auth-constraint>
           
              <user-data-constraint>
                  <transport-guarantee>CONFIDENTIAL</transport-guarantee>
              </user-data-constraint>
          </security-constraint>
      
      
          <login-config>
              <auth-method>BASIC</auth-method>
              <realm-name>my_auth</realm-name>
          </login-config>
      
      
          <security-role>
              <role-name>admin</role-name>
          </security-role>
          <security-role>
              <role-name>user</role-name>
          </security-role>
          <security-role>
              <role-name>user_role</role-name>
          </security-role>
      </web-app>
      
      

       

      jboss-web.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-web>
          <security-domain>my_auth</security-domain>
          <valve>
              <class-name>com.test.server_wildfly.security.CustomAuthenticator</class-name>
          </valve>
      </jboss-web>
      
      

       

      standalone security realm: (full.xml)

      <security-realm name="MyRealm">
                      <server-identities>
                          <ssl protocol="TLS">
                              <keystore path="server.jks" relative-to="jboss.server.config.dir" keystore-password="password"/>
                          </ssl>
                      </server-identities>
                  </security-realm>
      
      

       

      standalone security domain: (full.xml)

      <security-domain name="my_auth" cache-type="default">
                          <authentication>
                              <login-module code="com.test.server_wildfly.security.CustomLoginModule" flag="required"/>
                          </authentication>
                      </security-domain>
      
      

       

      standalone ssl/tls stuff: (full.xml)

      <server name="default-server">
                      <http-listener name="default" socket-binding="http"/>
                      <https-listener name="https" socket-binding="https" security-realm="MyRealm"/>
      
      

       

      something must be wrong with the config, as i said jboss7 is no problem

       

      maven dependency for the wildfly project: (for the login module stuff)

      <dependency>
          <groupId>org.picketbox</groupId>
          <artifactId>picketbox</artifactId>
          <version>4.0.21.Final</version>
      </dependency>
      
      

       

      what i also tryed was:

      1) <default-security-domain value="other"/> - to my security domain "my_auth"

      2) removed valve from jboss-web.xml - because it isnt used?

      3) used another picketbox version

      4) remove everything from web.xml - which turned off, obviously, the login stuff so its deff. a configuration problem

      5) tryed wildfly8 and 8.1 too

       

      any advice? thank u very much

        • 1. Re: JBoss7.1.1.Final Security port to Wildfly 8.2.Final
          jaikiran

          Not sure what that valve configured in jboss-web.xml is supposed to do. Anyway, can you enable TRACE level logs for org.jboss.security on that instance and get the logs after attempting access to your application? By the way, are you sure, you have placed the jboss-web.xml in .war/WEB-INF/ folder? Can you post the output of:

           

          jar -tf yourwar.war

          • 2. Re: JBoss7.1.1.Final Security port to Wildfly 8.2.Final
            lafr

            The https-listener is started?

            os-ifx.[mbi2in]/mbi/tools/jboss/8.10/standalone/log. grep listening *                                                         

            04.01. 06:01:07,772 INFO  [org.wildfly.extension.undertow#startListening] JBAS017519: Undertow HTTP listener http listening on /0.0.0.0:8580

            04.01. 06:01:09,709 INFO  [org.wildfly.extension.undertow#startListening] JBAS017519: Undertow HTTPS listener https listening on /0.0.0.0:8943

            04.01. 06:01:38,653 INFO  [org.jboss.as#logAdminConsole] JBAS015961: Http management interface listening on http://0.0.0.0:10490/management

            04.01. 06:01:38,654 INFO  [org.jboss.as#logAdminConsole] JBAS015951: Admin console listening on http://0.0.0.0:10490

            On which IP-Address? Also only on 127.0.0.1? Then access over 10.0.0.202:8443 will not be possible.

            • 3. Re: JBoss7.1.1.Final Security port to Wildfly 8.2.Final
              pmm

              Manuel Schatzl wrote:

               

              jboss-web.xml:

              1. <?xml version="1.0" encoding="UTF-8"?> 
              2. <jboss-web> 
              3.     <security-domain>my_auth</security-domain> 
              4.     <valve> 
              5.         <class-name>com.test.server_wildfly.security.CustomAuthenticator</class-name> 
              6.     </valve> 
              7. </jboss-web> 

               

              AFAIK valves are no longer supported since they were a Tomcat/JBoss Web feature. In WildFly you'd have to use an Undertow Servlet Extension.

              1 of 1 people found this helpful
              • 4. Re: JBoss7.1.1.Final Security port to Wildfly 8.2.Final
                ctomc

                You can also use http-handlers instead of valves both can be configured in jboss-web.xml

                 

                But that is no longer used for authentication, you need to write AuthenticationMechanism

                see http://undertow.io/documentation/servlet/security.html and http://undertow.io/documentation/core/security.html for more

                1 of 1 people found this helpful
                • 5. Re: Re: JBoss7.1.1.Final Security port to Wildfly 8.2.Final
                  axis123
                          <interface name="public">
                              <any-ipv4-address/>
                          </interface>
                  
                  

                   

                  ^-- i think in the standalone this should do the job. i can use my service if i turn off my authentiction. anyway thanks for the reply!

                   

                  and thanks guys i will have a look and @the AuthenticationMechanism

                   

                  if i found a solution i will post everything related to it in this post!