JBoss Community

Re: JBoss not honoring @PermitAll on EJB3 Endpoint

created by abhi0123 in JBoss Web Services - View the full discussion

Richard Opalka wrote:

 

Have a look to the followin tests:

 

jboss-as/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ws/authentication

 

The Git repo is: http://github.com/jbossas/jboss-as

I did and the commit demonstrates the exact same problem I pointed out. The test case is passing security credentials even for a @PermitAll method and you shouldn't need any.

 

 


public class EJBEndpoint implements EJBEndpointIface {

    public String hello(String input) {
        return "Hello " + input + "!";
    }
    
    @PermitAll
    public String helloForAll(String input) {
        return "Hello " + input + "!";
    }
}

 

 

 


@Test
    public void accessHelloForAllWithValidRole1() throws Exception {
        URL wsdlURL = new URL(baseUrl, "/jaxws-authentication-ejb3/EJB3AuthService?wsdl");

        Service service = Service.create(wsdlURL, serviceName);
        EJBEndpointIface proxy = service.getPort(EJBEndpointIface.class);

        Map<String, Object> reqContext = ((BindingProvider) proxy).getRequestContext();
        reqContext.put(BindingProvider.USERNAME_PROPERTY, "user1");
        reqContext.put(BindingProvider.PASSWORD_PROPERTY, "password1");

        final String result = proxy.helloForAll("World");
        Assert.assertEquals("Hello World!", result);
    }

 

Reply to this message by going to Community

Start a new discussion in JBoss Web Services at Community