mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-02 16:30:17 +02:00
mcp: handle and pass upstream oauth2 tokens (#5595)
This commit is contained in:
parent
561b6040b5
commit
9d66f762e1
14 changed files with 337 additions and 80 deletions
|
@ -215,6 +215,16 @@ type MCP struct {
|
|||
PassUpstreamAccessToken bool `mapstructure:"pass_upstream_access_token" yaml:"pass_upstream_access_token,omitempty" json:"pass_upstream_access_token,omitempty"`
|
||||
}
|
||||
|
||||
// HasUpstreamOAuth2 checks if the route is for the MCP Server and if it has an upstream OAuth2 configuration
|
||||
func (p *MCP) HasUpstreamOAuth2() bool {
|
||||
return p != nil && p.UpstreamOAuth2 != nil
|
||||
}
|
||||
|
||||
// IsUpstreamClientNeedsAccessToken checks if the route is for the MCP Client and if it needs to pass the upstream access token
|
||||
func (p *MCP) IsUpstreamClientNeedsAccessToken() bool {
|
||||
return p != nil && p.UpstreamOAuth2 != nil && p.PassUpstreamAccessToken
|
||||
}
|
||||
|
||||
type UpstreamOAuth2 struct {
|
||||
ClientID string `mapstructure:"client_id" yaml:"client_id,omitempty" json:"client_id,omitempty"`
|
||||
ClientSecret string `mapstructure:"client_secret" yaml:"client_secret,omitempty" json:"client_secret,omitempty"`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue