コード例 #1
0
        public async Task <AuthResponse> LoginTicketAuth([FromBody] AuthRequest authRequest)
        {
            var sessionLookup = new SessionLookup();

            sessionLookup.sessionKey = authRequest.login_ticket;
            var session = (await sessionRepository.Lookup(sessionLookup)).FirstOrDefault();

            if (session == null)
            {
                throw new AuthInvalidCredentialsException();
            }
            var response = new AuthResponse();
            var proof    = GetPasswordProof(session.profile, authRequest, ProofType.ProofType_LoginTicket, true);

            if (proof.CompareTo(authRequest.client_response) != 0)
            {
                throw new AuthInvalidCredentialsException();
            }
            response.server_response = GetPasswordProof(session.profile, authRequest, ProofType.ProofType_LoginTicket, false);
            response.profile         = session.profile;
            response.user            = session.user;
            response.session         = await generateSessionKey(response.profile);

            response.success = true;
            return(response);
        }
コード例 #2
0
        public async Task <SessionDeleteResponse> DeleteSession([FromBody] SessionLookup request)
        {
            var resp = new SessionDeleteResponse();

            resp.success = await this.sessionRepository.Delete(request);

            return(resp);
        }
コード例 #3
0
        public async Task <Session> GetSession([FromBody] AuthRequest request)
        {
            var lookup = new SessionLookup();

            lookup.sessionKey = request.password;
            var session = (await sessionRepository.Lookup(lookup)).FirstOrDefault();

            return(session);
        }
コード例 #4
0
        public void SessionDisconnected(ToffeeSession session)
        {
            if (session.SessionId >= UniqueIdentifiers.Count)
            {
                return;
            }
            UniqueIdentifiers[session.SessionId] = false;
            _Sessions.Remove(session);
            SessionLookup.Remove(session.SessionId);

            if (Server.Log != null)
            {
                Server.Log.Info("Session {0} disconnected.", session.SessionId);
            }
            Server.SessionDisconnected();
        }
コード例 #5
0
 public void NewSession(ToffeeSession session)
 {
     session.SessionId = GetUniqueIdentifier();
     _Sessions.Add(session);
     SessionLookup.Add(session.SessionId, session);
 }