Unified Login Integration Tips

Integrating Third Party .Net website with iMIS through Unified Login

My organization wants me to application forms to our website and secure them with iMIS authentication.  We decided to integrate through unified login so we could use iMIS public view for Events Registration and account creation to avoid reinventing the wheel.

This however requires that I identify users detail after login.

First step was to implement the login control.  Folliowing the Unified Login descriptions from ASI I was able to reference the imis login control and pass a ReturnURL to send users back to my application after login.

According to the documentation,  the login control will set a cookie with user information  - and it does,  but in practice,  the login control only sets the UserID,  it's other imisPublic pages that populate the rest of the cookie with Name, email, etc.  I discovered there is code in the public.master page that usees the UserID from the login control to get user data for the cookie - so I had to replciate this functionality in my own application in order to have the necessary user data for my form.

As it turns out,  the UserID set in the cookie is the encrypted Name.ID field for a user. Because it's encrypted,  it's not directly usable, so I had to figure out how to decrypt it using ASI CCRypto class.

there's also a Secure.dll class that provides the same Encrypt and decrypt functions,  but I found it easier to use CCrypto because of the other references required.

Before we start,  you will need to add references to several DLLs,  specifically:

ASi.Dll

Asi.iBO.dll

Asi.ContentManagerNet.dll

Asi.Lexicon.dll

BAEBusiness.dll

CDataAccess.dll

If you use the Secure() class isntead of CCrypto,  add Secure.dll to your references

iBO CCrypto documentation:

http://www.imiscommunity.com/imiscommunity/docs/ibonet/api/html/T_Asi_iB...

ASI Encryption documentation

http://www.imiscommunity.com/web_cc_encryption_and_password_hashing

 

First you need to initialize the System - standard iBo stuff here:

ConfigurationManager.ConnectionStrings["iMIS"].ConnectionString.ToString();

Asi.iBO.iboAdmin.InitializeSystem(connectionString);

Then you have to instantiate the CCrypto class

            Asi.iBO.CCrypto crypt = new CCrypto();

Now lets get the UserId from the cookie

HttpCookie myCookie = Request.Cookies["UserID"];

Now you can decrypt the userID with the CCrypto object

string myID = crypt.Decrypt(myCookie.Value);

 

anyone have a different or better approach?