<?xml version="1.0" encoding="UTF-8"?>

<section version="5.0" xml:id="admin.mejbaccess" xml:lang="en"
         xmlns="http://docbook.org/ns/docbook"
         xmlns:xlink="http://www.w3.org/1999/xlink"
         xmlns:xi="http://www.w3.org/2001/XInclude"
         xmlns:svg="http://www.w3.org/2000/svg"
         xmlns:mml="http://www.w3.org/1998/Math/MathML"
         xmlns:html="http://www.w3.org/1999/xhtml"
         xmlns:db="http://docbook.org/ns/docbook">
   <info>
    <title>Access to the Management EJB Component</title>
    </info>
     <para>Access to the MEJB provided by the <xi:include
      href="../variables.xml" xpointer="element(j48ee)" /> distribution is now
      role secured. The client application that wants to access it must have
      one of the following roles:</para>

      <variablelist>
        <varlistentry>
          <term>mejb-user</term>

          <listitem>
            <para>for accessing to the read-only operation of the MEJB</para>
          </listitem>
        </varlistentry>

        <varlistentry>
          <term>mejb-admin</term>

          <listitem>
            <para>role allowing access for all operation of the MEJB</para>
          </listitem>
        </varlistentry>
      </variablelist>

      <para>Unauthorized access is forbidden</para>

      <para>This snippet includes all of the elements needed to specify
      security roles in the <filename>web.xml</filename> file of a web application client of
      MEJB</para>

      <para><programlisting>   &lt;security-constraint&gt;
   &lt;web-resource-collection&gt;
     &lt;web-resource-name&gt;Protected Area&lt;/web-resource-name&gt;
     &lt;!-- Define the context-relative URL(s) to be protected --&gt;
     &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
     &lt;!-- If you list http methods, only those methods are protected --&gt;
     &lt;http-method&gt;DELETE&lt;/http-method&gt;
     &lt;http-method&gt;GET&lt;/http-method&gt;
     &lt;http-method&gt;POST&lt;/http-method&gt;
     &lt;http-method&gt;PUT&lt;/http-method&gt;
   &lt;/web-resource-collection&gt;
   &lt;auth-constraint&gt;
     &lt;!-- Anyone with one of the listed roles may access this area --&gt;
     &lt;role-name&gt;mejb-admin&lt;/role-name&gt;
   &lt;/auth-constraint&gt;
 &lt;/security-constraint&gt;

 &lt;!-- Default login configuration uses BASIC authentication --&gt;
 &lt;login-config&gt;
   &lt;auth-method&gt;BASIC&lt;/auth-method&gt;
   &lt;realm-name&gt;JOnAS Realm&lt;/realm-name&gt;
 &lt;/login-config&gt;

 &lt;!-- Security roles referenced by this web application --&gt;
 &lt;security-role&gt;
   &lt;role-name&gt;mejb-admin&lt;/role-name&gt;
 &lt;/security-role&gt; </programlisting></para>

</section>
