Use Moss SSO to achieve single-point login to Mantis

Source: Internet
Author: User

I recently received a task. Implement single-point login between the company's internal office platform (based on SharePoint 2007, Windows Integrated Identity Authentication) and mantis Bug Management System (based on PHP and MySQL databases, open source, form authentication. Originally, Mantis is an open-source project. You can modify its authentication method. Someone on the Internet also introduced the experience of using LDAP in PHP. Unfortunately, I do not understand PHP, only ASP. net, so the solution is to use moss SSO. First, in this section, I will configure the SSO Using Moss, in the following section, I will introduce how to obtain the Mantis username and password stored in SSO and simulate post submission.
Start the Microsoft Single Sign-On service. By default, the service is not started.

Right-click Service-properties, click logon on the top tab, select "this account", and enter the Administrator's username and password,

Click "general" on the tab, change the Startup Type to "automatic", and start the service. You may be prompted that the new account must be valid after the computer is restarted.

Next we will configure the SSO of moss. Go to Management Center-operation, click "manage Single login Settings" at the bottom of security configuration, and click "Manage Server Settings" in server settings ", in the "Single login Administrator Account" and "Enterprise Application"ProgramEnter our administrator account and password in "define Administrator Account". Other default settings are available,

After confirming, return to the operation interface. In enterprise application definition settings, click "manage enterprise application definition Settings" and click "Create Project ", enter a proper name in the display name and Application name. This application name is used when the second part reads the username and password stored in SSO, here I fill in mantis, and then fill in the contact email address. In the Account type, we select an individual. You can take a closer look at the introduction on the left. Click OK to return. Go to operation again-manage a single logon interface. In enterprise application definition settings, click "manage enterprise application defined account information" and select the corresponding enterprise application, in the user account name, enter the corresponding domain account and click Settings. In the user name and password, log on to the user name and password of the third-party system respectively, and click OK, you can continue to set the correspondence between the domain account and the username and password of a third-party system, or click Finish.
In this way, the creation and configuration of single-point login have been completed. Then, you need to obtain the usernames and passwords stored in the SSO database and use them for post submission and login. The idea is this: Create An ASPX page in moss and rewrite the page_load event of the page. Maybe you will say that the server side cannot be used in the moss page.CodeFor more information, see my other two posts: Add background code to the moss page (1) add background code to the moss page in two ways ),

In the page_load event, there are only a few lines of code, according to the current login domain account to obtain the third-party system form authentication username and password (here I am Mantis ), in the username and password input boxes assigned to the ASPX page, these two are hidden, and then in the Windows onload event, execute the form submission operation on the ASPX page. Previously, some OWA's webpart access to the mailbox is actually the same idea. We all know that the OWA webpart provided by Moss is basically useless.
Let's proceed step by step. First, create An ASPX page to simulate post submission. Use the designer to open the moss site. During the test, I directly created this page under the root path of the site, three namespaces need to be referenced. We will write the following at the top of the ASPX page:
<% @ Page Language = "C #" codePage = "936" %>
<% @ Import namespace = "Microsoft. SharePoint" %>
<% @ Import namespace = "Microsoft. Sharepoint. Portal" %>
<% @ Import namespace = "Microsoft. Sharepoint. Portal. singlesignon" %>
The first line of codePage = "936" is an encoding format problem. I need it when I post it to Mantis. It is not necessarily necessary for you. After the reference, we can write the page_load event. This code is written by a buddy on the Internet and can be used directly:
<SCRIPT type = "text/C #" runat = "server">
Protected void page_load (Object sender, eventargs E)
{
Intptr pusername = intptr. zero;
Intptr ppassword = intptr. zero;
Issoprovider isso = ssoproviderfactory. getssoprovider ();
Ssocredentials mycreds = isso. getcredentials ("mantis"); // The name of the application mentioned in the first part. I am Mantis.
Pusername = system. runtime. interopservices. Marshal. securestringtobstr (mycreds. username );
String username = system. runtime. interopservices. Marshal. ptrtostringbstr (pusername );
Ppassword = system. runtime. interopservices. Marshal. securestringtobstr (mycreds. Password );
String Password = system. runtime. interopservices. Marshal. ptrtostringbstr (ppassword );
This. username. value = username;
This. Password. value = password;
}
</SCRIPT>
Here, username and password are two server-side controls on our page. below is the form we built for simulated submission:
<Form action = "address to post" method = "Post" name = "login page form name" AutoComplete = "off">
<Input type = "hidden" name = "return" value = "post address">
<Input name = "username" runat = "server" id = "username" type = "hidden">
<Input name = "password" runat = "server" id = "password" type = "hidden">
</Form>
Of course, you may not know where to post a third-party system. We need to use an Internet Plug-In httpwatch to analyze it. Click the plug-in record. When we log on again, we will see the post address we need,

the first line is the post address, and the second line is the address to be transferred after successful login. What we need is the two addresses.
next, let's look at the source file on the page and find the form name and the two text boxes that enter the user name and password. In mantis, they are login_form, username, and password, use these three names to name the controls on the page respectively.
here, we have completed obtaining the username and password in mantis based on the currently logged-in domain account and assigned the value to the page. Now, we only need to do this in windows. when onload is used, the page is submitted.
below form, let's write:

after this is done, when the login domain user opens the page above, the page will automatically find the corresponding mantis user name and password, and automatically post for login, so as to skip the Mantis login interface. In this way, we use moss SSO to implement Single-point logon to Mantis.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.