Thursday, July 05, 2007

Experience with Mantis; HTTP Basic Authentication, Single sign-on with Subversion

I recently downloaded and installed Mantis 1.1.0a3 (Linux platform) and configured HTTP server (Apache) to use basic authentication for accessing mantis directory. Inside mantis, as admin user, created one user with MD5 login.

To support single sign-on with subversion, HTTP Authentication for mantis login is one possibility. Below is the list of desired/expected results from mantis with HTTP Basic authentication.

There may be an overhead with HTTP Authentication, as each request for resource from server will be challenged by the HTTP server and the browser will have to provide the necessary authentication credentials each time before retrieving this resource.

Requirements:

  • To access mantis directory, the user (username) will be authenticated against a password file by the web-server (HTTP Basic Authentication).
  • Once authenticated, get the username that requested for mantis resources (files).
  • If the user is already created inside mantis, just login with this username without checking against stored password.
  • If the user does not exist, create a new user with this username, and login with the new username. Ignore the password.
  • Use some other mechanism to change the common HTTP Basic password.

Mantis provides two configuration options to support HTTP Basic Authentication, BASIC_AUTH & HTTP_AUTH.

1. BASIC_AUTH: Inside config_inc.php file, set $g_login_method to BASIC_AUTH. If the Auth Forms in the browser is cleared, trying to access mantis will pop up the HTTP login menu. Enter the username (an account for this username already exists in mantis) and password as defined inside the HTTP password file. If this login is successful, the mantis page will be shown, but in this case it still shows the default mantis login page instead of directly going to the requested page for the logged-in user. Entering the username of any existing valid account in this login page will take the user to the requested page with original user logged-in.

2. HTTP_AUTH: Change $g_login_method to HTTP_AUTH. For an existing user account inside mantis, once the HTTP server authenticates the user, the user will be logged-in and this will take the user to the correct page, skipping the default mantis login page. But the user password is verified against the password stored in the mantis database; this seems to work, if the password is stored as plain text. This is not the desired behavior. Once the user is authenticated by the HTTP server, mantis does not need to do any more password check. With HTTP_AUTH, mantis directly generates the HTTP login menu in case of a login failure. For non-existing mantis users, it gives an Invalid email error whereas the expected behavior is to create an account for this user in mantis.

To make BASIC_AUTH work as desired, make the following changes:

login_page.php


Add the following lines after line 40,

if ( BASIC_AUTH == config_get( 'login_method' ) ) {
$t_uri = "login.php";
print_header_redirect( $t_uri );
exit;
}

login.php


Towards the end of this file, for auth_attempt_login failure case, add the following,

// avoid a continuous loop, in case of failure
if ( BASIC_AUTH == config_get( 'login_method' ) ) {
auth_http_prompt();
exit;
}

core/authentication_api.php


Add the following inside function auth_does_password_match after LDAP check,

//if BASIC_AUTH, just ignore the password
if ( BASIC_AUTH == $t_configured_login_method ) {
return true;
}

Inside function auth_attempt_login, modify lines after config_get( 'login_method' ) as,

if ( BASIC_AUTH == $t_login_method ) {
# attempt to create the user if using BASIC_AUTH
if ( false === $t_user_id ) {
$t_cookie_string = user_create( $p_username, $p_password );
}
................
}

To avoid Invalid email error for new users, add the following configurations inside config_inc.php,

config_inc.php


       $g_enable_email_notification    = OFF;
$g_validate_email = OFF;

With the above modifications my requirements are met and mantis seems to work as expected. I am not sure whether these modifications will affect any other functionalities of mantis. If you face any problems, please give your comments here.

Saturday, June 09, 2007

Jesus the only way?

how can jesus be the only way?, Australian Christian Channel: Good questions and answers that are not convincing.

Sunday, May 27, 2007

danieldrezner.com :: Daniel W. Drezner :: Regarding India

danieldrezner.com :: Daniel W. Drezner :: Regarding India: "explaining the ramifications of the surprising Indian elections for India's economic development and relations with Pakistan."

Tuesday, May 08, 2007

I was at the Spencer Tunick installation, Selfridges, London

taking part in the Spencer Tunick
installation at Selfridges in London, it involved getting naked along
with 500 other people and becoming part of a series of four
installation art pieces which Spencer Tunick then photographed.

Tuesday, April 10, 2007

Wednesday, February 28, 2007

SnoopStick From CYBERsitter

SnoopStick From CYBERsitter: "SnoopStick is a USB flash drive type device that allows you to monitor your PC from anywhere"

Friday, February 16, 2007

Kerala Sambar � My Treasure…My Pleasure

Kerala Sambar � My Treasure…My Pleasure: "I don’t use any Sambar Masala.Instead i mix all the following powders and prepare my own sambar masala.

"

Friday, December 01, 2006

Tuesday, September 19, 2006

Welcome to I2P

Welcome to I2P: "2P is an anonymizing network, offering a simple layer that identity-sensitive applications can use to securely communicate. "

Wednesday, August 09, 2006

Greenius Ltd - GNU make tips

Greenius Ltd - GNU make tips: "The emphasis is on minimising the incremental build time for projects, and automating as much of the process as possible."

Monday, June 05, 2006

Vim for C Programmers | Linux Journal

Vim for C Programmers | Linux Journal: "From variable autocompletions all the way up to integration with ctags and make, Vim makes a C programmer's life easier and more productive."

Saturday, May 27, 2006

JavaScript: Press Release by Sun and Netscape

JavaScript: Press Release: While Java is used by programmers to create new objects and applets, JavaScript is designed for use by HTML page authors and enterprise application developers to dynamically script the behavior of objects running on either the client or the server. JavaScript is analogous to Visual Basic..

Friday, April 07, 2006

Aspect Ratio FAQ

Aspect Ratio FAQ: "many movies are matted or shot on Super 35mm film"

Friday, March 24, 2006

Chinese Cultural Learning Center

Chinese Cultural Learning Center: "this material is free to use"

Chinese Text Book

Chinese Text Book: "Learn Chinese for Continuous Course"