/// <summary> /// Determines whether or not a request should be validated /// </summary> /// <param name="actionContext">The action context.</param> /// <returns><c>true</c> if the request should be validated.</returns> public virtual bool ShouldValidateRequest(HttpActionContext actionContext) { if (this.ExcludeAuthenticationTypes == null && this.IncludeAuthenticationTypes == null) { return(true); } var identity = _contextProvider.GetCurrentIdentity(); if (this.RequireAuthentication && !identity.IsAuthenticated) { return(false); } if (!identity.IsAuthenticated) { return(true); } if (this.IncludeAuthenticationTypes != null) { return(IsAuthenticatedWithType(identity, this.IncludeAuthenticationTypes)); } return(!IsAuthenticatedWithType(identity, this.ExcludeAuthenticationTypes)); }
/// <summary> /// Determines whether or not a request should be validated /// </summary> /// <param name="actionContext">The action context.</param> /// <returns><c>true</c> if the request should be validated.</returns> public virtual bool ShouldValidateRequest(HttpActionContext actionContext) { if (this.ExcludeAuthenticationTypes != null) { var identity = _contextProvider.GetCurrentIdentity(); if (identity.IsAuthenticated && this.ExcludeAuthenticationTypes .Split(',') .Select(t => t.Trim()) .Contains(identity.AuthenticationType)) { return(false); } } return(true); }