Example #1
0
        public ExternalChallenge GetNextExternalChallenge()
        {
            ExternalChallenge nextExternalChallenge = this.m_nextExternalChallenge;

            if (this.m_nextExternalChallenge != null)
            {
                this.m_nextExternalChallenge = this.m_nextExternalChallenge.Next;
            }
            return(nextExternalChallenge);
        }
Example #2
0
 public bool CheckWebAuth(out string url)
 {
     url = null;
     if (this.m_challengeAPI != null && this.InState(BattleNetCSharp.ConnectionState.WaitForLogon))
     {
         ExternalChallenge nextExternalChallenge = this.m_challengeAPI.GetNextExternalChallenge();
         if (nextExternalChallenge != null)
         {
             url = nextExternalChallenge.URL;
             this.m_logSource.LogDebug("Delivering a challenge url={0}", new object[]
             {
                 url
             });
             return(true);
         }
     }
     return(false);
 }
Example #3
0
        private void OnExternalChallengeCallback(RPCContext context)
        {
            ChallengeExternalRequest challengeExternalRequest = ChallengeExternalRequest.ParseFrom(context.Payload);

            if (!challengeExternalRequest.IsInitialized || !challengeExternalRequest.HasPayload)
            {
                base.ApiLog.LogWarning("Bad ChallengeExternalRequest received IsInitialized={0} HasRequestToken={1} HasPayload={2} HasPayloadType={3}", new object[]
                {
                    challengeExternalRequest.IsInitialized,
                    challengeExternalRequest.HasRequestToken,
                    challengeExternalRequest.HasPayload,
                    challengeExternalRequest.HasPayloadType
                });
                return;
            }
            if (challengeExternalRequest.PayloadType != "web_auth_url")
            {
                base.ApiLog.LogWarning("Received a PayloadType we don't know how to handle PayloadType={0}", new object[]
                {
                    challengeExternalRequest.PayloadType
                });
                return;
            }
            ExternalChallenge externalChallenge = new ExternalChallenge();

            externalChallenge.PayLoadType = challengeExternalRequest.PayloadType;
            externalChallenge.URL         = Encoding.ASCII.GetString(challengeExternalRequest.Payload);
            base.ApiLog.LogDebug("Received external challenge PayLoadType={0} URL={1}", new object[]
            {
                externalChallenge.PayLoadType,
                externalChallenge.URL
            });
            if (this.m_nextExternalChallenge == null)
            {
                this.m_nextExternalChallenge = externalChallenge;
            }
            else
            {
                this.m_nextExternalChallenge.Next = externalChallenge;
            }
        }