About Question enthuware.ocejws.v6.2.320 :

Moderators: Site Manager, fjwalraven

Post Reply
himaiMinh
Posts: 358
Joined: Fri Nov 29, 2013 8:26 pm
Contact:

About Question enthuware.ocejws.v6.2.320 :

Post by himaiMinh »

For the sake of discussion, if the JAX-RS resource is deployed as a servlet, we can still use @RolesAllowed annotation. Here is an example from chapter 15 Security of Jersey user guide:

Code: Select all

@Path("/")
@PermitAll
public class Resource {
    @RolesAllowed("user")
    @GET
    public String get() { return "GET"; }
 
    @RolesAllowed("admin")
    @POST
    public String post(String content) { return content; }
 
    @Path("sub")
    public SubResource getSubResource() {
        return new SubResource();
    }
}

himaiMinh
Posts: 358
Joined: Fri Nov 29, 2013 8:26 pm
Contact:

Re: About Question enthuware.ocejws.v6.2.320 :

Post by himaiMinh »

Let me fix my previous post.
After some research from the web sites (http://docs.oracle.com/html/E13981_01/servsecr004.htm and http://pic.dhe.ibm.com/infocenter/wasin ... tions.html),
there are some security annotations defined for EJB and some other annotations defined for servlet.
For example,
@DeclareRole is for Servlet 2.5 or above and EJB 3
@PermitAll, @RolesAllowed and @DenyAll are for EJB 3
@ServletSecurity is for Servlet 3.0
eg. @ServletSecurity (httpMethodConstraint= {@HttpMethodConstraint (value="GET", rolesAllowed="All Role")})

As I can tell, @RolesAllowed cannot be used in JAX-RS deployed as a servlet.

fjwalraven
Posts: 429
Joined: Tue Jul 24, 2012 2:43 am
Contact:

Re: About Question enthuware.ocejws.v6.2.320 :

Post by fjwalraven »

Correct.

Post Reply

Who is online

Users browsing this forum: No registered users and 25 guests