<chapter id="admin.auth">
    <title>Authentication</title>

    <para>MantisBT supports several authentication techniques out of the box.  In addition, there is work in progress relating to supporting authentication plug-ins.  Once authentication plug-ins are implemented, then authentication against any protocol or repository of user names and passwords can be done without having to touch MantisBT core code.</para>

    <para>Although MantisBT supports multiple authentication techniques, it is important to note that MantisBT doesn't yet support hybrid authentication scenarios.  For example, internal staff authentications against LDAP where customer authentications against MantisBT database.</para>

    <section id="admin.auth.standard">
        <title>Standard Authentication</title>

        <para>Standard, or native, authentication is where MantisBT users are authenticated against user records in the MantisBT database.  The passwords are stored in the database in one of several formats:
            <itemizedlist>
                <listitem><para>CRYPT - deprecated.</para></listitem>
                <listitem><para>CRYPT_FULL_SALT - deprecated.</para></listitem>
                <listitem><para>PLAIN - deprecated.</para></listitem>
                <listitem><para>MD5 - This is default and recommended approach.  See <ulink url="http://en.wikipedia.org/wiki/MD5">MD5 topic on Wikipedia</ulink> for more details.</para></listitem>
            </itemizedlist>
        </para>

        <para>See $g_login_methods for more details about how to configure MantisBT to use one of the above authentication techniques.</para>
    </section>

    <section id="admin.auth.http">
        <title>HTTP_AUTH</title>

        <para>When MantisBT is configured to use basic auth, it automatically detects the logged in user and checks if they are already registered in MantisBT, if not, then a new account is automatically created for the username.</para>
    </section>

    <section id="admin.auth.basic">
        <title>BASIC_AUTH</title>

        <para>TODO</para>
    </section>

    <section id="admin.auth.ldap">
        <title>LDAP</title>

        <para>Functionality is provided by using the php-ldap module
            (/usr/lib/php4/ldap.so). An extra login method is defined within
            core/user_API.php inside of function is_password_match $f_username,
            $p_test_password, $p_password ).This has a simple, non encrypted
            (yet) test of the LDAP directory for that user by asking for an
            entry with uid=username and password=test_password, if this exists,
            it is presumed that the user should be granted access.</para>
            <formalpara>
                <title>Configuration basics</title>
                <para>the LDIF format that was tested is as follows:
                    <programlisting>dn: uid=tests,
                        dc=test, dc=com, dc=au
                        department: testdep
                        organizationname: Testing Organization
                        cn: Test Smith
                        assignedgroup: users
                        givename: Test
                        sn: Smith
                        mail: tests@example.com.au
                        uid: testsuser
                        Password: password
                        objectclass: testPerson
                    </programlisting>

                    The password may be in clear, taken
                    from the /etc/passwd or /etc/shadow file, or simply encrypted and
                    added using current LDAP tools.There are some specialized software
                    for replicating passwd to LDAP and inversely (eg.
                    <ulink url="http://freshmeat.net/projects/cpu/">http://freshmeat.net/projects/cpu/</ulink>
                    ).
                </para>
            </formalpara>

            <para>Also setup the LDAP parameters explained in the
                <link linkend="admin.config.auth">Authentication</link>
                section. Don't forget to change your $g_login_method to
                LDAP.
            </para>

            <formalpara>
                <title>Creating new accounts</title><para>There is still a bit of problem when you
                    want to create a new user to MantisBT using LDAP, you must create the
                    LDIF entry to LDAP, and also sign up for a new account, if both of
                    these line up correctly, authentication will proceed.  Email
                    is queried from the LDAP database if the
                    authentication is set to use LDAP instead of the user record in the
                    database entry.</para>
            </formalpara>

        </section>

        <section id="admin.auth.msad">
            <title>Microsoft Active Directory</title>

            <para>TODO</para>
        </section>
</chapter>
