Creating a Session from a Custom Login Page

This scenario illustrates how to create a custom External Security Module (ESM) that performs all of the work required to authenticate the user and create or validate a session. It uses a custom log-in page, custom code to collect and process all required data, and custom code to create and manage sessions.

 

This customization is useful when you want the log-in page to have a distinct "look and feel" that reflects your specific business requirements or environment or when you need greater flexibility— for what information is gathered, what operations take place, how sessions are handled, and how log-in credentials are used for authentication.

 

Note: With greater flexibility comes greater responsibility. You must provide the code to process the log-in information and perform the authentication and session creation operations that MicroStrategy Web normally takes care of by default.

 

For help in understanding how to perform this customization, the following information is provided for you:

 

 

Prerequisites for this authentication customization use case

The work-flow for this custom authentication scenario assumes that there is no existing session for the user making the request and that you have done the following:
 

 

Instructions for creating the custom External Security Module with the Web Customization Editor

This customization can be accomplished using either of the following methods:

 

 

 

Deploying the plug-in provided with MicroStrategy SDK
 

MicroStrategy SDK provides a plug-in (ZIP file) that can simply be extracted to the plugins folder to view the customization in MicroStrategy Web. The following steps guide you in locating the plug-in and deploying it.

 

  1. Access the plug-in: JSP version.

 

  1. Extract the plug-in to the plugins subfolder inside the MicroStrategy Web installation folder.
     

  2. Launch MicroStrategy Web to view the customization.
     

Note: Refer to Applying customization changes to the application for instructions on specific settings that affect whether the customization changes are applied automatically or a restart of the Web server is required.

 

 

Using the Web Customization Editor to create a plug-in

 

MicroStrategy SDK provides a Web Customization Editor that can be used to create a customization plug-in that performs your ESM customization. The following steps guide you in creating the plug-in and deploying it.

 

  1. Launch the Web Customization Editor.
     

  2. Create a new plug-in and give it a meaningful name, such as  CreatingSessionCustomLogin.
     

  3. Exit the Web Customization Editor.
     

  4. Create a custom Java class that extends AbstractExternalSecurity, which implements the ExternalSecurity interface. Package it in com.microstrategy.sdk.samples.externalsecurity. This custom class must include code to import the necessary MicroStrategy runtime libraries and override the handlesAuthenticationRequest and getCustomLoginURL methods, as explained below.

 

 

For this scenario, a sample file— called CustSessionCreation.java is available in the plug-in provided by MicroStrategy SDK. You can use this sample class to see the results of this specific customization and as a model for how to create your own custom class. See Code Explanation for Custom Session Creation Scenario for a detailed explanation of how to write the code required in the custom ESM class.

 

Compile and save CustSessionCreation.class, with the proper package folder structure, under the plugins/CreatingSessionCustomLogin/WEB-INF/classes folder in the MicroStrategy Web installation directory.

 

Note: If you used a different plug-in name from the one suggested in this scenario, the path referenced above should reflect your plug-in name.

 

  1. Create a custom login page that collects credentials, creates a session, and determines the appropriate start page to display for users who are successfully logged in, based on user group.

    For this scenario, a sample login page— called CustSessionLoginPage.jsp is available inside the jsp folder of the plug-in provided by MicroStrategy SDK. You can use this sample page to see the results of this specific customization and as a model for how to create your own custom page. See Code Explanation for Custom Session Creation Scenario for a detailed explanation of how to write the code required in the custom login page.

    Save CustSessionLoginPage.jsp under the plugins/CreatingSessionCustomLogin/jsp folder in the MicroStrategy Web installation directory.

 

Note: If you used a different plug-in name from the one suggested in this scenario, the path referenced above should reflect your plug-in name.

 

  1. If the Web Customization Editor is closed, launch it again and access your plug-in.
     

  2. Click on MicroStrategy Web Configuration inside the Application Settings view to expand the hierarchical tree. The expanded list comprises the different settings that can be modified to perform customizations.
     

  3. Expand Web Configuration Settings and double-click MicroStrategy Configuration Settings.
     

  4. Click the Application Settings tab at the bottom of the page. For the entry in the External Security Class field under Application Settings, browse to the custom External Security class you saved in step 4 above.
     

  5. Save your changes.
     

  6. Launch MicroStrategy Web to view the customization.

 

The next time that you open MicroStrategy Web, the application uses your custom External Security class, instead of the default class.

 

Note: Refer to Applying customization changes to the application for instructions on specific settings that affect whether the customization changes are applied automatically or a restart of the Web server is required.

 

Testing this authentication customization use case

Once you have met the prerequisites and performed the steps listed above, you are ready to test its functioning.

 

  1. Open MicroStrategy Web in a Web browser.
     

  2. Click the link for a project. For example, click the link for MicroStrategy Tutorial. The custom log-in page should be displayed.
     

  3. Log in with valid MicroStrategy user credentials. A session should be successfully created, and you should be able to access the project. you selected.

 

Work-flow for this authentication customization use case

The steps below explain what is happening as the custom ESM attempts to authenticate a user and create a session.

 

  1. A user makes a request for a MicroStrategy Web page from a Web client, and MicroStrategy Web determines that the page requires authentication and that a valid session does not exist for the user.
     

Note:  MicroStrategy Web always checks first to see if there is an existing session. If it is still valid, there is no need to authenticate the user again and processing continues. The following steps are only performed if the user needs to be authenticated— that is, the first time the user logs in or when an existing session has been closed or timed out.

 

  1. MicroStrategy Web creates an instance of the ExternalSecurity class specified in microstrategy.xml, calls the handlesAuthenticationRequest method on this class, and passes in  NO_SESSION_FOUND to the method, which returns USE_CUSTOM_LOGIN_PAGE.
     

  2. USE_CUSTOM_LOGIN_PAGE invokes the getCustomLoginURL method.
     

  3. The getCustomLoginURL() method returns the URL of a custom log-in page.
     

  4. The user enters the requested information on the custom log-in page and submits it.
     

  5. If the user submits the correct credentials information, the custom login page creates a user session on Intelligence Server, and places the session state in the URL using the usrSmgr parameter. Since a valid session state is passed to MicroStrategy Web, the user is given permission to access the Desktop page.