public override void OnActionExecuting(HttpActionContext actionContext) { var _request = actionContext.Request; if (actionContext.ActionDescriptor.ActionName == "GetAccessToken") { base.OnActionExecuting(actionContext); } else { NameValueCollection _queryString = HttpUtility.ParseQueryString(actionContext.Request.RequestUri.Query); if (_queryString != null) { string _token = _queryString["token"].ToStringOrDefault(string.Empty); if (!string.IsNullOrWhiteSpace(_token)) { AuthApiContext _authContext = new AuthApiContext(); Tuple <bool, string> _checkedResult = _authContext.ValidateToken(_token); if (!_checkedResult.Item1) { actionContext.Response = CreateTokenResponseMessage(_checkedResult.Item2); return; } else { base.OnActionExecuting(actionContext); } } } else { actionContext.Response = CreateTokenResponseMessage("非法请求数据!"); } } }
public UsuarioRepository(AuthApiContext context) : base(context) { }
public Repository(AuthApiContext context) { _context = context; }