Proteger arquivos em diretório no JBoss

Procedimento para bloquear acesso direto via URL a arquivos com extensão .xml e um arquivo .pdf no jboss

Adicione as entradas dentro da TAG do arquivo web.xml da aplicação

vi /jboss/server/<app>/conf/web.xml 
<security-role>
   <description>Area restrita.</description>
   <role-name>privillegedUsers</role-name>
</security-role>

<security-constraint>
   <web-resource-collection>
      <web-resource-name>Restricted</web-resource-name>
      <url-pattern>*.xml</url-pattern>
      <url-pattern>/arquivo.pdf</url-pattern>
   </web-resource-collection>
<auth-constraint>

<role-name>privillegedUsers</role-name>
   </auth-constraint>
</security-constraint>

<login-config>
   <auth-method>BASIC</auth-method>
   <realm-name>Acesso Restrito</realm-name>
</login-config>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s