WorkflowGen supports Single Sign On integration with a tier application. Two main technical solutions are possible:
-
Form authentication (see the Setup: Authentication: SSO integration by using form authentication topic for more information)
-
Custom HTTP module
The advantage of the custom HTTP module solution is that it secures all WorkflowGen HTTP requests, including web services. It also provides more customization possibilities than the form authentication-based solution.
This article focuses on the custom authentication module solution.
Note: We recommend securing the WorkflowGen website with SSL and using encryption to secure the token. The code provided below is a basic sample, so you may have to customize it to enforce security and hide detailed error messages.
WorkflowGen Custom module authentication configuration
-
Configure WorkflowGen to use Custom authentication module.
i. Download CustomAuthModuleSSO.zip and unzip it.
ii. Open the
CustomAuthModuleSSO.csproj
file located in theVS Project
folder and build the solution.iii. Copy the
CustomAuthModuleSSO.dll
file into the following folders:-
\wfgen\bin
-
\wfgen\ws\bin
-
\wfgen\wfapps\webapp\eformaspx\bin
-
\wfgen\wfapps\webforms\bin
-
All other
..\bin
folders under\wfgen
-
-
In IIS, change the Authentication configuration. Enable
Anonymous
on all IIS applications in the WorkflowGen website:-
\wfgen
-
\wfgen\ws
-
\wfgen\wfapps\webforms
-
\wfgen\wfapps\webapps\eformaspx
-
\wfgen\wfapps\webapps
-
All other web applications you use in your processes
Note: The subfolders in the
\wfgen\wfapps\webservices
folder must use basic authentication. -
-
Create a Visual Studio project to edit the
CustomAuthModuleSSO.cs
file. In the Authentication function, change the following variables according to your tier app:-
Cookie or Url param name where the username is base64 encoded or encrypted:
string tokenName="token";
-
Your tier app Login URL to use when an authentication is required:
string ssoLoginUrl="/remotesso.aspx";
-
The encryption key used to decrypt the token:
string privateKey="mykey";
-
Activate encryption (
true
) or use base64 encoding (false
):bool decryptUsername=false;
-
Tier application configuration
-
Call WorkflowGen with the token. Your tier app has to encode (or encrypt) the username.
-
Put the encoded username into a cookie (set to a parent domain), a URL parameter (the token value has to be URL encoded) or an HTTP header (for web service calls).
-
If a cookie:
http://www.yourwfgwebsite.yourdomain.com/wfgen
-
If a URL parameter:
http://www.yourwfgwebsite.yourdomain.com/wfgen/?token=........
-
-
If you have to call WorkflowGen web services, you must add an HTTP header with the token value.
-
Manage the authentication request from WorkflowGen.
-
WorkflowGen calls your tier app login URL when authentication is required (session timeout, sign out, direct access to WorkflowGen).
-
WorkflowGen adds the
ReturnUrl
parameter to the URL. You must resend it to the login URL you use to call WorkflowGen following authentication.
Examples
-
WorkflowGen calls your tier app login:
http://www.yourwebsite.youdomain.com/yourlogin?ReturnUrl=%2fwfgen%2fshow.aspx%3fQUERY%3dCONTEXT
-
Your tier app login calls WorkflowGen login URL:
http://www.yourwfgwebsite.youdomain.com/wfgen/loginsso.aspx?token=YXJuYXVk&ReturnUrl=%2fwfgen%2fshow.aspx%3fQUERY%3dCONTEXT
-
-
Manage the sign out request done by the tier app to log out the user in WorkflowGen.
-
Your tier app login calls WorkflowGen login URL with the
signout=true
querystring parameter
http://www.yourwfgwebsite.youdomain.com/wfgen/loginsso.aspx?signout=true
-
You can customize the
loginsso.aspx
source to manage the redirection the way you want in this case.
-
Encryption Method
The example provided supports base64 encoding or encryption. For the encryption option, loginsso.aspx
uses 3DES mode ECB with MD5 to hash the private key by default. You can customize the loginsso.aspx
code according to your requirements.
PHP code example
$key = 'mykey';
$string = 'string to be encrypted';
$encrypted = base64_encode(mcrypt_encrypt(MCRYPT_3DES, md5($key), $string, MCRYPT_MODE_ECB);