Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    Autenticazione server tomcat

    Ciao ragazzi,
    sto testando la funzionalità di tomcat per quanto riguarda l'autenticazione lato server.
    In pratica sto provando a "proteggere" la servlet "docs" ( così come già avviene per il manager ).

    Ho cambiato il file web.xml nella cartella docs/WEB-INF in questo modo:

    Codice PHP:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!--
      Licensed to the Apache Software Foundation (ASF) under one or more
      contributor license agreements.  See the NOTICE file distributed with
      this work for additional information regarding copyright ownership.
      The ASF licenses this file to You under the Apache License, Version 2.0
      (the "License"); you may not use this file except in compliance with
      the License.  You may obtain a copy of the License at

          [url]http://www.apache.org/licenses/LICENSE-2.0[/url]

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
    -->
    <web-app xmlns="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee [url]http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd[/url]"
       version="2.5"> 

      <display-name>Tomcat Documentation</display-name>
      <description>
         Tomcat Documentation.
      </description>
        
          
      [b]
      <resource-env-ref>
        <description>
          Link to the UserDatabase instance from which we request lists of
          defined role names.  Typically, this will be connected to the global
          user database with a ResourceLink element in server.xml or the context
          configuration file for the Manager web application.
        </description>
        <resource-env-ref-name>users</resource-env-ref-name>
        <resource-env-ref-type>
          org.apache.catalina.UserDatabase
        </resource-env-ref-type>
      </resource-env-ref>

      
      <security-constraint>
        <web-resource-collection>
          <web-resource-name>HTMLManger and Manager command</web-resource-name>
          <url-pattern>/docs/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
           
           <role-name>manager</role-name>
        </auth-constraint>
      </security-constraint>

      
      <login-config>
        <auth-method>BASIC</auth-method>
        <realm-name>Tomcat Manager Application</realm-name>
      </login-config>

      
      <security-role>
        <description>
          The role that is required to log in to the Manager Application
        </description>
        <role-name>manager</role-name>
      </security-role>[/b]
      
    </web-app>
    Ma le pagine vengono visualizzate senza richiedere password.
    Cosa bisogna impostare ancora?

    Ciao

  2. #2
    Scusate ho già risolto...
    Bastava aggiungere:

    Codice PHP:
    <url-pattern>*.jsp</url-pattern>
    <
    url-pattern>*.html</url-pattern>
    <
    http-method>GET</http-method>
    <
    http-method>POST</http-method

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.