Ejemplo n.º 1
0
 //added by Joe Audette
 public WindowsLiveMessenger(WindowsLiveLogin liveLogin)
 {
     this.windowsLiveLogin = liveLogin;
 }
Ejemplo n.º 2
0
 public WindowsLiveMessenger()
 {
     this.windowsLiveLogin = new WindowsLiveLogin(true);
 }
Ejemplo n.º 3
0
        public static WindowsLiveLogin GetWindowsLiveLogin()
        {
            if (!WebConfigSettings.EnableWindowsLiveAuthentication) { return null; }

            string WindowsLiveSecurityAlgorithm = "wsignin1.0";
            bool forceDelAuthNonProvisioned = true;
            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();
            if (siteSettings == null) { return null; }

            string siteRoot = SiteUtils.GetNavigationSiteRoot();
            string privacyPolicyUrl;
            if (siteSettings.PrivacyPolicyUrl.StartsWith("http"))
            {
                privacyPolicyUrl = siteSettings.PrivacyPolicyUrl;
            }
            else
            {
                privacyPolicyUrl = siteRoot + siteSettings.PrivacyPolicyUrl;
            }

            string returnUrl = siteRoot + "/Secure/WindowsLiveAuthHandler.aspx";
            string appId = siteSettings.WindowsLiveAppId;
            string appKey = siteSettings.WindowsLiveKey;

            if (SiteUtils.SslIsAvailable())
            {
                if (returnUrl.StartsWith("http://"))
                {
                    returnUrl = returnUrl.Replace("http://", "https://");
                }
            }

            // I use this forthe demo site since I let people log in admin but don't want them to change the setting in siteSettigns
            if (ConfigurationManager.AppSettings["GlobalWindowsLiveAppId"] != null)
            {
                appId = ConfigurationManager.AppSettings["GlobalWindowsLiveAppId"];
                if (appId.Length == 0) { appId = siteSettings.WindowsLiveAppId; }
            }

            if (ConfigurationManager.AppSettings["GlobalWindowsLiveAppKey"] != null)
            {
                appKey = ConfigurationManager.AppSettings["GlobalWindowsLiveAppKey"];
                if (appKey.Length == 0) { appKey = siteSettings.WindowsLiveKey; }
            }

            if (
                (appId.Length > 0)
                && (appKey.Length > 0)
                )
            {
                WindowsLiveLogin windowsLive = new WindowsLiveLogin(
                    appId,
                    appKey,
                    WindowsLiveSecurityAlgorithm,
                    forceDelAuthNonProvisioned,
                    privacyPolicyUrl,
                    returnUrl);

                windowsLive.AppName = siteSettings.SiteName;
                if (siteSettings.AppLogoForWindowsLive.Length > 0)
                {
                    windowsLive.AppLogoUrl = siteRoot + siteSettings.AppLogoForWindowsLive;
                }

                return windowsLive;

            }

            return null;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Initialize the ConsentToken.
 /// </summary>
 /// <param name="wll">WindowsLiveLogin</param>
 /// <param name="delegationToken">Delegation token</param>
 /// <param name="refreshToken">Refresh token</param>
 /// <param name="sessionKey">Session key</param>
 /// <param name="expiry">Expiry</param>
 /// <param name="offers">Offers</param>
 /// <param name="locationID">Location ID</param>
 /// <param name="context">Application context</param>
 /// <param name="decodedToken">Decoded token</param>
 /// <param name="token">Raw token</param>
 public ConsentToken(WindowsLiveLogin wll, string delegationToken, string refreshToken, string sessionKey, string expiry, string offers, string locationID, string context, string decodedToken, string token)
 {
     this.wll = wll;
     setDelegationToken(delegationToken);
     setRefreshToken(refreshToken);
     setSessionKey(sessionKey);
     setExpiry(expiry);
     setOffers(offers);
     setLocationID(locationID);
     setContext(context);
     setDecodedToken(decodedToken);
     setToken(token);
 }
        private void LoadSettings()
        {
            siteSettings = CacheHelper.GetCurrentSiteSettings();
            siteRoot = SiteUtils.GetNavigationSiteRoot();

            winliveCookieName = "winliveid"
                + siteSettings.SiteId.ToString(CultureInfo.InvariantCulture);

            returnUrlCookieName = "ret"
                + siteSettings.SiteId.ToString(CultureInfo.InvariantCulture);

            windowsLive = WindowsLiveHelper.GetWindowsLiveLogin();
        }