Pass auth token from document collators
Co-authored-by: Nataliya Issayeva <nissayeva@users.noreply.github.com> Co-authored-by: Tim Hansen <timbonicus@gmail.com> Signed-off-by: Joe Porpeglia <josephp@spotify.com>
This commit is contained in:
committed by
Nataliya Issayeva
parent
657a6a0b8e
commit
2a320c21b4
@@ -157,7 +157,9 @@ async function main() {
|
||||
const token =
|
||||
IdentityClient.getBearerToken(req.headers.authorization) ||
|
||||
req.cookies.token;
|
||||
req.user = await identity.authenticate(token);
|
||||
|
||||
await authEnv.tokenManager.validateToken(token);
|
||||
|
||||
if (!req.headers.authorization) {
|
||||
// Authorization header may be forwarded by plugin requests
|
||||
req.headers.authorization = `Bearer ${token}`;
|
||||
|
||||
@@ -59,6 +59,7 @@ export default async function createPlugin({
|
||||
discovery,
|
||||
config,
|
||||
database,
|
||||
tokenManager,
|
||||
}: PluginEnvironment) {
|
||||
// Initialize a connection to a search engine.
|
||||
const searchEngine = await createSearchEngine({ config, logger, database });
|
||||
@@ -68,7 +69,10 @@ export default async function createPlugin({
|
||||
// particular collator gathers entities from the software catalog.
|
||||
indexBuilder.addCollator({
|
||||
defaultRefreshIntervalSeconds: 600,
|
||||
collator: DefaultCatalogCollator.fromConfig(config, { discovery }),
|
||||
collator: DefaultCatalogCollator.fromConfig(config, {
|
||||
discovery,
|
||||
tokenManager,
|
||||
}),
|
||||
});
|
||||
|
||||
indexBuilder.addCollator({
|
||||
@@ -76,6 +80,7 @@ export default async function createPlugin({
|
||||
collator: DefaultTechDocsCollator.fromConfig(config, {
|
||||
discovery,
|
||||
logger,
|
||||
tokenManager,
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user