internal IList<string> VerifyGroups(string connectionId, string groupsToken)
{
if (String.IsNullOrEmpty(groupsToken))
{
return ListHelper<string>.Empty;
}
string unprotectedGroupsToken = null;
try
{
unprotectedGroupsToken = ProtectedData.Unprotect(groupsToken, Purposes.Groups);
}
catch (Exception ex)
{
Logger.LogInformation(String.Format("Failed to process groupsToken {0}: {1}", groupsToken, ex));
}
if (String.IsNullOrEmpty(unprotectedGroupsToken))
{
return ListHelper<string>.Empty;
}
var tokens = unprotectedGroupsToken.Split(SplitChars, 2);
string groupConnectionId = tokens[0];
string groupsValue = tokens.Length > 1 ? tokens[1] : String.Empty;
if (!String.Equals(groupConnectionId, connectionId, StringComparison.OrdinalIgnoreCase))
{
return ListHelper<string>.Empty;
}
return JsonSerializer.Parse<string[]>(groupsValue);
}