Intellicus Enterprise Reporting and Business Insights 19.0

SSO for Host Application on .Net Platform

0 views June 28, 2020 0

Configurations Required

Configuring Host Application

In order to invoke methods at Intellicus end, the file intellicaSSO.dll needs to be placed in host application’s library.

This dll will be provided with intellicus setup.

Path for dll file: <Install_Path>APIsSingleSignOnDotNet

Note:For Intellicus version earlier than 4.1, this file can be requested to Intellicus Support.

Host application needs to set Intellicus web application URL.

Configuring Intellicus

Intellicus application contains Integration.xml file for integration and dynamic user creation activities.

  • In Integration.xml, set business parameters required to pass (If any)
  • Set CREATE_USER for Dynamic User creation in Intellicus.

This xml file contains the information regarding integration like user role, dynamic category creation etc.

Path for Integration.xml:

<Intellicus_Install_path>JakartawebappsintellicusWEB-INF

Note: Host application needs to give details in xml according to their requirements.

Corresponding to this integration xml file content, createUser() method in ReportControllerDetails.JSP at the Intellicus end should be defined.

Sample Integration xml and Controller jsp are provided with the Intellicus Setup.

Note: For Intellicus version earlier than 4.1, ReportController.jsp,ReportController.Detail.jsp,LaunchPortal.jsp  can be requested to Intellicus Support and should be placed at  <Intellicus_install_path>Jakartawebappsintellicus.

Implementation for Single Sign-On Request

Implementation code can be written inside any aspx of Host application.

  1. Host application needs to add intellicaSSO.dll in their application.
  2. Host application needs to import namespace Intellicus.Integration.SingleSignOn using Intellicus.Integration.SingleSignOn;

Make an object of SingleSignOn class for invoking the methods of this class.

Make an object of UserInfo class and set the user credentials using the setter methods provided by UserInfo class.

Constructor

public UserInfo()

Constructor

public UserInfo(String userId, String orgId)

Parameters:

userId : User Id of the logged in user

orgId : Organization id of the logged in user

Set this userInfo object to UserInfo property of SingleSignOn class.

singleSignOn.UserInfo = userInfo;

Set the IntellicusUrl.  Intellicus url can be read from property file.

If host application wants to set some hidden parameters, then invoke the setHiddenParameter (String paramName, String paramValue) for each hidden parameter.

These parameters can be read from property/xml file.

Method:

This method puts the hidden parameter into the hashmap for hidden parameters.

public void setHiddenParameter(String paramName,String paramValue)

Parameters:

paramName:  Name of the business parameter.

paramValue: Value of the business parameter.

Note: This method would be called before calling, the getIntellicusToken method. User can not change/update the parameters set through this method. If these parameters need to be changed,then host application need to request intellicusToken again in order to consider new value for these parameters.

Check for the Intellicus Token availability in session. If it’s not available in session then call the getIntellicusToken () method of SingleSignOn class.

Method:

This method calls Intellicus API and passes the user credentials and other hidden parameters to Intellicus. It throws SingleSignOnException.

public String getIntellicusToken()

Returns:

TokenString:  Received token from Intellicus

If host application gets the token from Intellicus, then it redirects the request to Intellicus redirectionAPI with token.

Host Application can set the name of intellicusRedirectionAPI. Its default value is “LaunchPortal.jsp”.

Property:

This property sets the name of Intellicus JSP to which request is redirected.

public String IntellicusRedirectionAPI

{

get { return intellicusRedirectionAPI; }

set { intellicusRedirectionAPI = value; }

}

IntellicusRedirectionAPI:  Name of the jsp at Intellicus end to which host application wants to redirect the request after user authentication

If host application wants to set some other business parameters, then invoke the setBusinessParameter (String paramName, String paramValue) for each such parameter.

These parameters can be read from property, xml file.

Method:

This method puts the business parameter into the hashmap for request parameters.

public void setBusinessParameter(String paramName,String paramValue)

Parameters:

paramName: Name of the request parameter

paramValue: value of the request parameter.

Note: This method would be called before calling, the redirectToIntellicus method. Parameters set in this method can be updated without requesting new token.

After setting the name of the redirectionAPI, invoke the method for redirecting the request to Intellicus.

Method:

This method sets the name of Intellicus jsp to which request is redirected. It throws SingleSignOnException.

public void redirectToIntellicus(String onSuccess,String intellicusToken)

Parameters:

onSuccess:  Name of the requested Intellicus API.

intellicusToken: Token received from Intellicus after user authentication.

response: It is the HttpServletResponse object. It is used for redirecting a request.

If host application does not get the token from intellicus i.e. if user authentication fails at Intellicus end, then host application can show their error page or error message based on the status message returned by the Intellicus.

If logout action is invoked at Host application end, then logout action should also be invoked at the Intellicus end.

Call the method logoutFromIntellicus() method of SingleSignOn class to invalidate the session at Intellicus end.

Method:

This method puts the business parameter into the hashmap for business parameters.

public void logoutFromIntellicus()

Property:

This property sets the secure param to encrypt password string passed in request.

public static String IdenV

{

set { idenV = value; }

}
Parameters:

idenV: Values of param should be same as mentioned in ReportClient.properties file for IDEN_V property.

Note: This method would be called only in case if IDEN_V property value changed in ReportClient.properties file.

Property:

This property sets the secure param to encrypt password string passed in request.

public static String IdenK

{

set { idenK = value; }

}
Parameters:

idenK: Values of param should be same as mentioned in ReportClient.properties file for IDEN_K property.

Note: This method would be called only in case if IDEN_K property value changed in ReportClient.properties file.

Getter/Setter property for each UserInfo attributes
  1. Get/Set the User id

 

public string UserId

{

get { return userId; }

set { userId = value; }

}

  1. Get/Set the User Password.

public string Password

{

get { return password; }

set { password = value; }

}

  1. Get/Set the User’s Organization id

public string Organization

{

get { return orgID; }

set { orgID = value; }

}

  1. Get/Set the User’s status (ACTIVE / SUSPENDED).

public string Status

{

get { return status; }

set { status = value; }

}

  1. Get/Set the user to Super Admin (“true”/”false”).

public bool IsSuperAdmin

{

get { return isSuperAdmin; }

set { isSuperAdmin = value; }

}

  1. Get/Set the user to Admin(“true”/”false”).

public bool IsAdmin

{

get { return isAdmin; }

set { isAdmin = value; }

}

  1. Get/Set role Id’s belonging to that user.

public string RoleIds

{

get { return roleIds; }

set { roleIds = value; }

}

  1. Get/Set role User’s Description.

public string Description

{

get { return description; }

set { description = value; }

}

  1. Get/Set the session id.

public string SessionId

{

get { return sessionId; }

set { sessionId = value; }

}

  1. Get/Set Security Descriptor.

public string SecurityDescriptor

{

get { return securityDescriptor; }

set { securityDescriptor = value; }

}

  1. Get/Set customer Id.

public string CustomerId

{

get { return customerId; }

set { customerId = value; }

}

  1. Get/Set location.

public string Location

{

get { return location; }

set { location = value; }

}

  1. Get/Set locale.

public string Locale

{

get { return locale; }

set { locale = value; }

}

  1. Get/Set database name.

public string DBName

{

get { return dbName; }

set { dbName = value; }

}

  1. Get/Set TimeStamp.

public long TimeStamp

{

get { return longTimeStamp; }

set { longTimeStamp = value; }

}

Note: Please refer IntellicusSSOEnduserRequest.aspx for end user request sample code.

Path: <Install_Path>SampleCodesSingleSignOnDotNet

 

Note: Please refer IntellicusSSOLogout.aspx for logout sample code.

Path: <Install_Path>SampleCodesSingleSignOnDotNet

Optional Settings

Controller API

Integrating with Intellicus, Controller API at Intellicus end can be given any suitable name.

So in order to call the Intellicus controller API, host application can set the name of controller API by setter property provided by intellicaSSO.dll

Its default name is: ReportController.jsp and ReportControllerDetail.jsp

Property:

This property gets/sets the name of Intellicus jsp to which request is redirected.

 

public String IntellicusControllerAPI

{

get { return intellicusControllerAPI; }

set { intellicusControllerAPI = value; }

}

IntellicusControllerAPI:  Name of the jsp at Intellicus which performs controlling activities for Intellicus.

This controller API is placed at:

<Intellicus_Install_path>Jakartawebappsintellicus

Redirection API

It is the API available at Intellicus end to which request is redirected to from Host application to Intellicus.

Its default name is: LaunchPortal.jsp

Property:

This property gets/sets the name of Intellicus jsp to which request is redirected.

public String IntellicusRedirectionAPI

{

get { return intellicusRedirectionAPI; }

set { intellicusRedirectionAPI = value; }

}

IntellicusRedirectionAPI:  Name of the jsp at Intellicus end to which host application wants to redirect the request after user authentication

This redirection API is placed at:

<Intellicus_Install_path>Jakartawebappsintellicus

lbMode

This variable specifies, whether to take reporting request to Load balancer or to specify Intellicus web server.

Its default value is: false

Property:

This property gets/sets the lbMode as true or false.

public bool LbMode

{

get { return lbMode; }

set { lbMode = value; }

}

lbRelativePath

This variable specifies the relative path for Load balancer. It is accessed only when lbMode is true.

Its default value is : /LoadBlancerServlet

Property:

This property gets/sets the lbRelativePath.

public String LbRelativePath

{

get { return lbRelativePath; }

set { lbRelativePath = value; }

}

LbRelativePath: String for relative path

intellicusExternalURL

Intellicus application would be accessed by Host web server (Internal IP) for getting the IntellicusToken.

But an End User can Access the Host application from some outer network.  As host application need to redirect the request for Intellicus HTTP APIs from browser, an External IP for Intellicus web application need to be specified.

intellicusExternalURL:This variable specifies the external URL for Intellicus web application.

Method:

This method is to set the External URL for Intellicus.

public String IntellicusExternalURL

{

get { return intellicusExternalURL; }

set { intellicusExternalURL = value; }

}
Parameters:

intellicusExternalURL:  String for external URL.

Sample Code for Single Sign-On request:

String intellicusToken = null;
String hostAppUserid = null;            
String hostAppOrgId = null;
SingleSignOn singleSignOn = new SingleSignOn(); 
try
{

#region Creating UserInfo
     
     //Set the credentials for logged-in user for End -user 
     //requests.
     // user password is not required, if the authentication mode 
     //for organization is "Host Application."
     //These credentials can be fetched from the data structure 
     //maintained for the selected user.
     
        if (Session["userId"] != null)
          hostAppUserid = Session["userId"].ToString();
        if (Session["orgId"] != null)
          hostAppOrgId = Session["orgId"].ToString();
     
     //set the credentials for the user to be   
     // activated/deleted/suspended/modified
                
        UserInfo userInfo =new UserInfo();
        userInfo.UserId = hostAppUserid;
        userInfo.OrgID =  hostAppOrgId;
        singleSignOn.UserInfo = userInfo

#endregion
   
#region Create AdminInfo

	   //Set user credentials for admin user.
     //Admin user credentials are required if some request for  
     //admin activity is raised.
     //Admin activities are like User Management, Database 
     //connection creation/modification etc.
     //These can be read from any property file or from 
     //repository/database.

   //This value can be read from any prperty file or database.
     String intellicusAdminUserId = "Admin";
 //This value can be read from any prperty file or database.	     
 String intellicusAdminOrgId = "Intellica”;
 //This value can be read from any prperty file or database.
     String intellicusAdminPassword = "Admin";	

	   UserInfo adminUserInfo =new UserInfo();
     adminUserInfo.UserId = intellicusAdminUserId;
     adminUserInfo.OrgID = intellicusAdminOrgId;
     adminUserInfo.Password = intellicusAdminPassword;

     SingleSignOn.AdminUserInfo = adminUserInfo;

#endregion

#region Get/Set Intellicus Path and Parameters
		
   //Set the path for Intellicus Web application
   //This can be read from any property file or from     
   //repository/database.
    singleSignOn.IntellicusURL= "http://192.168.33.165/intellicusvss";
	 
   //Set the business parameters/hidden parameters that need to   
   //be passed to Intellicus
   //This can be read from any property file or from 
   //repository/database.
   //These parameters should be mentioned in Integration xml.
   //parameter name mentioned here should be same as parameter  
   //name mentioned in Integration xml.

singleSignOn.setHiddenParameter("p_CompanyOID","Ultra Sports 5");
singleSignOn.setHiddenParameter("prmCategoryName",  "cat1");
singleSignOn. setHiddenParameter ("REPORT_CONN_NAME", "ReportDB");

   //get the url for requested Intellicus API like 
   //Report listing /Dashboards/User preferences/Query Object     
   //list etc.

String onSuccess = "./core/CategoryList.jsp";

#endregion



#region Act Based on Token Availability
                
  //Check for the availability of Intellicus token in session.
  //If it is not found in session, it means user is first time  
  //giving request to intellicus.
  //So Call the Intellicus methods to get the Token from 
  //Intellicus.
  //This token is sent by Host Application for the further 
  //interaction with intellicus.
  //If token is found in session,then it means,user has already  
  //taken token from intellicus.
  //So,no need to get the token again from Intellicus.User can 
  //use the same token which he has.

  //if token not found in Session
  if (Session["intellicusToken"] == null)
  {
    //if user is not available at Intellicus end,
    // it will create the user dynamically and assign the    
    //role to that user.
    // these roles should have entry in Integration xml.
    singleSignOn.setHiddenParameter("USER_ROLES", "Admin");
    //this method returns a intellicus token string ,if 
    //user authentication is done successfully.
    intellicusToken = singleSignOn.getIntellicusToken();
    //if user is authenticated by Intellicus
    //then only call the Intellicus redirectionAPI 
    //else show the error status message 
    if (singleSignOn.IsUserAuthenticated)
    {
     Session["intellicusToken"] = intellicusToken;
     singleSignOn.redirectToIntellicus(onSuccess, 
     intellicusToken);
    }
    else
    {
    string userAuthMsg = singleSignOn.UserAuthenticationMessage;
      if(userAuthMsg.Equals(
             Enums.ResponseMessages.AUTHENTICATION_FAILED))
      {
        Response.Write("Invalid Login name or Password 
        OR Invalid Host web server IP");
      }
      else if(userAuthMsg.Equals(
      Enums.ResponseMessages.COULD_NOT_CONNECT_TO_REPORT_SERVER))
      {
         Response.Write("Report Server is Down");
      }
       else if(userAuthMsg.Equals(
              Enums.ResponseMessages.REPOSITORY_DB_IS_DOWN))
       {
           Response.Write("Repository Database Connection 
           is Down");
       }
       else
       {
           Response.Write(userAuthMsg);
       }
   }

 }
 else// if token found in session
 {
  
singleSignOn.redirectToIntellicus(onSuccess,intellicusToken);
 }
#endregion

}
catch(SingleSignOnException ex)
{
    Response.Write(ex.Message);
}
catch (Exception exc)
{
    Response.Write(exc.Message);;
}