Example #1
0
 public void Show()
 {
     if (this.m_show)
     {
         return;
     }
     this.m_show = true;
     WebAuth.ShowWebView(true);
 }
Example #2
0
 public void Hide()
 {
     if (!this.m_show)
     {
         return;
     }
     this.m_show = false;
     WebAuth.ShowWebView(false);
 }
Example #3
0
    private static void GoBack()
    {
        if (!WebAuth.IsWebLoginActivityReady())
        {
            return;
        }
        AndroidJavaObject androidJavaObject = WebAuth.m_androidWebLoginActivity.CallStatic <AndroidJavaObject>("getInstance", new object[0]);

        androidJavaObject.Call("GoBack", new object[0]);
    }
Example #4
0
    private static string GetWebViewLoginCode()
    {
        if (!WebAuth.IsWebLoginActivityReady())
        {
            return(string.Empty);
        }
        AndroidJavaObject androidJavaObject = WebAuth.m_androidWebLoginActivity.CallStatic <AndroidJavaObject>("getInstance", new object[0]);

        return(androidJavaObject.Call <string>("GetWebViewLoginCode", new object[0]));
    }
        public WebV2RequestRepo(IWebProxy proxy, IBasicCredentials creds, AuthCodeRequiredDelegate onAuthCodeRequired)
        {
            HttpSettings.Proxy = proxy;

            Authent = new WebAuth(HttpSettings, creds, onAuthCodeRequired);

            _bannedShards = new Cached <List <ShardInfo> >(old => new List <ShardInfo>(),
                                                           value => TimeSpan.FromMinutes(2));

            _cachedShards = new Cached <Dictionary <ShardType, ShardInfo> >(old => new ShardInfoRequest(HttpSettings, Authent).MakeRequestAsync().Result.ToShardInfo(),
                                                                            value => TimeSpan.FromSeconds(ShardsExpiresInSec));
        }
Example #6
0
    private static void SetRegionSelectVisualState(bool isVisible)
    {
        if (!WebAuth.IsWebLoginActivityReady())
        {
            return;
        }
        AndroidJavaObject androidJavaObject = WebAuth.m_androidWebLoginActivity.CallStatic <AndroidJavaObject>("getInstance", new object[0]);

        androidJavaObject.Call("SetRegionSelectVisualState", new object[]
        {
            isVisible
        });
    }
Example #7
0
    public WebAuth.Status GetStatus()
    {
        int webViewStatus = WebAuth.GetWebViewStatus();

        if (webViewStatus == 6)
        {
            Debug.Log("------------ Web View status no instance ------------");
        }
        if (webViewStatus < 0 || webViewStatus >= 7)
        {
            return(WebAuth.Status.Error);
        }
        return((WebAuth.Status)webViewStatus);
    }
Example #8
0
    private static void SetBreakingNews(string localized_title, string body, string gameObjectName)
    {
        if (!WebAuth.IsWebLoginActivityReady())
        {
            return;
        }
        AndroidJavaObject androidJavaObject = WebAuth.m_androidWebLoginActivity.CallStatic <AndroidJavaObject>("getInstance", new object[0]);

        androidJavaObject.Call("SetBreakingNews", new object[]
        {
            localized_title,
            body,
            gameObjectName
        });
    }
Example #9
0
        public bool RequestAndCheck()
        {
            bool ret = false;

            HttpContext context = WebApplication.CurrentContext;
            HttpRequest request = context.Request;

            string invalidateHandle = request.UriArgs["openid.invalidate_handle"];

            if (invalidateHandle == null)
            {
                var discover = new DiscoverRequest();
                discover.Request(context.OverlayNode, DiscoverRequest.Google_Discover_OpenID_Endpoint);

                var auth = new WebAuth();

                var ub = new UriBuilder(context.Request.Uri);

                lock (sync)
                {
                    if (!CacheAssociations.ContainsKey(auth.ToStringHandle()))
                    {
                        CacheAssociations.Add(auth.ToStringHandle(),
                                              new KeyAssociation(auth.ToStringHandle()));
                    }
                }

                var realm   = ub.Uri.ToString();
                var authReq = new AuthenticationRequest(discover, realm,
                                                        auth.ToStringHandle(), realm, AppNode);

                context.Reply.RedirectTo(authReq.UrlRedirectTo());
            }
            else
            {
                lock (sync)
                {
                    ret = CacheAssociations.ContainsKey(invalidateHandle);
                    if (ret)
                    {
                        CacheAssociations.Remove(invalidateHandle);
                    }
                }
            }

            return(ret);
        }
Example #10
0
        public async Task <IActionResult> Index([FromQuery(Name = "ReturnUrl")] string returnUrl, string username, string password, ulong guild)
        {
            var identity = await WebAuth.Authorize(username, password, guild);

            if (identity == null)
            {
                return(View(new AuthViewModel(DiscordClient.Guilds.ToList(), true)));
            }

            await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme,
                                          new ClaimsPrincipal(identity), new AuthenticationProperties()
            {
                ExpiresUtc  = DateTimeOffset.UtcNow.AddHours(1),
                IssuedUtc   = DateTimeOffset.UtcNow,
                RedirectUri = string.IsNullOrEmpty(returnUrl) ? "/" : returnUrl
            });

            return(RedirectToAction("Index", "Admin"));
        }
Example #11
0
        public ActionResult LoginOut(string callbackUrl)
        {
            string token = System.Web.HttpContext.Current.User.Identity.Name;

            if (string.IsNullOrEmpty(token))
            {
                token = WebAuth.GetToken();
            }
            if (!string.IsNullOrEmpty(token))
            {
                //clear token
            }
            RemoveSessionInCookie();
            FormsAuthentication.SignOut();

            if (string.IsNullOrEmpty(callbackUrl))
            {
                return(Redirect(nameof(Login)));
            }
            else
            {
                return(RedirectToAction(nameof(Login), new { callbackUrl = callbackUrl }));
            }
        }
Example #12
0
        private string GetDropboxToken()
        {
            string accessToken = Settings.Default.AccessToken;

            if (string.IsNullOrEmpty(accessToken))
            {
                WebAuth dialog = new WebAuth(ConsumerKey, ConsumerSecret);
                dialog.ShowDialog();
                if (dialog.Result)
                {
                    accessToken = dialog.Token.access_token;
                    Settings.Default.AccessToken = accessToken;
                    Settings.Default.Uid         = dialog.Token.uid;

                    Settings.Default.Save();
                }
                else
                {
                    MessageBox.Show("Could not authenticate to Dropbox", "Authentication Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    throw new UnauthorizedAccessException("Dropbox authentication failed.");
                }
            }
            return(accessToken);
        }
Example #13
0
 public static void DeleteCookies()
 {
     WebAuth.ClearWebViewCookies();
 }
Example #14
0
 public static void ClearBrowserCache()
 {
     WebAuth.ClearURLCache();
 }
Example #15
0
 protected void UserPressedStartButton(UIEvent e)
 {
     WebAuth.ClearLoginData();
     base.BackToMode(SceneMgr.Mode.RESET);
 }
Example #16
0
 public static void ClearLoginData()
 {
     WebAuth.DeleteStoredToken();
     WebAuth.DeleteCookies();
     WebAuth.ClearBrowserCache();
 }
Example #17
0
 public string GetLoginCode()
 {
     Debug.Log("GetLoginCode");
     return(WebAuth.GetWebViewLoginCode());
 }
Example #18
0
 private void ClearLogin(UIEvent e)
 {
     UnityEngine.Debug.LogWarning("Clear Login Button pressed from the Splash Screen!");
     WebAuth.ClearLoginData();
 }
Example #19
0
 public static bool SetStoredToken(string str)
 {
     return(WebAuth.SetStoredLoginToken(str));
 }
Example #20
0
 public void Load()
 {
     Debug.Log("Load");
     WebAuth.LoadWebView(this.m_url, this.m_window.x, this.m_window.y, this.m_window.width, this.m_window.height, Main.uniqueIdentifier, this.m_callbackGameObject);
 }
Example #21
0
 public void SetCountryCodeCookie(string countryCode, string domain)
 {
     WebAuth.SetWebViewCountryCodeCookie(countryCode, domain);
 }
Example #22
0
 public static void DeleteStoredToken()
 {
     WebAuth.DeleteStoredLoginToken();
 }
Example #23
0
 public static void UpdateBreakingNews(string title, string body, string gameObjectName)
 {
     WebAuth.SetBreakingNews(title, body, gameObjectName);
 }
Example #24
0
 public static void UpdateRegionSelectVisualState(bool isVisible)
 {
     WebAuth.SetRegionSelectVisualState(isVisible);
 }
 public void Load()
 {
     Debug.Log("Load");
     WebAuth.LoadWebView(this.m_url, this.m_window.get_x(), this.m_window.get_y(), this.m_window.get_width(), this.m_window.get_height(), Main.uniqueIdentifier, this.m_callbackGameObject);
 }
Example #26
0
 public static string GetStoredToken()
 {
     return(WebAuth.GetStoredLoginToken());
 }
Example #27
0
 private void AssetsVersionCheckCompleted()
 {
     if (!string.IsNullOrEmpty(UpdateManager.Get().GetError()) && UpdateManager.Get().UpdateIsRequired())
     {
         Error.AddFatalLoc("GLUE_PATCHING_ERROR", new object[0]);
     }
     else
     {
         if (Network.ShouldBeConnectedToAurora())
         {
             BnetPresenceMgr.Get().Initialize();
             BnetFriendMgr.Get().Initialize();
             BnetChallengeMgr.Get().Initialize();
             BnetWhisperMgr.Get().Initialize();
             BnetNearbyPlayerMgr.Get().Initialize();
             FriendChallengeMgr.Get().OnLoggedIn();
             SpectatorManager.Get().Initialize();
             if (!Options.Get().GetBool(Option.CONNECT_TO_AURORA))
             {
                 Options.Get().SetBool(Option.CONNECT_TO_AURORA, true);
             }
             TutorialProgress progress = Options.Get().GetEnum <TutorialProgress>(Option.LOCAL_TUTORIAL_PROGRESS);
             if (progress > TutorialProgress.NOTHING_COMPLETE)
             {
                 this.m_waitingForSetProgress = true;
                 ConnectAPI.SetProgress((long)progress);
             }
             if (WebAuth.GetIsNewCreatedAccount())
             {
                 AdTrackingManager.Get().TrackAccountCreated();
                 WebAuth.SetIsNewCreatedAccount(false);
             }
         }
         ConnectAPI.RequestAccountLicenses();
         ConnectAPI.RequestGameLicenses();
         Box.Get().OnLoggedIn();
         BaseUI.Get().OnLoggedIn();
         InactivePlayerKicker.Get().OnLoggedIn();
         HealthyGamingMgr.Get().OnLoggedIn();
         DefLoader.Get().Initialize();
         CollectionManager.Init();
         AdventureProgressMgr.Init();
         Tournament.Init();
         GameMgr.Get().OnLoggedIn();
         if (Network.ShouldBeConnectedToAurora())
         {
             StoreManager.Get().Init();
         }
         Network.TrackClient(Network.TrackLevel.LEVEL_INFO, Network.TrackWhat.TRACK_LOGIN_FINISHED);
         Network.ResetConnectionFailureCount();
         if (Network.ShouldBeConnectedToAurora())
         {
             ConnectAPI.DoLoginUpdate();
         }
         else
         {
             this.m_waitingForUpdateLoginComplete = false;
         }
         Enum[] args = new Enum[] { PresenceStatus.LOGIN };
         PresenceMgr.Get().SetStatus(args);
         if (SplashScreen.Get() != null)
         {
             SplashScreen.Get().StopPatching();
             SplashScreen.Get().ShowRatings();
         }
         this.PreloadActors();
         if (!Network.ShouldBeConnectedToAurora())
         {
             base.StartCoroutine(this.RegisterScreenWhenReady());
         }
         SceneMgr.Get().LoadShaderPreCompiler();
     }
 }
Example #28
0
 public void Close()
 {
     WebAuth.CloseWebView();
 }
Example #29
0
 public static void GoBackWebPage()
 {
     WebAuth.GoBack();
 }