Beispiel #1
0
 public void Show()
 {
     if (this.m_show)
     {
         return;
     }
     this.m_show = true;
     WebAuth.ShowWebView(true);
 }
Beispiel #2
0
 public void Hide()
 {
     if (!this.m_show)
     {
         return;
     }
     this.m_show = false;
     WebAuth.ShowWebView(false);
 }
Beispiel #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]);
    }
Beispiel #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));
        }
Beispiel #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
        });
    }
Beispiel #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);
    }
Beispiel #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
        });
    }
        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);
        }
Beispiel #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"));
        }
Beispiel #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 }));
            }
        }
Beispiel #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);
        }
Beispiel #13
0
 public static void DeleteCookies()
 {
     WebAuth.ClearWebViewCookies();
 }
Beispiel #14
0
 public static void ClearBrowserCache()
 {
     WebAuth.ClearURLCache();
 }
Beispiel #15
0
 protected void UserPressedStartButton(UIEvent e)
 {
     WebAuth.ClearLoginData();
     base.BackToMode(SceneMgr.Mode.RESET);
 }
Beispiel #16
0
 public static void ClearLoginData()
 {
     WebAuth.DeleteStoredToken();
     WebAuth.DeleteCookies();
     WebAuth.ClearBrowserCache();
 }
Beispiel #17
0
 public string GetLoginCode()
 {
     Debug.Log("GetLoginCode");
     return(WebAuth.GetWebViewLoginCode());
 }
Beispiel #18
0
 private void ClearLogin(UIEvent e)
 {
     UnityEngine.Debug.LogWarning("Clear Login Button pressed from the Splash Screen!");
     WebAuth.ClearLoginData();
 }
Beispiel #19
0
 public static bool SetStoredToken(string str)
 {
     return(WebAuth.SetStoredLoginToken(str));
 }
Beispiel #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);
 }
Beispiel #21
0
 public void SetCountryCodeCookie(string countryCode, string domain)
 {
     WebAuth.SetWebViewCountryCodeCookie(countryCode, domain);
 }
Beispiel #22
0
 public static void DeleteStoredToken()
 {
     WebAuth.DeleteStoredLoginToken();
 }
Beispiel #23
0
 public static void UpdateBreakingNews(string title, string body, string gameObjectName)
 {
     WebAuth.SetBreakingNews(title, body, gameObjectName);
 }
Beispiel #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);
 }
Beispiel #26
0
 public static string GetStoredToken()
 {
     return(WebAuth.GetStoredLoginToken());
 }
Beispiel #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();
     }
 }
Beispiel #28
0
 public void Close()
 {
     WebAuth.CloseWebView();
 }
Beispiel #29
0
 public static void GoBackWebPage()
 {
     WebAuth.GoBack();
 }