authz

package
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MetricsGroup         = "metrics"
	UnauthenticatedGroup = "unauthenticated"
)

Variables

This section is empty.

Functions

func CheckMCPIDAccess added in v0.24.0

func CheckMCPIDAccess(ctx context.Context, client kclient.Client, acrHelper *accesscontrolrule.Helper, user kuser.Info, mcpID string) (bool, error)

func CheckVMCPComponentAccess added in v0.26.0

func CheckVMCPComponentAccess(ctx context.Context, u kuser.Info, ownerID string, entry *v1.MCPServerCatalogEntry, helper *accesscontrolrule.Helper, userInfo func(context.Context, uint) (kuser.Info, error)) error

CheckVMCPComponentAccess restricts personal vMCP components to accessible entries.

func IsVMCPAdministrator added in v0.26.0

func IsVMCPAdministrator(u kuser.Info) bool

func MCPIDIsAuthorized added in v0.24.0

func MCPIDIsAuthorized(ctx context.Context, client kclient.Client, authorizedMCPServers []string, userID, mcpID string) (bool, error)

func UserCanConnectToMCP added in v0.26.0

func UserCanConnectToMCP(ctx context.Context, client kclient.Client, acrHelper *accesscontrolrule.Helper, user kuser.Info, mcpID string) (bool, error)

UserCanConnectToMCP applies the same current-user authorization used by the MCP gateway. API handlers that act on an MCP deployment without traversing /mcp-connect must call this rather than relying on management visibility.

func UserCanConnectVMCP added in v0.26.0

func UserCanConnectVMCP(u kuser.Info, vmcp *v1.VMCP) bool

func UserCanManageVMCP added in v0.26.0

func UserCanManageVMCP(u kuser.Info, vmcp *v1.VMCP) bool

func UserCanReadCatalogEntry added in v0.26.0

func UserCanReadCatalogEntry(ctx context.Context, u kuser.Info, entry *v1.MCPServerCatalogEntry, helper *accesscontrolrule.Helper) (bool, error)

UserCanReadCatalogEntry checks access using the entry's stored scope.

func UserCanReadVMCP added in v0.26.0

func UserCanReadVMCP(u kuser.Info, vmcp *v1.VMCP) bool

UserCanReadVMCP applies the VMCP visibility model. A personal VMCP is only visible to its owner. A shared VMCP is visible to users matching at least one profile; catalog access is intentionally irrelevant.

func UserCanReadVMCPInstance added in v0.26.0

func UserCanReadVMCPInstance(u kuser.Info, instance *v1.VMCPInstance, vmcp *v1.VMCP) bool

func ValidateVMCPToolSelection added in v0.26.0

func ValidateVMCPToolSelection(u kuser.Info, vmcp *v1.VMCP, selection map[string]types.VMCPComponentSet) error

ValidateVMCPToolSelection rejects explicit selections outside the profile union.

Types

type Authorizer

type Authorizer struct {
	// contains filtered or unexported fields
}

func NewAuthorizer

func NewAuthorizer(gatewayClient *client.Client, cache, uncached kclient.Client, devMode bool, acrHelper *accesscontrolrule.Helper, skillHelper *skillaccessrule.Helper, hostedAgentHelper *hostedagentaccessrule.Helper, registryNoAuth bool) *Authorizer

func (*Authorizer) Authorize

func (a *Authorizer) Authorize(req *http.Request, userInfo user.Info) bool

type GetVar added in v0.7.0

type GetVar func(string) string

type Resources added in v0.7.0

type Resources struct {
	MCPServerID             string
	MCPServerInstanceID     string
	MCPServerCatalogEntryID string
	VMCPComponentMCPID      string
	VMCPID                  string
	VMCPInstanceID          string
	// MCPID can be the ID of an MCPServer, an MCPServerInstance, or MCPServerCatalogEntry. It is used for interaction with the MCP gateway.
	MCPID                 string
	WorkspaceID           string
	NanobotAgentID        string
	ProjectID             string
	PublishedArtifactID   string
	ArtifactVersion       string
	SkillID               string
	DeviceScanID          string
	OAuthAuthRequestID    string
	HostedAgentID         string
	HostedAgentInstanceID string
	Authorizated          ResourcesAuthorized
}

type ResourcesAuthorized added in v0.7.0

type ResourcesAuthorized struct {
	MCPServer             *v1.MCPServer
	MCPServerInstance     *v1.MCPServerInstance
	MCPServerCatalogEntry *v1.MCPServerCatalogEntry
	VMCP                  *v1.VMCP
	VMCPInstance          *v1.VMCPInstance
	PowerUserWorkspace    *v1.PowerUserWorkspace
	NanobotAgent          *v1.NanobotAgent
	Project               *v1.Project
	PublishedArtifact     *v1.PublishedArtifact
	Skill                 *v1.Skill
	HostedAgent           *v1.HostedAgent
	HostedAgentInstance   *v1.HostedAgentInstance
}

type User added in v0.23.0

type User struct {
	kuser.Info

	IsAdmin        bool
	IsAuditor      bool
	IsOwner        bool
	CanImpersonate bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL