Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 900100 (JBPAPP6-482)

Summary: Unexpected failures in authentication tests for WS - incorrect roles annotation processing
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Rostislav Svoboda <rsvoboda>
Component: Web ServicesAssignee: Rostislav Svoboda <rsvoboda>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: ropalka
Target Milestone: ---   
Target Release: EAP 6.0.0   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jira.jboss.org/jira/browse/JBPAPP6-482
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-04-12 12:52:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
TEST-org.jboss.as.test.integration.ws.authentication.EJBEndpointAuthenticationTestCase.xml none

Description Rostislav Svoboda 2012-03-27 13:44:24 UTC
project_key: JBPAPP6

I'm working on authentication tests for WS (EJB endpoint for now) and I met some quite tricky behavior. 

Users in correct roles are not allowed to invoke methods, method with annotation @PermitAll can't be invoked and so on. I tried to move '@RolesAllowed("Role1")' from class level to method level but it didn't help. For example test accessHelloWithValidUser is passing nicely when there are no method level annotations in endpoint implementation but it started to fail when I added '@RolesAllowed("Role2")' to helloForRole method.

I think it's a bug but I can't decide if it's EJB or WS related. Please investigate failures in EJBEndpointAuthenticationTestCase or give me some clue what should be broken.

Tests - https://github.com/rsvoboda/jboss-as/commit/e731057fcf1ea819b5b8ad2d5a5a1c887a9ad328
Tested with latest AS7 build - bb233e7a5f391a1a50e1ff621eaa13d1c9fc1d1f  (JBPAPP-8451 - instance-id setting messes up mod cluster)

Comment 1 Rostislav Svoboda 2012-03-27 13:45:20 UTC
Attachment: Added: TEST-org.jboss.as.test.integration.ws.authentication.EJBEndpointAuthenticationTestCase.xml


Comment 2 Richard Opalka 2012-03-28 14:17:01 UTC
There are three issues remaining in your tests:
ad1) Don't reuse serviceName & targetNamespace in your tests,
otherwise you will be facing CXF client side caching issues again
ad2) Rewrite your assertions to catch proper exception message
(iow all these lines {code}Assert.assertTrue("HTTPException '403: Forbidden' was expected" ...{code} are wrong assertions)
ad3) Update your test to use @DeclareRoles in order to work properly
{code}
 [supernova][/home/opalka/git/jboss-as]>git diff testsuite
 diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ws/authentication/EJBEndpoint.java b/testsuite/integration/basic/src/test/java/org/jboss/a
 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ws/authentication/EJBEndpoint.java
 +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ws/authentication/EJBEndpoint.java
 @@ -23,6 +23,7 @@ package org.jboss.as.test.integration.ws.authentication;
  import javax.annotation.security.DenyAll;
  import javax.annotation.security.PermitAll;
 +import javax.annotation.security.DeclareRoles;
  import javax.annotation.security.RolesAllowed;
  import javax.ejb.Stateless;
  import javax.jws.WebService;
 @@ -50,6 +51,7 @@ import org.jboss.ws.api.annotation.WebContext;
  )
  @Stateless
  @SecurityDomain("ejb3-tests")
 +@DeclareRoles({"Role1", "Role2", "Role3"})
 @RolesAllowed("Role1")
 public class EJBEndpoint implements EndpointIface ...
{code}

Comment 3 Richard Opalka 2012-03-28 14:20:12 UTC
Pull request sent: https://github.com/jbossas/jboss-as/pull/1912

Comment 4 Rostislav Svoboda 2012-03-29 09:12:24 UTC
It's passing after applying patch and suggested test modification.

Comment 5 Rostislav Svoboda 2012-04-12 12:52:59 UTC
Verified on EAP 6.0.0 ER5

Comment 6 Alessio Soldano 2012-10-18 16:33:01 UTC
Link: Added: This issue relates to AS7-5784


Comment 7 Anne-Louise Tangring 2012-11-05 17:23:31 UTC
Docs QE Status: Removed: NEW