mirror of
https://github.com/outline/outline.git
synced 2026-11-22 14:01:41 +03:00
This PR contains the necessary work to make Outline an OAuth provider including: - OAuth app registration - OAuth app management - Private / public apps (Public in cloud only) - Full OAuth 2.0 spec compatible authentication flow - Granular scopes - User token management screen in settings - Associated API endpoints for programatic access
25 lines
652 B
TypeScript
25 lines
652 B
TypeScript
import { Context, Next } from "koa";
|
|
import { addTags, getRootSpanFromRequestContext } from "@server/logging/tracer";
|
|
|
|
export default function requestTracer() {
|
|
return async function requestTracerMiddleware(ctx: Context, next: Next) {
|
|
const params = ctx.request.body ?? ctx.request.query;
|
|
|
|
for (const key in params) {
|
|
if (key === "id" || key.endsWith("Id")) {
|
|
const value = params[key];
|
|
if (typeof value === "string") {
|
|
addTags(
|
|
{
|
|
[`resource.${key}`]: value,
|
|
},
|
|
getRootSpanFromRequestContext(ctx)
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
await next();
|
|
};
|
|
}
|