Created
April 11, 2023 05:43
-
-
Save vtml/503d4b9a96d674e90e165b0147d8cb53 to your computer and use it in GitHub Desktop.
Adding a hard coded authentication header to the Coveo HTML Index Crawler
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Sitecore.Configuration; | |
using Coveo.SearchProvider.Processors.FetchPageContent.PreAuthenticators; | |
namespace CPA.Foundation.Coveo.Processors.preAuthentication | |
{ | |
/// <summary> | |
/// Adds a custom authentication header so that Coveo indexer can bypass login page for authenticated content | |
/// https://docs.coveo.com/en/2326/coveo-for-sitecore-v5/index-page-content-with-the-fetchpagecontentprocessor#the-preauthentication-section | |
/// </summary> | |
public class PreAuthenticationCustomHeader : IFetchPageContentPreAuthenticatorProcessor | |
{ | |
public void Process(FetchPageContentPreAuthenticatorArgs args) | |
{ | |
var headerName = Settings.GetSetting(Constants.AuthenticationHeaderName); | |
var headerValue = Settings.GetSetting(Constants.AuthenticationHeaderValue); | |
args?.Request?.Headers?.Add(headerName, headerValue); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment