Ejemplo n.º 1
0
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            //_id = httpContext.GetToken(WebConfiguration.Instance.ConfigIdTokenName);
            //_account = httpContext.GetToken(WebConfiguration.Instance.ConfigAccountTokenName);
            //_securitykey = httpContext.GetToken(WebConfiguration.Instance.ConfigSecurityTokenName);

            //if (string.IsNullOrEmpty(_id) || string.IsNullOrEmpty(_account) || string.IsNullOrEmpty(_securitykey))
            //    return false;

            _logintype = httpContext.GetHeader(WebConfiguration.Instance.ConfigHeaderTypeName).ToEnum<LoginType>(LoginType.Web);
            //_code = httpContext.GetHeader(WebConfiguration.Instance.ConfigHeaderCodeName);

            return Reception.Instance.IsAuthorized(httpContext, _logintype);
        }
Ejemplo n.º 2
0
        public bool IsAuthorized(HttpContextBase context, LoginType type)
        {
            var _id = context.GetToken(WebConfiguration.Instance.ConfigIdTokenName);
            var _account = context.GetToken(WebConfiguration.Instance.ConfigAccountTokenName);
            var _securitykey = context.GetToken(WebConfiguration.Instance.ConfigSecurityTokenName);

            if (string.IsNullOrEmpty(_id) || string.IsNullOrEmpty(_account) || string.IsNullOrEmpty(_securitykey))
                return false;
            var _code = string.Empty;
            if (type == LoginType.Web)
                _code = context.GetIP();
            else _code = context.GetHeader(WebConfiguration.Instance.ConfigHeaderCodeName);

            var snap = new UserSnap() { Id = _id, Account = _account, SecurityKey = _securitykey, LoginType = type, LoginCode = _code };
            return Reception.Instance.IsAuthorized(snap);
        }