Esempio n. 1
0
        private string GetAuthorizationToken(GATRequest p_Data, Guid p_Guid)
        {
            if (!CachingLayer.IPThrottle(p_Data.IPAddress))
            {
                throw new AccessViolationException("Throtteling was defined");
            }
            var target = new CipherEngine();
            //long p_SIDRandomNumber = new Random().Next(int.MinValue, int.MaxValue);
            string p_DataToEncrypt = string.Join(",", p_Guid, p_Data.CallingPage, ConfigurationManager.AppSettings["AppID"], p_Data.IPAddress, /* p_SIDRandomNumber,*/ DateTime.UtcNow.Ticks);
            string SIDKey          = target.Encrypt(p_DataToEncrypt);

            CachingLayer.Insert(SIDKey, p_Guid.ToString());
            return(SIDKey);
        }
Esempio n. 2
0
        public LoginResponse Login([FromBody] LoginRequest request)
        {
            LoginResponse response = new LoginResponse();

            response.IsAuthorised = false;
            try
            {
                BLUser user = new BLUser(request.Username, request.Password, request.CompanyName, Request.RequestUri.AbsolutePath);
                if (user != null)
                {
                    request.DecodeAuthToken();
                    CachingLayer.Insert <BLUser>(user, request.SID);
                    response.IsAuthorised = true;
                }
            }
            catch (ArgumentException ex) { }
            return(response);
        }