6 Replies Latest reply on Apr 10, 2006 5:50 PM by phillip pollard

    VB.NET Client and JBoss

    phillip pollard Newbie

      I have a Java web service running under JBoss 4.0.3SP1. I have method level security in the web service, and i am trying to make calls to it using a vb.net client. I am using the UsersRolesLoginModule. I cannot get it to pass any type of credentials to the web service, so my service cannot authenticate the client. I always get the value of the "unauthenticatedIdentity" that i set in the login-config.xml.

      Any ideas on what i need to do to pass this information to the web service?


        • 1. Re: VB.NET Client and JBoss
          Anil Saldanha Master

          In the server.xml of your tomcat sar in jboss, look for the following block:

           <!-- Add this option to the connector to avoid problems with
           .NET clients that don't implement HTTP/1.1 correctly
           restrictedUserAgents="^.*MS Web Services Client Protocol 1.1.4322.*$"

          That should give you some pointers.

          • 2. Re: VB.NET Client and JBoss
            phillip pollard Newbie

            Adding that to the connector didn't seem to change anything.

            • 3. Re: VB.NET Client and JBoss
              phillip pollard Newbie

              Here's my connector:

              <Connector port="8080" address="${jboss.bind.address}"
               maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true"
               restrictedUserAgents="^.*MS Web Services Client Protocol 1.1.4322.*$" />

              Here's a snippet of the vb.net code:

              Dim cred As New System.Net.NetworkCredential
               cred.UserName = "user"
               cred.Password = "password"
               Dim objReq As New secTest.getValue
               Dim objResp As New secTest.getValueResponse
               Dim service As New secTest.HelloSettings
               service.PreAuthenticate = True
               service.Credentials = cred
               objResp = service.getValue(objReq)

              • 5. Re: VB.NET Client and JBoss
                phillip pollard Newbie

                After turning on the server side debugging, here is what i got:

                2006-04-10 13:08:54,101 TRACE [org.jboss.security.auth.spi.UsersRolesLoginModule] Saw unauthenticatedIdentity=guest
                2006-04-10 13:08:54,111 TRACE [org.jboss.security.auth.spi.UsersRolesLoginModule] findResource: null
                2006-04-10 13:08:54,162 TRACE [org.jboss.security.auth.spi.UsersRolesLoginModule] Properties file=file:/C:/jboss-4.0.3SP1/server/AuthTest/conf/props/auth-users.properties, defaults=null
                2006-04-10 13:08:54,162 DEBUG [org.jboss.security.auth.spi.UsersRolesLoginModule] Loaded properties, users=[guest, phil]
                2006-04-10 13:08:54,162 TRACE [org.jboss.security.auth.spi.UsersRolesLoginModule] findResource: null
                2006-04-10 13:08:54,172 TRACE [org.jboss.security.auth.spi.UsersRolesLoginModule] Properties file=file:/C:/jboss-4.0.3SP1/server/AuthTest/conf/props/auth-roles.properties, defaults=null
                2006-04-10 13:08:54,172 DEBUG [org.jboss.security.auth.spi.UsersRolesLoginModule] Loaded properties, users=[guest, phil]
                2006-04-10 13:08:54,172 TRACE [org.jboss.security.auth.spi.UsersRolesLoginModule] login
                2006-04-10 13:08:54,172 TRACE [org.jboss.security.auth.spi.UsersRolesLoginModule] Authenticating as unauthenticatedIdentity=guest
                2006-04-10 13:08:54,172 TRACE [org.jboss.security.auth.spi.UsersRolesLoginModule] User 'guest' authenticated, loginOk=true
                2006-04-10 13:08:54,172 TRACE [org.jboss.security.auth.spi.UsersRolesLoginModule] commit, loginOk=true
                2006-04-10 13:08:54,242 DEBUG [org.jboss.webservice.handler.HandlerChainBaseImpl] Enter: doHandleRequest
                2006-04-10 13:08:54,242 DEBUG [org.jboss.webservice.handler.HandlerChainBaseImpl] Exit: doHandleRequest with status: true

                My username in the .net code (phil) appears to be getting through to JBoss. It is in the users array. But it is not using that as the user making the call. It is using the 'guest' user. How do i make it use the username that is making the call instead of the unauthenticatedIdentity?

                • 6. Re: VB.NET Client and JBoss
                  phillip pollard Newbie

                  OK. I've switched to a Java Client to make sure that the problem was on the .NET side. However, i still get the same result. In my java client, i have the following:

                  Stub stub = (Stub) endPoint;
                   stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, URL);
                   String response = endPoint.getValue();

                  And in my web service, i have:
                  if (mysc.isCallerInRole("TheRoleICheck")) {
                   System.out.println("After 1");
                   return "Is in role";
                   else {
                   System.out.println("After 2");
                   return "Not in role";

                  I always get whats in the else statement. Am i trying to authenticate my java client correctly? I'm sure that the username i pass in my client is in that role in my properties file.