ASPC.Marvel.CrimeAPI.SharePointHighTrustContextProvider.ValidateSharePointContext C# (CSharp) Method

ValidateSharePointContext() protected method

protected ValidateSharePointContext ( SharePointContext spContext, System.Web.HttpContextBase httpContext ) : bool
spContext SharePointContext
httpContext System.Web.HttpContextBase
return bool
        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;
        }