Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Local EJB security

User_R8ZABOct 2 2016 — edited Oct 2 2016

Hi,

I have RESTful web service

@Path("/education")

public class EducationRest {

   

    @EJB

    private EducationBean service;

   

    @GET

    @Path("/readAll")

    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})

    public List<EducationDTO> read() throws NamingException {

        return service.readAllEducations();

    }

...

and web.xml security constraints

...

<security-role>

    <role-name>admin</role-name>

</security-role>

<security-constraint>

    <web-resource-collection>

        <web-resource-name>Administrator permissions</web-resource-name>

        <url-pattern>/education/*</url-pattern>

    </web-resource-collection>

    <auth-constraint>

         <role-name>admin</role-name>

    </auth-constraint>

</security-constraint>

...

Do I have to specify security constraints again in the ejb-jar.xml for every local EJB or local beans can be unchecked(@PermitAll)?

@Stateless

public class EducationBean {

  ...

  public List<EducationDTO> readAllEducations(){

    ...

  }

}

...

<assembly-descriptor>

            <method-permission>

                <role-name>admin</role-name>

                <method>

                    <ejb-name>EducationBean</ejb-name>

                    <method-name>*</method-name>

                </method>

            </method-permission>

        </assembly-descriptor>

...

Thank you,

Dragan.

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Oct 30 2016
Added on Oct 2 2016
0 comments
440 views