MicroStrategy ONE

Displaying Different Login Pages based on Project

This scenario illustrates how to create a custom External Security Module (ESM) that uses different login pages based on the project selected by the user. To accomplish this, you must create both a custom ESM and a custom login page. This customization is useful when you want the login page to have a different "look and feel" or collect different information based on the project that is selected.

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: 

  • Specified (as a user with administrative privileges) to "Show all the projects connected to the Web Server before the user logs in" instead of "Login, then show the projects accessible by the supplied login".:

    If you do not make the correct choice and specify that users must login before choosing the project, this scenario will not work correctly.

  • Created a custom error page, if desired, to be used if a failure occurs.

  • Created and compiled a custom ExternalSecurity java class that includes code to determine the currently selected project and to invoke a custom login page rather than the default login page for specific projects.

  • Created a custom login page that includes code to gather and pass the user credentials and any other necessary information and to create a session on Intelligence Server.

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

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

  3. Launch MicroStrategy Web to view the customization.

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  DisplayingDiffLoginPages

  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.:

    • Override the handlesAuthenticationRequest method so that it returns USE_CUSTOM_LOGIN_PAGE.

    • Override the getCustomLoginURL method so that it returns the URL of a custom login page. (This custom login page collects user credentials, creates a session, determines the group to which the user belongs, redirects to the appropriate start page, and puts the session and other necessary information in the URL.)

    For this scenario, a sample file— called DiffLoginPages.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 Different Login Pages Scenario for a detailed explanation of how to write the code required in the custom ESM class.:

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

    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.

  5. 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 DiffLoginPagesCustLoginPage.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 Different Login Pages Scenario for a detailed explanation of how to write the code required in the custom login page.:

    Save DiffLoginPagesLoginPage.jsp under the plugins/DisplayingDiffLoginPages/jsp folder in the MicroStrategy Web installation directory.:

    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.

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

  7. 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. 

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

  9. 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.

  10. Save your changes. 

  11. 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.

: For specific settings that affect whether customization changes are applied automatically or require a restart of the Web server, see Applying customization changes to the application.

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 and click the link for MicroStrategy Tutorial. The custom login page should be displayed.

  2. Log in with valid MicroStrategy user credentials. A session should be created and you should be able to access the MicroStrategy Tutorial project.

  3. Now, close MicroStrategy Web and reopen it, choosing any other project than MicroStrategy Tutorial. This time the default login page should be displayed.

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.

    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.  

  2. MicroStrategy Web creates an instance of the ExternalSecurity class specified in microstrategy.xml, calls the handlesAuthenticationRequest method on this class, and pass in  NO_SESSION_FOUND to the method. 

  3. The  method checks to see whether the currently selected project is the MicroStrategy Tutorial. If so, it returns USE_CUSTOM_LOGIN_PAGE; otherwise, it returns USE_MSTR_DEFAULT_LOGIN. 

  4. If USE_MSTR_DEFAULT_LOGIN was returned, default processing continues. If USE_CUSTOM_LOGIN_PAGE was returned, it invokes the getCustomLoginURL method. 

  5. The getCustomLoginURL method returns the URL of a custom log-in page. 

    • If an empty string or NULL is returned, the getFailureURL method is invoked. 

    • If the URL returned is bad, HTTP Status Code 404 is returned from the Web server. 

    • If the URL returned is good, the application redirects the user to the custom log-in page, which can be internal or  external to MicroStrategy Web. 

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

  7. 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 project.