コード例 #1
0
        /// <summary>
        /// get the oauth access token for the user from OauthAccessTokenStorage.xml
        /// </summary>
        internal static void GetOauthAccessTokenForUser(string emailID, Page page)
        {
            string      path            = page.Server.MapPath("/") + @"OauthAccessTokenStorage.xml";
            string      searchUserXpath = "//record[@usermailid='" + emailID + "']";
            XmlDocument doc             = new XmlDocument();

            doc.Load(path);
            XmlNode record = doc.SelectSingleNode(searchUserXpath);

            if (record != null)
            {
                page.Session["realm"]      = record.Attributes["realmid"].Value;
                page.Session["dataSource"] = record.Attributes["dataSource"].Value;
                string secuirtyKey = ConfigurationManager.AppSettings["securityKey"];
                page.Session["accessToken"]       = CryptographyHelper.DecryptData(record.Attributes["encryptedaccesskey"].Value, secuirtyKey);
                page.Session["accessTokenSecret"] = CryptographyHelper.DecryptData(record.Attributes["encryptedaccesskeysecret"].Value, secuirtyKey);

                // Add flag to session which tells that accessToken is in session
                page.Session["Flag"] = true;
            }
        }