MCP PHP SDK

OAuthRequestMetaMiddleware implements MiddlewareInterface

FinalYes

Copies OAuth request attributes to JSON-RPC request meta.

This middleware bridges HTTP-layer authorization attributes (oauth.*) to JSON-RPC _meta.oauth so tools can access them via RequestContext.

Tags
author

Volodymyr Panivko sveneld300@gmail.com

Table of Contents

Interfaces

MiddlewareInterface

Properties

$streamFactory  : StreamFactoryInterface

Methods

__construct()  : mixed
process()  : ResponseInterface
extractOAuthAttributes()  : array<string, mixed>
injectIntoMessage()  : array<string, mixed>
injectOauthMeta()  : mixed

Properties

Methods

__construct()

public __construct([StreamFactoryInterface|null $streamFactory = null ]) : mixed
Parameters
$streamFactory : StreamFactoryInterface|null = null

process()

public process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Parameters
$request : ServerRequestInterface
$handler : RequestHandlerInterface
Return values
ResponseInterface

extractOAuthAttributes()

private extractOAuthAttributes(ServerRequestInterface $request) : array<string, mixed>
Parameters
$request : ServerRequestInterface
Return values
array<string, mixed>

injectIntoMessage()

private injectIntoMessage(array<string, mixed> $message, array<string, mixed> $oauthMeta) : array<string, mixed>
Parameters
$message : array<string, mixed>
$oauthMeta : array<string, mixed>
Return values
array<string, mixed>

injectOauthMeta()

private injectOauthMeta(mixed $payload, array<string, mixed> $oauthMeta) : mixed
Parameters
$payload : mixed
$oauthMeta : array<string, mixed>

        
On this page

Search results