/*
 * Copyright 2006-2007 Queplix Corp.
 *
 * Licensed under the Queplix Public License, Version 1.1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.queplix.com/solutions/commercial-open-source/queplix-public-license/
 *
 * 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.
 *
 */

package com.queplix.core.modules.security.www;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
 * @author [AZ] Andrei Zudin
 * @author [DTG] Dimiter Georgiev
 */

public class ActiveDirectoryLoginModule {

    /**
     * Checks the user password.
     *
     * @param request  HTTP request to use
     * @param response HTTP response
     * @return next url
     * @throws com.queplix.core.integrator.security.SecurityException
     *
     * @throws ServletException
     */
    protected String doCheckUserPassword(HttpServletRequest request,
                                         HttpServletResponse response)
            throws com.queplix.core.integrator.security.SecurityException,
            ServletException {
        throw new IllegalStateException("Obsolete security system. ");
        // Initialization.
        /*WebLoginManager.newHttpSession( request );
        boolean isCustomer = WebLoginManager.isCustomerRequest( request );
        String s = request.getParameter( FORM_LOGIN );
        String loginName = null;
        if( !StringHelper.isEmpty( s ) ) {
            loginName = s;
        }

        // Store user name in session.
        WebLoginManager.pushLoginName( request, loginName );

        // Get password plaintext.
        s = request.getParameter( FORM_PASSWORD );
        String password = "";
        if( !StringHelper.isEmpty( s ) ) {
            password = s;
        }

        try {
            ActiveDirectoryLoginCheck.authenticate(loginName, password);
        } catch (Throwable ex) {
            ex.printStackTrace(System.out);
            throw new BadNameOrPasswordException();
        }
        password = null;
        s = null;

        // Get user data and store it in session
        User user;

        user = SecurityManager.login(
            loginName,
            EmployeeUser.ID,
            false,
            null);

        WebLoginManager.pushUser( request, user );

        // Ok.
        return null;
*/
    }

}
