1 Reply Latest reply on Jun 10, 2010 4:05 AM by Stefano Ficcadenti

    WS Authentication with postgre sql DB

    Stefano Ficcadenti Newbie

      I'm trying to implement ws security authentication on a Web Service deployed on JBoss 5.1


      Username, password and roles are stored in a Postgre sql database (Tables: Users(username,password), UserRoles(username,roles)).


      So I start with a simple Web Service and it's client without any security.

      Then I insert on login-config.xml the follow entry:


      <application-policy name="TestSecurity">
            <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule"
              <module-option name="dsJndiName">java:/TestWSSecurityDS</module-option>
              <module-option name="principalsQuery">select passwd from "public"."Users" where username = ? </module-option>
              <module-option name="rolesQuery">select userroles AS Roles from "public"."UserRoles" where username = ?  </module-option>


      On Web Service web.xml:


               <web-resource-name> TestWs </web-resource-name>


      On Web Service jboss-web.xml


      <?xml version="1.0" encoding="UTF-8"?>


      On client I use BindingProvider to set username and password of an admin user.


      But when I run the client it don't work and throw: com.sun.xml.ws.client.ClientTransportException: request requires HTTP authentication: Unauthorized


      Why ? Where is the problem ?