0 Replies Latest reply on Jan 29, 2018 4:03 AM by ajoysinha

    Role based access of JAX-WS Web Services in JBOSS

    ajoysinha

      Hi,

       

      Need your urgent help.

       

      I am stuck with implementation of role based security for web service in JBoss 7.

       

      I have successfully implemented authentication with below approach.

       

       

      *****************************TestService.java******************************************************

       

      @Stateless
      @Interceptors(SpringBeanAutowiringInterceptor.class)
      @WebService
      ( 
      serviceName = "TestService",
      portName = "TestServicePortType",
      wsdlLocation = "WEB-INF/wsdl/TestService.wsdl",
      endpointInterface = "com.test.ava.TestService",
      targetNamespace = "http://xyz.abc.com"
      )
      
      

       

      @EndpointConfig(configFile = "WEB-INF/jaxws-endpoint-config.xml", configName = "Custom WS-Security Endpoint")
      public class TestService implements REMMessageWsi {

      **************************************************************************************************

       

       

      Added

      @EndpointConfig(configFile = "WEB-INF/jaxws-endpoint-config.xml", configName = "Custom WS-Security Endpoint")

       

       

      **************jaxws-endpoint-config.xml*************************************************************

       

       

      Custom WS-Security Endpoint
      
      ws-security.callback-handler
      com.test.ava.UsernamePasswordCallback
      
      
      
      

       

      **************************************************************************************************

      ****************************UsernamePasswordCallback.java****************************************

      public class UsernamePasswordCallback implements CallbackHandler {
      public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
      WSPasswordCallback pc = (WSPasswordCallback) callbacks[0];
      if ("test".equals(pc.getIdentifier())) {
      pc.setPassword("test");
      }
      }
      }

      **************************************************************************************************

       

       

      Now i am trying to implement role based authentication by extending this implementation using jbosss server users and roles property files. Please help.

       

       

      29 JAN : Please let me know if you have any guidance for me ..

       

      Ajoy