Debian Codegraph @

doc/sources/admin/applications/tomcat.rst

raw
1 Apache Tomcat
2 =============
3
4 |image0|
5
6
7 .. attention::
8
9 The Tomcat Valve is only available for tomcat 5.5 or
10 greater.
11
12 Presentation
13 ------------
14
15 `Apache Tomcat <http://tomcat.apache.org/>`__ is an open source software
16 implementation of the Java Servlet and JavaServer Pages technologies.
17
18 As J2EE servlet container, Tomcat provides standard security feature,
19 like authentication: the application deployed in Tomcat can delegate its
20 authentication to Tomcat.
21
22 By default, Tomcat provides a file called ``users.xml`` to manage
23 authentication:
24
25 .. code-block:: xml
26
27 <?xml version='1.0' encoding='utf-8'?>
28 <tomcat-users>
29 <role rolename="tomcat"/>
30 <role rolename="role1"/>
31 <user username="tomcat" password="tomcat" roles="tomcat"/>
32 <user username="role1" password="tomcat" roles="role1"/>
33 <user username="both" password="tomcat" roles="tomcat,role1"/>
34 </tomcat-users>
35
36
37 LL::NG provides a valve that will check an HTTP header to set the authenticated user on
38 the J2EE container.
39
40 Compilation
41 -----------
42
43 The sources are available at `<https://github.com/LemonLDAPNG/lemonldap-valve-tomcat>`__
44
45 Required :
46
47 - ant
48 - jre > 1.4
49 - tomcat >= 5.5
50
51 Configure your tomcat home in ``build.properties`` files.
52
53
54 .. attention::
55
56 Be careful for Windows user, path must contains "/".
57 Example:
58
59 ::
60
61 c:/my hardisk/tomcat/
62
63
64
65 Next run ant command:
66
67 ::
68
69 ant
70
71 ``ValveLemonLDAPNG.jar`` is created under ``/dist`` directory.
72
73 .. |image0| image:: /applications/tomcat_logo.png
74 :class: align-center
75
76
77 Installation
78 ------------
79
80 Copy ``ValveLemonLDAPNG.jar`` in ``<TOMCAT_HOME>/server/lib``:
81
82 ::
83
84 cp ValveLemonLDAPNG.jar server/lib/
85
86
87 .. tip::
88
89 If needed, you can
90 :doc:`recompile the valve from the sources<>`.
91
92 Configuration
93 -------------
94
95 Add on your ``server.xml`` file a new valve entry like this (in host
96 section):
97
98 .. code-block:: xml
99
100 <Valve className="org.lemonLDAPNG.SSOValve" userKey="AUTH-USER" roleKey="AUTH-ROLE" roleSeparator="," allows="127.0.0.1"/>
101
102 Configure attributes:
103
104 - **userKey**: key in the HTTP header containing user login.
105 - **roleKey**: key in the HTTP header containing roles. If LL::NG send
106 some roles split by some commas, configure **roleSeparator**.
107 - **roleSeparator** (optional): role values separator.
108 - **allows** (optional): Define allowed remote IP (use "," separator
109 for multiple IP). Just set the LL::NG Handler IP on this attribute in
110 order to add more security. If this attribute is missed all hosts are
111 allowed.
112 - **passThrough** (optional): Allow anonymous access or not. When it
113 takes "false", HTTP headers have to be sent by LL::NG to make
114 authentication. So, if the user is not recognized or HTTP headers not
115 present, a 403 error is sent.
116
117
118 .. tip::
119
120 For debugging, this valve can print some helpful information
121 in debug level. See `how configure logging in
122 Tomcat <http://tomcat.apache.org/tomcat-5.5-doc/logging.html>`__ .
123