protected override bool ValidateSharePointContext(SharePointContext spContext, HttpContextBase httpContext) { SharePointHighTrustContext spHighTrustContext = spContext as SharePointHighTrustContext; if (spHighTrustContext != null) { Uri spHostUrl = SharePointContext.GetSPHostUrl(httpContext.Request); WindowsIdentity logonUserIdentity = httpContext.Request.LogonUserIdentity; return(spHostUrl == spHighTrustContext.SPHostUrl && logonUserIdentity != null && logonUserIdentity.IsAuthenticated && !logonUserIdentity.IsGuest && logonUserIdentity.User == spHighTrustContext.LogonUserIdentity.User); } return(false); }
protected override bool ValidateSharePointContext(SharePointContext spContext, HttpContextBase httpContext, Uri spHostUrl) { SharePointHighTrustContext spHighTrustContext = spContext as SharePointHighTrustContext; if (spHighTrustContext != null) { if (spHostUrl == null) { spHostUrl = SharePointContext.GetSPHostUrl(httpContext.Request); } WindowsIdentity logonUserIdentity = httpContext.Request.LogonUserIdentity; return(string.Equals(spHostUrl.GetLeftPart(UriPartial.Path).TrimEnd('/'), spHighTrustContext.SPHostUrl.GetLeftPart(UriPartial.Path).TrimEnd('/'), StringComparison.OrdinalIgnoreCase) && logonUserIdentity != null && logonUserIdentity.IsAuthenticated && !logonUserIdentity.IsGuest && logonUserIdentity.User == spHighTrustContext.LogonUserIdentity.User); } return(false); }