CSUser via cookie authentication using encryption service

CSUser via cookie authentication using encryption service

This question has suggested answer(s)

Hi there,

I'm working at Precedent and recently we just tarted to test your Telligent Suite which comes with latest hotfix for 7.1 version.

However I've experienced several issues:

1) Using your encryptions service, when cookie value has a space character, your system throws an exception:

"Exception Details: System.FormatException: Invalid length for a Base-64 char array or string."

Taking into account that when we include roles values, you mention in your documentation to always include “Everyone” and “Registered Users” roles, however “Registered Users” role contains space character and your system just couldn’t accept it and throws the exception described above.

You are also mentioning it there - telligent.com/.../1049685.aspx

2) If user is already registered through cookie authentication, profile is never update if we make changes in cookies value, for instance we added a new role and Telligent didn’t update profile, unless you delete a profile and it will be created again once values read from cookie.

3) Currently your system only reads 3 attributes from cookie, and they are: username, emailAddress, and roles, the other fields which are configurable in your Telligent, they are not updated when passed via cookie, for instance “name”, “title”, “department”.

In regards the 1st clause I assume you have an issue in your code, when you are trying to decrypt encrypted values.

I've already implemented a service, which relies on your SymmetricEncryptor and SymmetricDecryptor class, deriving from Telligent.Evolution.SecurityModules assembly.

So before decrypting a value, you should convert a string to byte[] array:

_decryptor.Decrypt(Convert.FromBase64String(encryptedText))

Hope this helps to fix your issue.

Thank you,

Regards,

Sergejs Kravcenko.

All Replies
  • CookieAuthTest.aspx

    1. I've successfully used role names with spaces when creating an encrypted SSO cookie.  Since you said it's specifically related to a space, the first thing that comes to mind here is that you may not be URL encoding the cookie values correctly, or you may be doing so in the wrong order - e.g. perhaps you base64 encoded before you encrypted, or your urlencoded before you base64 encoded.  Look at the attached sample page for how the cookie should be generated.
    2. Values from the SSO cookie only get updated once X days, wehre X is the value set in the profileRefreshInterval attribute.  By default this is once every 7 days.
    3. Honestly, if you want other profile fields, you're better off using another approach   The problem with using the SSO cookie for these values is that the fields only get updated when a user logs in to a community.  Let's say the SSO cookie was used to sync the department field, and  John Smith has visited the community once, and after that moves from the Development department to the Services department.  After the move,  his profile values in Telligent will still say John is in the Development department until he next logs in.  In these cases, custom widgets pulling data directly from your external source, or a background task which updates profile attributes through the REST API tends to have better results.

  • Hi Alex,

    Thanks for quick response and for this exact file CookieAuthTest.aspx, why you have old files of CookieAuthTest.aspx in your download section? I couldn't find this exact latest file anywhere in your download section.

  • Hi Alex,

    for clause 1 I've managed to get it working.

    For clause 3 other fields are not updated, for instant I'm inserting values into cookie for "title" field, when users is created this field is still empty in Telligent.

    Do I need to apply any hotfix patch?

  • Sorry if I wasn't clear in my response on 3.  We don't support updating profile fields via the SSO cookie for the reasons stated above.  You should look at another process such as mentioned above.

  • I have provided a code sample to Sergejs on how he can manually update those fields at an interval he chooses.

  • Care to share that code as I'm looking at how to modify the profile based on having custom cookie fields as well as why the displayname isn't showing if in the cookie