internal static SamlTokenData GetFromSecureCookie(string tokenKey) { try { HttpCookie secureCookie = CookieHelper.GetCookie(tokenKey); var samlXml = SamlHelpers.Unprotect(secureCookie.Value, typeof(SamlTokenData).Name); var samlTokenData = SamlHelpers.Deserialize <SamlTokenData>(samlXml); return(samlTokenData); } catch (Exception ex) { Apis.Get <IEventLog>().Write("Error Extracting SAML token from cookie:" + ex, new EventLogEntryWriteOptions { Category = "SAML", EventType = "Error", EventId = 1001 }); } return(null); }
internal static SamlTokenData GetTokenDataFromDatabase(string tokenKey) { try { var encryptedData = SqlData.GetTokenData(tokenKey); if (!string.IsNullOrEmpty(encryptedData)) { var samlXml = SamlHelpers.Unprotect(encryptedData, typeof(SamlTokenData).Name); var samlTokenData = SamlHelpers.Deserialize <SamlTokenData>(samlXml); return(samlTokenData); } } catch (Exception ex) { ApiEventLog.Write("Error Extracting SAML token from database:" + ex, new EventLogEntryWriteOptions() { Category = "SAML", EventType = "Error", EventId = 1001 }); } return(null); }