mirror of
https://github.com/pomerium/pomerium.git
synced 2025-08-02 16:30:17 +02:00
mcp: add to route config, 401 when unauthenticated (#5578)
This commit is contained in:
parent
a10b505386
commit
e71fca76f2
6 changed files with 889 additions and 775 deletions
|
@ -202,8 +202,14 @@ type Policy struct {
|
|||
Policy *PPLPolicy `mapstructure:"policy" yaml:"policy,omitempty" json:"policy,omitempty"`
|
||||
|
||||
DependsOn []string `mapstructure:"depends_on" yaml:"depends_on,omitempty" json:"depends_on,omitempty"`
|
||||
|
||||
// MCP is an experimental support for Model Context Protocol upstreams
|
||||
MCP *MCP `mapstructure:"mcp" yaml:"mcp,omitempty" json:"mcp,omitempty"`
|
||||
}
|
||||
|
||||
// MCP is an experimental support for Model Context Protocol upstreams configuration
|
||||
type MCP struct{}
|
||||
|
||||
// RewriteHeader is a policy configuration option to rewrite an HTTP header.
|
||||
type RewriteHeader struct {
|
||||
Header string `mapstructure:"header" yaml:"header" json:"header"`
|
||||
|
@ -316,6 +322,7 @@ func NewPolicyFromProto(pb *configpb.Route) (*Policy, error) {
|
|||
KubernetesServiceAccountToken: pb.GetKubernetesServiceAccountToken(),
|
||||
KubernetesServiceAccountTokenFile: pb.GetKubernetesServiceAccountTokenFile(),
|
||||
LogoURL: pb.GetLogoUrl(),
|
||||
MCP: MCPFromPB(pb.GetMcp()),
|
||||
Name: pb.GetName(),
|
||||
PassIdentityHeaders: pb.PassIdentityHeaders,
|
||||
Path: pb.GetPath(),
|
||||
|
@ -470,6 +477,7 @@ func (p *Policy) ToProto() (*configpb.Route, error) {
|
|||
KubernetesServiceAccountToken: p.KubernetesServiceAccountToken,
|
||||
KubernetesServiceAccountTokenFile: p.KubernetesServiceAccountTokenFile,
|
||||
LogoUrl: p.LogoURL,
|
||||
Mcp: MCPToPB(p.MCP),
|
||||
Name: p.Name,
|
||||
PassIdentityHeaders: p.PassIdentityHeaders,
|
||||
Path: p.Path,
|
||||
|
@ -824,6 +832,11 @@ func (p *Policy) IsForKubernetes() bool {
|
|||
return p.KubernetesServiceAccountTokenFile != "" || p.KubernetesServiceAccountToken != ""
|
||||
}
|
||||
|
||||
// IsMCP returns true if the route is for the Model Context Protocol upstream server.
|
||||
func (p *Policy) IsMCP() bool {
|
||||
return p != nil && p.MCP != nil
|
||||
}
|
||||
|
||||
// IsTCP returns true if the route is for TCP.
|
||||
func (p *Policy) IsTCP() bool {
|
||||
return strings.HasPrefix(p.From, "tcp")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue