Exemple #1
0
        public async Task<bool> Connect(LeagueRegion region, AuthenticationCredentials credentials)
        {
            if (Connection == null)
            {
                var connection = Create();
                var connected = await new ConnectionTask(connection).Initiate(region.ServerUri);
                if (!connected)
                    return false;

                Connection = connection;
            }

            Connection.AddHeader(MessageBase.RequestTimeoutHeader, false, 60);
            Connection.AddHeader(MessageBase.FlexClientIdHeader, false, Guid.NewGuid().ToString());
            Connection.AddHeader(MessageBase.EndpointHeader, false, Invocation.EndpointName);

            // Setup the session
            await _sessions.Login(Connection, credentials);

            // Subscribe to all of the fun messages
            await _subscriptions.Subscribe(Connection);

            // Startup the heartbeat
            _heartbeat.Start(Connection);

            return (IsConnected = true);
        }
Exemple #2
0
        public async Task<LolSession> Login(IRtmpConnection connection, AuthenticationCredentials credentials)
        {
            Credentials = credentials;

            var invoke = new Invocation<LolSession>("loginService", "login", credentials);
            CurrentSession = await invoke.Execute(connection);

            await AuthorizeSession(connection, CurrentSession);

            if (_action != null)
                _action();

            return CurrentSession;
        }
        void NetConnectionOnConnect(object sender, EventArgs eventArguments)
        {
            /// TODO: Check if there was a problem connecting

            // Now that we are connected call the remote login function
            AuthenticationCredentials authenticationCredentials = new AuthenticationCredentials();
            authenticationCredentials.authToken = AuthResponse.Token;

            authenticationCredentials.clientVersion = ConnectionData.Authentication.ClientVersion;
            authenticationCredentials.domain = ConnectionData.Authentication.Domain;
            authenticationCredentials.ipAddress = ConnectionData.Authentication.IPAddress;
            authenticationCredentials.locale = ConnectionData.Authentication.Locale;
            authenticationCredentials.oldPassword = null;
            authenticationCredentials.partnerCredentials = null;
            authenticationCredentials.securityAnswer = null;
            authenticationCredentials.password = ConnectionData.Password;
            authenticationCredentials.username = ConnectionData.User;

            // Add some default headers
            RPCNetConnection.AddHeader(MessageBase.RequestTimeoutHeader, false, 60);
            RPCNetConnection.AddHeader(MessageBase.FlexClientIdHeader, false, Guid.NewGuid().ToString());
            RPCNetConnection.AddHeader(MessageBase.EndpointHeader, false, EndpointString);

            RPCNetConnection.Call(EndpointString, "loginService", null, "login", new Responder<Session>(OnLogin, OnLoginFault), authenticationCredentials);
        }